discord.pyを使ってBotを作っていたらエラーを吐かれた

前提

ここに質問の内容を詳しく書いてください。
discord.pyをつかってBotをうんようしたい

実現したいこと

うまくうごくようにしたい

発生している問題・エラーメッセージ

Traceback (most recent call last): File "main.py", line 6, in <module> client = discord.Client() TypeError: __init__() missing 1 required keyword-only argument: 'intents'

該当のソースコード

Python

ソースコード

import os
from server import keep_alive
import discord
import random
token = os.getenv("token")
client = discord.Client()
CHANNEL_ID = 1016317202628100219
L1 = set(random.sample(range(-4294967296, 4294967296), 1))

@client.event
async def on_ready():
print("on_ready")
print(f'We have logged in as {client.user}')

@client.event
async def on_message(message):
if message.author == client.user:
return

elif message.content.startswith('!管理人'):
await message.channel.send('私だ')
elif message.content.startswith('$hello'):
await message.channel.send('Hello!')
elif message.content.startswith('こんにちは'):
await message.channel.send('やあ')
elif message.author == client.user:
return
elif message.content.startswith('!乱数'):
await message.channel.send(L1)
elif message.author == client.user:
return
elif message.content.startswith('!対募'):
await message.content.send('誰かが募集してるよ')
elif message.content.startswith('!締切'):
await message.content.send('締め切られたよ')
elif message.content == "!ping":

raw_ping = client.latency
ping = round(raw_ping * 1000)
await message.reply(f"Pong!\nBotのPing値は{ping}msです。")

#bot起動時に行うイベント
@client.event
async def greet():
channel = client.get_channel(CHANNEL_ID)
await channel.send('now loading ...起動しましたあああ あ')

@client.event
async def on_member_join(member):
await member.send('よろしくね')

keep_alive()
client.run(token)

試したこと

こー

コードをさいどか再度書きなおした

コメントを投稿

0 コメント