$ python3 -m pip install -U 检查您正在使用的 discord.py 版本,一切已经准备就绪,让我们开始写机器人吧。如果它报 ModuleNotFoundError 或者 ImportError 那么您的 discord.py 安装有问题。bot = commands.Bot(command_prefix='$', description='A bot that greets the user back.')命令前缀是消息内容最...
import discord from discord.ext import commands bot = commands.Bot(command_prefix='$') @bot.event async def on_ready(): print('Logged in as') print(bot.user.name) print(bot.user.id) print('---') @bot.command() async def add(ctx, a: int, b: int): await ctx.send(a+b) @bo...
(Step 3: Run the bot on the desktop:) 【1 Open a terminal or command prompt】Windows 环境下要打开 cmd 【2 Navigate to the directory where you installed the ChatGPT Discord bot】用cd命令定位到解压缩的文件夹(GPT指引了我) 【3 Run python3main.pyto start the bot】然后再让 Python 运作起来...
We then want to click on the “Add Bot” button. A pop-up will come up asking if you want to tie a bot to your application. You’ll want to smash the “Yes, do it!” button. A bot has now been created and is attached to the application. We are going to need to create a b...
I have a couple of questions about this. First of all, I am not sure exactly when I can create a server using a bot account. Following the "when a user is initially connecting" section, I attempted to place the server creation into theon_readyfunction, like so: ...
client = commands.Bot(command_prefix='!') 步骤三:创建角色 @client.command() async def create_role(ctx, name: str): guild = ctx.guild await guild.create_role(name=name) 在上面的代码中,我们定义了一个名为create_role的命令。这个命令将在 Discord 服务器中创建一个角色,角色的名称是命令参数中...
将下一行作为discord bot的输入,可以通过以下步骤实现: 安装discord.py库:discord.py是一个用于创建discord机器人的Python库。可以使用pip命令安装discord.py库:pip install discord.py 创建discord bot应用:在Discord开发者门户网站(https://discord.com/developers/applications)上创建一个新的应用程序,并将其转换为一...
I end up with a really long traceback: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs)...
你需要把变量引用放在define函数中如果它是str dostring:str如果它是int你可以使用number:int ...
So I want to make a discord python bot that takes user inputs. what I want to do is count % of something. Here is what i want to do : I made this code before starting on the discord bot. But I don't know how to take user inputs. userInputOriginalPrice = float(input("Ente...