【发布时间】:2021-05-27 02:43:40
【问题描述】:
我目前正在尝试创建我的不和谐机器人。可悲的是,这不起作用,我不知道为什么......
import discord
import os
import time
from ka import keep_alive
from discord.ext import commands
import asyncio
client = commands.Bot(command_prefix = '.')
prefix = '.'
@client.event
async def on_ready():
print("I'm ready! {0.user}".format(client))
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Croissants!"))
@client.command()
async def join(ctx):
channel = ctx.message.author.voice.voice_channel
await client.join_voice_channel(channel)
await ctx.send("On my way!")
client.run(os.getenv('TOKEN'))
没有错误。但也没有输出。我尝试通过编写使其加入我的 vc:.join
【问题讨论】:
-
可以分享
ka.py的内容吗? (你可能在 repl 上运行它) -
我是的。 ka.py 只是每 5 分钟向它发送一次请求,因此机器人不会离线
-
你是在单独的线程中运行它吗?
-
让我们把它交给chat.
-
不能。我需要 20 个声望,我只有 11 个
标签: python discord.py