Python Forum
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
discord bot
#1
my question here

import discord
from discord.ext.commands import Bot
from discord.ext import commands
Client = discord.Client()
bot_prefix= "¬"
client = commands.Bot(command_prefix=bot_prefix)

@client.event
async def on_ready():
    print("Bot Online")
    print("name: {}".format(client.user.name))
    print("ID: {}".format(client.user.id))

@client.command(pass_context=True)
async def joke(ctx):
    await client.say("cows go moo pigs go pull over to the side of the road!")

@client.command(pass_context=True)
async def joke2(ctx):
    await client.say("why did the skeleton attack the human... cause he had a bone to pick with them!")

@client.command(pass_context=True)
async def creator(ctx):
    await client.say("@13bathz has created me!")


@client.command(pass_context=True)
async def list(ctx):
    await client.say("I am still under heavy development but the commands are ¬joke ¬joke2 ¬creator!")

@client.command(pass_context=True)
async def cr(ctx):
    await client.say("This bot has only been made the the service unison-networks if you are found using this bot actions will be implemented!")
    await get_bans(ctx.server)
but i get this error

Ignoring exception in command None
discord.ext.commands.errors.CommandNotFound: Command "banlist" is not found
Ignoring exception in command cr
Traceback (most recent call last):
File "C:\Users\zacha\AppData\Local\Programs\Python\Python35-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "C:\Users\zacha\Desktop\JOke bot\jokebot.py", line 34, in cr
await get_bans(ctx.server)
NameError: name 'get_bans' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\zacha\AppData\Local\Programs\Python\Python35-32\lib\site-packages\discord\ext\commands\bot.py", line 822, in process_commands
yield from command.invoke(ctx)
File "C:\Users\zacha\AppData\Local\Programs\Python\Python35-32\lib\site-packages\discord\ext\commands\core.py", line 367, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "C:\Users\zacha\AppData\Local\Programs\Python\Python35-32\lib\site-packages\discord\ext\commands\core.py", line 52, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'get_bans' is not defined
Reply
#2
The arror message says what is wrong. get_bans function is not defined
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,564 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020