About 50 results
Open links in new tab
  1. Python how to share an object between methods in a class?

    Jan 29, 2017 · You can use the self object to share objects between methods of a class. Your code would become: import Economy Class Example: economy = Economy.Economy() def __init__(self, …

  2. python - TypeError: setup () missing 2 required positional arguments ...

    Nov 9, 2022 · async def setup (bot, ctx, message): The setup method for cogs only takes bot as the argument, nothing else. You can't just add random arguments to functions and expect the library to …

  3. python - My discord bot can't find any commands and shows this error ...

    Oct 11, 2023 · self.economy = Economy() def check_bet( self, ctx: commands.Context, bet: int=DEFAULT_BET, ): bet = int(bet) if bet <= 0: raise commands.errors.BadArgument() current = …

  4. Is there an easy way to globalize a variable in a class

    Sep 1, 2018 · Unless you make sure that economy is a singleton (which it currently isn't), then there are multiple gold variables: one per instance of economy.

  5. How to only run discord.py command if boolean is true

    Apr 8, 2021 · if int(be_am) <= economy[ctx.author]: await ctx.send(random_tri()) @client.command() async def ans(ctx, answer): if not ongt: await ctx.send("Test") if ctx.author != user: return "" if user in …

  6. NoneType error with Python class and function - Stack Overflow

    May 8, 2015 · Despite my function returning an array, I get an TypeError: 'NoneType' object is not callable error. I first define classes, and then insert the function. I'm ...

  7. Managing Token Limits in GPT-4o for Variable-Length Input and Output

    Dec 17, 2024 · I’m using GPT-4o via the Azure OpenAI API to handle variable-length queries, but I frequently encounter token exhaustion when the combined token count of my input and output …

  8. NameError: name 'Yes' is not defined when comparing input

    Jul 2, 2014 · # This program is to calculate fueld economy def main (): fuelEconomy = input ("Do you want to calculate your fuel economy? ") print (fuelEconomy) while fuelEconomy == Yes: Economy () …

  9. Importing function from another cog with discord.py

    Jan 27, 2020 · Importing Economy itself won't work as is, since withdraw_money and deposit_money are instance methods, and initializing another version of the cog would definitely be a lot less efficient …

  10. discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.help ...

    Nov 14, 2022 · discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.help' raised an error: TypeError: object NoneType can't be used in 'await' expression