开始使用pythonista中的discord.py

2024-04-29 16:00:02 发布

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

我刚刚开始尝试使用在线教程在Pythonista中创建discord bot,我安装了StaSh和discord.py,我有以下代码,但我不断收到一个错误:

import discord

client = discord.Client()

@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('$hello'):
        await message.channel.send('Hello!')

client.run("my_token")

错误是“没有名为'ctypes.macholib'的模块”,我完全不理解它。有人能帮忙吗?谢谢


Tags: 代码pyclienteventmessageasyncifon