在python中,如何删除所有用户的不和谐角色的最佳方法是什么?

2024-06-10 10:12:40 发布

您现在位置:Python中文网/ 问答频道 /正文

总的来说,我是一个完全不和谐/python noob,我真的没有任何代码可以显示,因为我甚至不知道从哪里开始。我要做的就是把每个人都从某个不和谐的角色中除掉。在

假设角色是“战士”,里面有5个人,我不想完全删除这个角色,相反,我只想从中删除所有5个人。我想理论上我可以删除整个角色,然后重新创建它,让我知道你的想法和最好的方法。在


Tags: 方法代码角色理论战士noob
1条回答
网友
1楼 · 发布于 2024-06-10 10:12:40

这是一个相当冗长的回答,但我建议阅读整件事。在

StackExchange是一个人们发布和讨论代码的社区。恕我直言,我可以向您保证,如果我们看不到您尝试过的代码或任何现有代码,这里没有人(包括我)会为您编写代码。在

如果你有一个相关的产品,人们可以在这个网站上查找错误和/或帮助你建立它,你一定会有更好的运气。在

同时,请在此处查看非官方用户不一致API服务器:https://discordapp.com/invite/discord-API

当我处在你的位置时,这个discord服务器对于回答任何关于discord API的问题非常有帮助,因为那里99.9%的人都知道你的问题是什么以及如何解决它。当你构建代码时,人们总是在线回答你的问题。在

如果您需要启动代码的帮助,基本步骤如下:

  1. Pip安装不一致API
  2. https://discordapp.com/developers/docs/intro上创建机器人程序用户
  3. 使用bot令牌编写代码

因为我不知道到目前为止您在bot上取得了什么进展,我只是用python编写了一些线框代码来开始。在

import discord import asyncio from discord.ext import commands description = "desc" bot = commands.Bot(command_prefix='?', description=description) #startup command @bot.event async def on_ready(): print('Logged in as') print(bot.user.name) print(bot.user.id) print(' ') #category of main commands class Main_Commands(): def __init__(self, bot): self.bot = bot #ping command test @bot.command(pass_context=True) async def ping(ctx): await bot.say("pong") #when the user types in ?ping, the bot will return "pong" #This is an example of a simple command in this language #RunBot bot.run("TOKEN GOES HERE") # (C) 2017 # All rights reserved # Any part of this program may be used and/or modified at the users discretion

和13;
和13;

不管怎样,我希望这个回答对你有帮助。如果您需要我的帮助,请随时给我发邮件,告诉我不和谐的事,我会尽量在我的日程安排允许的时候回复。在

编码快乐!!在

{a3}检查API的引用

相关问题 更多 >