Discord.py error in callable prefix: takes 0 positional arguments but 2 were given

Viewed 274

I'm using the discord.py library and I'm trying to make a callable prefix. However, I'm getting this error whenever a message is posted. The prefix_callable function should return two possible prefixes, but it throws an error instead.

TypeError: prefix_callable() takes 0 positional arguments but 2 were given

Maybe It's a dumb error, but I'm new to Python and can't figure this one out. Thank you!

This is the code:

import discord
from discord.ext import commands
import asyncio
import json
import bot_modules
from bot_modules import misc
import Utilities
from Utilities import manageDataStores
botconfigf = open("./Utilities/botconfig.json", "r")
botconfig = json.load(botconfigf)

def prefix_callable(bot, message):
    return "!", "@()"

client = commands.Bot(command_prefix = prefix_callable, case_insensitive = True)

@commands.command
async def info (ctx):
    await ctx.send("ayy")

@client.event
async def on_ready():
    print("ADAB is online!")

client.run("---")
1 Answers

Looks like I wasn't using the rewrite and this stopped erroring in the rewrite.

Just use the rewrite to avoid this.

Related