首页 文章

Discord.py Self Bot使用重写

提问于
浏览
0

您好我试图使用discord.py重写进行教育测试的自我机器人 .

我目前正在制作一个响应命令的简单命令 .

当我输入并发送“>>> test”时,我希望我的selfbot说“oof”

这是我的代码:

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)

1 回答

  • 0

    自我机器人不是使用 self 的机器人,它不会做任何需要的东西),所以你应该通过他们的网站 Build 一个机器人账户并为你的机器人使用机器人账户 .

    也就是说, bot.say 已被重写中的 ctx.send 替换,并且're not in a cog so you shouldn' t使用 self 作为全部 .

    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)
    

相关问题