【发布时间】:2021-10-05 10:47:49
【问题描述】:
这不是大多数人想要的,但我愿意。
代码:
#imports
import discord
import os
from keep_alive import keep_alive
from discord.ext.commands import has_permissions, MissingPermissions
from discord.ext import commands
from discord.utils import get
#client name
client = discord.Client()
#log-in msg
@client.event
async def on_ready():
print("Successfully logged in as")
print(client.user)
#prefix and remove default help cmd
client = commands.Bot(command_prefix='H')
client.remove_command("help")
@client.command(pass_context=True)
async def ere(ctx, *, args=None):
await ctx.send("hi")
if discord.utils.get(ctx.message.author.roles, name="MEE6") != None:
if args != None:
await ctx.send("mee6 just spoke!")
else:
await ctx.send("nope")
@client.event
async def on_message(message):
print(message.author)
if "Here" in message.content:
if discord.utils.get(message.author.roles, name="MEE6") != None:
channel = await client.fetch_channel(870023245892575282)
await channel.send("yes")
await client.process_commands(message)
我认为在 on_message 的底部添加“await client.process_commands(message)”可以处理其他机器人(如 MEE6)发送的命令,但没有运气。默认情况下,on_message 可以听到机器人,但命令不能。有什么办法可以解决这个问题?
任何帮助将不胜感激!
【问题讨论】:
标签: python python-3.x discord discord.py