実現したいこと
discord.pyをつかってBotを運用したい
前提
うまく動くようにしたい
発生している問題・エラーメッセージ
Client.__init__() missing 1 required keyword-only argument: 'intents' File "C:\Users\kitahara\Desktop\Enterexit BOT.py", line 4, in <module> client = discord.Client() ^^^^^^^^^^^^^^^^ TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'
該当のソースコード
Python
1import discord 2import asyncio 3 4client = discord.Client() 5 6@client.event 7async def on_ready(): 8 print('Logged in as {0.user}'.format(client)) 9 for guild in client.guilds: 10 for voice_channel in guild.voice_channels: 11 await voice_channel.connect() 12 13@client.event 14async def on_voice_state_update(member, before, after): 15 if before.channel != after.channel: 16 if before.channel is not None: 17 await send_notification(before.channel, member.name + " left " + before.channel.name) 18 # チャンネルに誰もいなくなったら、BOTがVoiceチャンネルから退出する 19 if len(before.channel.members) == 1 and before.channel.members[0].id == client.user.id: 20 await before.channel.disconnect() 21 if after.channel is not None: 22 await send_notification(after.channel, member.name + " joined " + after.channel.name) 23 24async def send_notification(channel, message): 25 while True: 26 await channel.send(message) 27 await asyncio.sleep(60) 28 29client.run('token)
試したこと
Discord.py をインストールする
補足情報(FW/ツールのバージョンなど)
VSC
バージョン: 1.77.0 (user setup)
コミット: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
日付: 2023-03-29T10:02:16.981Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: Yes
Python 3.11.1

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。