【发布时间】:2021-10-06 13:50:23
【问题描述】:
我没有收到任何错误代码,并且每当我将命令 !join 加入聊天时都没有任何反应。我到处搜索,似乎代码应该是正确的。 (顺便说一句,我的代码中确实有我的机器人令牌)
import os
import discord
from discord.ext import commands
my_secret = os.environ['Token']
client = discord.Client()
bot = commands.Bot(command_prefix="!")
@client.event
async def on_ready():
print ('{0.user} Activated'.format(client))
@bot.command()
async def join(ctx):
channel = ctx.author.voice.channel.id
await channel.connect()
client.run(my_secret)
【问题讨论】:
-
看来你没有运行机器人,只有客户端。
标签: python discord discord.py