Q&A
実現したいこと
ここに実現したいことを箇条書きで書いてください。
- ▲▲BOTを正常に起動する
前提
オンラインにはなるが中身が機能しない
発生している問題・エラーメッセージ
WARNING discord.ext.commands.bot Privileged message content intent is missing, commands may not work as expected. という注意メッセージがあり、 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 省略). (bot名)がログインしました。 の後何も表示されなくなる。(エラーメッセージもなし)
該当のソースコード
Python
1import discord 2from discord.ext import commands 3 4# Discord botの接続情報 5TOKEN = 'BOTのToken' 6 7# コマンドの接頭辞 8PREFIX = '!' 9 10intents = discord.Intents.default() 11intents.members = True 12intents.messages = True 13 14# コマンドの宣言 15bot = commands.Bot(command_prefix=PREFIX, intents=intents) 16 17# イベントハンドラーの定義 18@bot.event 19async def on_ready(): 20 print(f'{bot.user}がログインしました。') 21 22# コマンドの実装 23@bot.command() 24async def ping(ctx): 25 await ctx.send('pong') 26 27# ボットの起動 28bot.run(TOKEN)
試したこと
intent関連だと思ったのでDiscord Developer Portalの設定を確認したりソースコードに問題があるかchatGPTに質問するなどしたが機能せず
補足情報(FW/ツールのバージョンなど)
Discord.py最新バージョンを使用しています
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。