Discord.py Self Bot using rewrite(Discord.py Self Bot 使用重写)
问题描述
我正在尝试使用 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 使用重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Discord.py Self Bot 使用重写
基础教程推荐
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
