我使用python创建了一个不一致的机器人,但问题是当我停止PyCharm进程时,机器人不再工作。我需要一些帮助。
这是代码的一部分:
import discord
client = discord.Client()
@client.event
async def on_message(message):
id = client.get_guild(id)
if message.content.find("!about") != -1:
await message.channel.send( "Hello, my name it i
Heroku日志: import discord.abc
File "/app/.heroku/python/lib/python3.8/site-packages/discord/abc.py", line 101, in <module>
SnowflakeTime = Union[Snowflake, datetime]
NameError: name 'datetime' is not defined. Requirements.txt: git+https://github.com/Rapptz/discord.py
dnspython=
这是我的discord机器人中的kick命令的代码:
@client.command(aliases=['k'])
@commands.has_permissions(kick_members = True)
async def kick(ctx, member : discord.Member, *, reason = "Reason not provided"):
serverName = ctx.message.guild.name
await member.send("You have been kicked from the &
我有一个不和谐的机器人,我用它来学习如何使用API和练习我的python知识。我正在尝试创建一个系统,随机选择一个状态,然后应用它,然后等待很短的时间,目前是10分钟,然后像这样无限地继续,直到机器人关闭。目前,我在我的on_ready((循环)功能,但机器人关闭后很短的时间(不到10分钟,约2-3),我不知道为什么。目前的代码是:
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
infiniteTime = 1
while infin