#๐Ÿ”’ Help with Discord bot python

24 messages ยท Page 1 of 1 (latest)

obtuse edge
lethal lichenBOT
#

@obtuse edge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

obtuse edge
#

champ mute @user 300 Spamming
champ ban @user 600 Inappropriate behavior
champ kick @user 300 Disruptive behavior
champ warn @user Breaking rules
champ unmute @user
champ unban {user_id}
champ removewarn @user {index}

these the cmnds not working

obtuse edge
#

in the terminal none

azure saddle
#

Are you using async functions? Because commands liek ban or kick might require an async function to run smoothly

#

Also make sure the bot has the required permissions

#

you need async if u want durations

obtuse edge
azure saddle
#

k

#

if you kick someone, does the message send?

#

Add some print lines for debugging, add one here

#
@bot.command(name="kick")
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, duration: int, *, reason: str):
    print("Something")
    await member.kick(reason=reason)
    kicks[member.id] = {"reason": reason, "timestamp": datetime.now(), "duration": duration}
    print("Something")
    await ctx.send(f"{member.mention} has been kicked for {duration} seconds for: {reason}.")
    print("Something")
    # Note: Discord doesn't allow automatic rejoining after a kick, so this is informational.
obtuse edge
azure saddle
#

so the command isn't being called @obtuse edge

obtuse edge
azure saddle
#

try a easier command

#

try something else like you say a command and it just prints something else in retrun

#

wait, you have a seperate file where your bot is like initialized right? Like a file with the api keys and everything about the bot

#

Try this

@bot.event
async def on_ready():
    print(f"Logged in as {bot.user}")
lethal lichenBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.