简体   繁体   中英

Please help me with my discord bot code in python

This is the error i get:

Traceback (most recent call last): File "/Users/mak/PycharmProjects/pythonProject11/main.py", line 16, in <module> client.run() TypeError: Client.run() missing 1 required positional argument: 'token'

CAN SOMEONE PLEASE HELP?

import discord
from discord.ui import button, view
from discord.ext import commands

TOKEN = 'My token was here'

intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)

@client.event
async def on_ready():
    print('Autenticazione riuscita. {0.user} is online!'.format(client))


client.run()
{TOKEN}

This code need to run/start the bot.

put the token in the client.run method as an argument

import discord
from discord.ui import button, view
from discord.ext import commands

TOKEN = 'My token was here'

intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)

@client.event
async def on_ready():
    print('Autenticazione riuscita. {0.user} is online!'.format(client))


client.run(TOKEN)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM