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

import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio

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 rule1(ctx):
    await client.say("Do not have a name of all special charaters!")

@client.command(pass_context=True)
async def rule2(ctx):
    await client.say("Treat Everyone with Respect")

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



@client.command(pass_context=True)
async def exit(ctx):
    close()

@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!")

@client.command(pass_context=True)
async def rule3(ctx):
    await client.say("Do not spam any of the text channel if you do you may be muted")

@client.command(pass_context=True)
async def bans(ctx):
    client.get_bans("[UN] Unison-Networks")
    await client.send_message('owner,client.get_bans',*,tts-False')






pause
error
---------------------------------------------------------------------------------------------------------------------------------
Ignoring exception in command bans
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 45, in bans
await client.send_message('owner,client.get_bans,*,tts-False')
TypeError: send_message() missing 1 required positional argument: 'content'

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: TypeError: send_message() missing 1 required positional argument: 'content'
Reply
#2
Here is the API reference for send_message function:
http://discordpy.readthedocs.io/en/lates...nd_message

There must be an error/typo in the arguments you pass in line 45.
I suspect you didn't mean to have owner,client.get_bans as one string (and thus one argument), but instead as two arguments.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,562 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy
  Discord Bot not working SoulWolfX 5 59,491 Mar-19-2018, 04:56 AM
Last Post: buran

Forum Jump:

User Panel Messages

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