问题描述
我正在尝试使用 discord.py rewrite 制作一个 selfbot.
I'm trying to make a selfbot using discord.py rewrite.
我在尝试创建简单命令时遇到问题.
I'm encountering issues when attempting to create a simple command.
我希望我的 selfbot 以oof"响应.当>>>测试"时已发送.
I'd like my selfbot to respond with "oof" when ">>>test" is sent.
这是我的代码:
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-bot 不是使用 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
取代,并且您不在 cog 中,因此您不应该使用 自我
.
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 使用重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!