【发布时间】:2020-12-30 02:09:56
【问题描述】:
(以下代码仅用于娱乐目的。请勿在不和谐服务器中使用此代码)。老实说,我不知道为什么它不起作用。当我使用完全相同的代码打开一个新的 python 文件时,它可以工作。但是,如果我将它与所有代码一起放入我的文件中,则由于某种原因它不会。没有输出,没有错误。
from discord.ext import commands
#Settings
KICK_ON_MESSAGE = False
TOKEN = "Token goes here"
client = commands.Bot(command_prefix="/")
@client.event
async def on_ready():
print('Logged in!')
@client.event
async def on_message(message):
if KICK_ON_MESSAGE == True:
member = message.author
await member.kick()
print(str(member)+' has been succesfully kicked!')
@client.command()
async def test(ctx):
await ctx.send('hi!')
client.run(TOKEN)
Thanks in advance.
【问题讨论】:
-
请edit 展示你是如何做到这一点的:“把它和所有代码放在我的文件中”。也许您没有导入正确的模块或调用正确的函数。
标签: python arrays python-3.x list python-2.7