問題描述
我正在嘗試使用 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 使用重寫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!