前提・実現したいこと
discord.pyでBOTを作成しています。
on_messageによるコマンドの実装はできたのですが、discord.ext.commandsによる実装ができずに躓いています。
発生している問題・エラーメッセージ
on_messageイベントは機能していますが、$testコマンドに対する応答がありません。
該当のソースコード
python
1import discord 2from discord.ext import commands 3 4client = discord.Client() 5bot = commands.Bot(command_prefix='$') 6 7@bot.command() 8async def test(ctx, arg): 9 await ctx.send(arg) 10 11@client.event 12async def on_message(message): 13 if message.author == client.user: 14 return 15 16 if message.content.startswith('hello'): 17 await message.channel.send('Hello!') 18 19client.run("token")
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/10/04 07:43