Discord.py Self Bot使用重写 [英] Discord.py Self Bot using rewrite
问题描述
您好,我想尝试使用discord.py重写来制作自拍程序以进行教育测试。
Hello im trying to make a selfbot using discord.py rewrite for educational testing.
我目前只能制作一个简单的命令来响应命令。
Im stuck currently with making a simple command which responds to a command.
我希望我的自拍程序在输入并发送 >>> test时说 oof
I want my selfbot to say "oof" when I type and send ">>>test"
这是我的代码:
import asyncio
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=(">>>"), self_bot=True)
@bot.event
async def on_ready():
print("Bot presence t u r n e d on ( ͡° ͜ʖ ͡°)")
@bot.command()
async def test(self, ctx):
await self.bot.say("oof")
bot.run("my token", bot=False)
推荐答案
自助机器人是这是一个使用 self
的机器人,它是使用您的凭据而不是机器人帐户登录的机器人。自助机器人反对Discord TOS(并且您不需要做任何需要做的事情),因此您应该通过他们的网站设置一个机器人帐户,并为您的机器人使用一个机器人帐户。
A self-bot isn't a bot that uses self
, it's a bot that logs in using your credentials instead of a bot account. Self bots are against the Discord TOS (and you're not doing anything that requires one), so you should set up a bot account through their website and use a bot account for your bot.
也就是说, bot.say
已被替换为 ctx.send
,而您不在齿轮中,因此您不应该全部使用 self
。
That said, bot.say
has been replaced by ctx.send
in rewrite, and you're not in a cog so you shouldn't use self
as all.
from discord.ext import commands
bot = commands.Bot(">>>", self_bot=True)
@bot.event
async def on_ready():
print("Bot presence t u r n e d on ( ͡° ͜ʖ ͡°)")
@bot.command()
async def test(ctx):
await ctx.send("oof")
bot.run("my token", bot=False)
这篇关于Discord.py Self Bot使用重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!