M
M
Max2021-12-18 00:51:07
Python
Max, 2021-12-18 00:51:07

Why doesn't it start?

# IMPORTS
import discord
import json
import command
from discord.ext import commands

#PREFIX
bot = commands.Bot(command_prefix=".")

with open("info.json") as f:
data = json.load(f)
token = data["Token"]

# START
@bot.event
async def on_ready():
print('Logged on as!')
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=". help"))

# HELP
bot.remove_command("help")
@bot.command(command/help.py)

# PROFILE
bot.remove_command("profile")
@bot.command(command/profile.py)

#RUN
bot.run(token)

File "C:\Users\User\Desktop\himpe.py\hinpe.py", line 29
bot.run(token)
^
SyntaxError: invalid syntax

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-12-18
@NeZuSS

# HELP
bot.remove_command("help")
@bot.command(command/help.py)

# PROFILE
bot.remove_command("profile")
@bot.command(command/profile.py)

I have a feeling you don't quite understand what a decorator is and how to use it.
And the command/profile.py construction is not syntactically correct in python.
Learn the basics of the language. That's jokes aside.
Mark Lutz, Learning Python, 4th edition.
Then you will return to the bot, and you will no longer stumble over such trifles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question