前提
discord bot を作っています
実現したいこと
しっかりどうさするようにしたい
発生している問題・エラーメッセージ
2.0.1 2022-09-30 14:34:31 INFO discord.client logging in using static token Traceback (most recent call last): File "c:\Users\21EO0122\Documents\discord_bot.py", line 16, in <module> client.run(TOKEN) File "C:\Users\21EO0122\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 828, in run asyncio.run(runner()) File "C:\Program Files\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 647, in run_until_complete return future.result() File "C:\Users\21EO0122\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 817, in runner await self.start(token, reconnect=reconnect) File "C:\Users\21EO0122\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 746, in start await self.connect(reconnect=reconnect) File "C:\Users\21EO0122\AppData\Roaming\Python\Python39\site-packages\discord\client.py", line 672, in connect raise PrivilegedIntentsRequired(exc.shard_id) from None discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead. Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000027EA43A21F0> Traceback (most recent call last): File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__ self.close() File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close self._loop.call_soon(self._call_connection_lost, None) File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 751, in call_soon self._check_closed() File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 515, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed
該当のソースコード
import discord
TOKEN = '+++' # TOKENを貼り付け
client = discord.Client(intents=discord.Intents.all())
CHANNEL_ID = +++ # チャンネルIDを貼り付け
print(discord.version) # 1.2.5
@client.event
async def on_ready():
while True:
MSGK = input("文字を入力:")
MSG = "送信者:" + str(NAME) + str(MSGK)
channel = client.get_channel(CHANNEL_ID)
await channel.send(str(MSG))
client.run(TOKEN)
discord.py
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
該当のソースコードとして提示いただいたコードを実行したときに、どういった動作をすることを求めているのかご記載いただくと回答を得やすいかと思います。
