我正在制作一个机器人,而我使用的消息侦听器没有拾取其他人的消息:
@bot.event
async def on_message(message):
chnl = message.channel.name
ts = time.time()
athr = message.author.display_name
st = datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
with open("logs/chat.txt", "a") as text_file:
#print(f"<{message.created_at} | {athr}> {message}", file=text_file)
print(f"_(#{chnl}) <{st} | {athr}> {message.content}", file=text_file)
return athr, st, message.content
await bot.process_commands(message)
这似乎是个简单的问题,但我看不出有什么不对
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
GUILD = os.getenv("DISCORD_GUILD")
bot = commands.Bot(command_prefix=';')
目前没有回答
相关问题 更多 >
编程相关推荐