#General Help

1 messages · Page 32 of 1

midnight horizon
#

did it

wheat topaz
#

I still think it’s not related to pycord

#

According to your error log

#

discord.errors.LoginFailure: Improper token has been passed.

midnight horizon
#

i even reinstalled python and same error continues to happen

midnight horizon
slow dome
#

what does your token actually print

midnight horizon
#

i am indeed clicking copy

midnight horizon
slow dome
#

you go under bot and then there’s a token

midnight horizon
slow dome
#

that client secret is the oauth2 secret

midnight horizon
#

gonna try it tho

slow dome
#

It was definitely one of the problems

midnight horizon
#

okay, half of my problems are solved

#

now the bot turns on

#

but 2 of my commands won't work

#

like ping

frigid lark
midnight horizon
frigid lark
#

you need intents and guild id

midnight horizon
#
async def ping(ctx):
    await ctx.respond(f'Rapaz, aqui tá dificil, tô a {round(bot.latency * 1000)}ms')```
frigid lark
#

you can add to the discord.Bot debug_guilds=[ID] so you dont have to copy and paste it in all commands

midnight horizon
frigid lark
#

a slash command without the ID would need 1h to be global

slow dome
midnight horizon
#

only meme command won't work, all other commands are already global and working

slow dome
midnight horizon
frigid lark
#

they changed it right?

slow dome
frigid lark
#

oh nice

slow dome
#

like 2-3 months ago

slow dome
midnight horizon
#

to get reddit memes

#

from r/memesbrasil

slow dome
#

you didn’t answer the first question

midnight horizon
#

yes, i was using an api

#

and i found out

#

that the subreddit it got memes from

#

got private

#

so he can't get memes from there

slow dome
#

so it timed out

midnight horizon
#

then it always timed out

slow dome
#

and it took longer than 3 seconds for you to respond

midnight horizon
#

now it still times out, but sends a meme right after

slow dome
#

put await ctx.defer()

midnight horizon
slow dome
#

and the very beginning of the callback

midnight horizon
#

ok

#

it is still thinking, he hasn't stopped

maiden slate
#

:0

#

wat does this mean

#

the second part

#

not the permission stuff

slow dome
# maiden slate

Taking this server as an example, if the bot has the role of Official Bot. It can only add roles to people below itself and a role below itself. It can add Guide Contributor to a Server Booster, but cannot add Staff the a Notable Contributor

#

pip list and send output

slow dome
#

yes

#

how many do you have

#

turn it into a text file and send it

maiden slate
slow dome
#

uninstall discord-ui

slow dome
#

pycharm?

#

now uninstall py-cord and reinstall py-cord

#

restart your code editor

#

ok

#

why do you need discord.ext.commands anyways

#

this is why I use github to pin point which commit has an issue

#

even for stupid small projects

#

if you have a repository, you can keep rolling back until it works

maiden slate
#

btw

#

how do role positions work

#

is the last one 0

#

or is the first one 0

steep verge
#

The last role is 0

maiden slate
#

kk

#

thanks

steep verge
#

Sorry had to fact check myself

maiden slate
#

u gud lol

#

last meaning bottom right*

#

just 100% checkin

steep verge
#

Yes

#

So the first (top) role should be biggest number iirc

maiden slate
#

u said the bottom role is 0

sudden path
#

Bottom one is 0.

maiden slate
#

kk

maiden slate
#

if u create a channel with spaces in the name, will it auto replace w underscores?

deep grail
#

Oh wait never mind

#

I was printing the value before the client connected to Discord

inland acorn
#

how to use command permission: make slash available only to admins
i dont know about command perm v2

inland acorn
#

where should i use discord.default_permission in SlashCommandGroup?

#

its not working

#

i can use that slash from alt

icy sluice
inland acorn
vast patrol
#

it says that it's installing pycord 2.0.0 but it doesn't have all the extensions

#

it's better to go to pycharm extension manager and add the git url

#

been struggling to get the discord.ui working for hours

deep grail
#

Can't u just use command line?

quartz snow
#

why doesn't it work? await ctx.channel.purge(limit=count)

frigid lark
quartz snow
quartz snow
#

need to?

frigid lark
slender lintel
#

how do you put views in cogs

sand sonnet
#

how do you check if the message has an attachment and if so, get the url of that attachment? (inside the on_message event)

supple ravineBOT
#

Here's the slash cog groups example.

inland acorn
fringe hatch
#

how to check for events in a cog using py-cord?

deep grail
fringe hatch
#

aight! ty

deep grail
#

Np

deep grail
#

How do I supply the name of the emoji, such as dollar for 💵 to a discord.SelectOption. I've tried this:

discord.SelectOption(
  label="Some Label",
  emoji="dollar"
)

And I get the following error:

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In components.1.components.0.options.0.emoji.name: Invalid emoji

Ive tried other variations such as :dollar: and discord.PartialEmoji(name="dollar") but they don't work either and throw the same error. Any help is appreciated 🙂

sudden path
#

\💵

deep grail
sudden path
#

\:emote:

deep grail
sudden path
#

Just run that here and you will get the emoji

slender lintel
#

how do i fix cogs not loading

#

:(

#

like if there is even a tiny mistake

#

the cog doenst load

#

and i have no idea what is wrong

warped token
#

how do you get the ids of all the members in the server?

sudden path
#

b!rtfm pyc Guild.members

graceful robin
#

Error handler doesnt work

Ignoring exception in command fish:
Traceback (most recent call last):
  File "C:\Users\maksi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 992, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\maksi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 355, in invoke
    await self.prepare(ctx)
  File "C:\Users\maksi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 286, in prepare
    self._prepare_cooldowns(ctx)
  File "C:\Users\maksi\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 271, in _prepare_cooldowns
    raise CommandOnCooldown(bucket, retry_after, self._buckets.type)  # type: ignore
discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 26.37s
#
@client.event
async def on_command_error(ctx, error):
    title = ":x: An error occurred!"

    if isinstance(error, commands.MissingRequiredArgument):
        message = "Missing required arguments"
    elif isinstance(error, commands.MissingPermissions):
        message = "Missing permissions"
    elif isinstance(error, commands.CommandOnCooldown):
        title = get_response(type="cooldown")
        message = "This command is on cooldown. Try again in {:.2f} seconds".format(error.retry_after)
    elif isinstance(error, commands.CommandNotFound):
        message = "Unknown command"
    else:
        message = "An unknown error occurred"
    embed = discord.Embed(title=title, description=message, color=0xdd2e44)
    await ctx.send(embed=embed)
#

I used this in a slash command tho

slender lintel
#

How do I get client.
I have some bot code in a different file (backend.py) and want to somehow get client/bot without importing it from bot.py
is there any way to?

#

ctx.client does not work

slender lintel
#

discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'ApplicationContext' object has no attribute 'client'

half marsh
slender lintel
#

ctx.client doesn't work though

half marsh
#

check the docs

slender lintel
#

so uh is there any other way to get client?

slender lintel
half marsh
slender lintel
#

kk

graceful robin
half marsh
graceful robin
#

huh

#

is everything else the same

#

?

half marsh
graceful robin
#

alright it works

#

thanks

half marsh
#

instead of repeating code

graceful robin
#

alright

deep grail
#

Just record it using a dict or smthn

#

Every time someone bans someone, just update the dict

#

Well then record it in the db

#

Tho it's probably easier to use a dict stored in memory since it's prob not important that It carries over every time the bot is restarted

frozen wave
#

does anyone know how to get what users reacted to a message and what reaction they used after x seconds?

#

    if message.content.startswith('$start'):
        payload = await message.channel.send("image to react to") 
        await payload.add_reaction("1️⃣") 
        await payload.add_reaction("2️⃣") 

        time.sleep(5)

        await message.channel.send('times up!')

        users = set()
        for reaction in payload.reactions:
            async for user in reaction.users():
                users.add(user)
                print(users)

my current code (for some reason payload.reactions always is empty no matter how many accounts react)

steep verge
frozen wave
steep verge
#

you would have to re-fetch the message with fetch_message to get the updated reactions.

frozen wave
#

ohh i see

misty glacier
#
class welcomeSetupCommand(commands.Cog):
    @slash_command(name="welcomesetup", description="Start welcome setup", guild_ids=[923972845124583455])
    async def welcomesetup(self, ctx):
        await ctx.interaction.response.send_modal(welcomeSetupCommand())

class welcomeSetupModal(Modal):
    def __init__(self) -> None:
        super().__init__(title="Welcome Setup")
        self.add_item(
            InputText(
                label="Welcome Channel ID",
                placeholder="Example: 996570704487124993",
                max_length=18
            )
        )
   ---> configUtils.getConfig(f'{guild.id}/welcome_settings.json', 'welcome_channel_id') <---

How do I get the guild id in Modal?

slow dome
steep verge
#

async def callback comes with the interaction parameter in which you can access interaction.guild.

#

squid can probably explain it better than me

slow dome
#
class welcomeSetupCommand(commands.Cog):
    @slash_command(name="welcomesetup", description="Start welcome setup", guild_ids=[923972845124583455])
    async def welcomesetup(self, ctx):
        await ctx.interaction.response.send_modal(welcomeSetupCommand())
        modal = Modal(title="Welcome Setup")
        modal.add_item(
            InputText(
                label="Welcome Channel ID",
                placeholder="Example: 996570704487124993",
                max_length=18
            )
        )
        configUtils.getConfig(f'{ctx.guild.id}/welcome_settings.json', 'welcome_channel_id')
#

is probably easier

#

than subclassing

#

and you can add a callback with modal.callback = coro

misty glacier
#

Thx :D

slow dome
#

is there like a limit on the amoung of commands you can have?
@strange ferry
You can have 100 commands, and each command can have up to 25 sub-command groups. Each sub-command group can have up to 25 sub-commands.

100 x 25 x 25 = 62.5k

Of course, "slash commands can have a maximum of 4000 characters for combined name, description, and value properties for each command and its subcommands and groups", so you're not likely to hit that 62.5k command limit

coral stratus
midnight horizon
#

bruh

coral stratus
midnight horizon
#

my code stopped working, ctrl+z won't work to fix it

#
  File "c:\Users\vinic\Documents\Yiffiy Pycord\bot.py", line 2, in <module>
    from discord.ext.commands import has_permissions, MissingPermissions
  File "C:\Users\vinic\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\__init__.py", line 
25, in <module>
    from .client import Client
  File "C:\Users\vinic\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 53, in <module>
    from .webhook import Webhook
  File "C:\Users\vinic\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\webhook\__init__.py", line 12, in <module>
    from .async_ import *
  File "C:\Users\vinic\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\webhook\async_.py", line 52, in <module>
    from ..channel import PartialMessageable
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (C:\Users\vinic\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\channel.py)```
slender lintel
#

is there a bridge command group?

slow dome
slender lintel
#

hmmm 😦

warm roost
#

Is anyone else having Cog listener issues?

slender lintel
#

no

warm roost
#

Well shit

#

lol

slender lintel
#

is there a persistant view example in a cog?

warm roost
#

No

slender lintel
#

Well shit

#

lol

warm roost
#

Mood

slender lintel
#

😄

slender lintel
#

is it? i don´t know

#

i am trying it for 5 hours but it won´t work

supple ravineBOT
#

Here's the persistent example.

warm roost
#

OH

#

I misunderstood

#

WELL SHIT

slender lintel
slender lintel
#

are there also any errors?

#


class PersistentView(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)

    @discord.ui.button(label="Green", style=discord.ButtonStyle.green, custom_id="persistent_view:green")
    async def green(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.response.send_message("This is green.", ephemeral=True)

    @discord.ui.button(label="Red", style=discord.ButtonStyle.red, custom_id="persistent_view:red")
    async def red(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.response.send_message("This is red.", ephemeral=True)

    @discord.ui.button(label="Grey", style=discord.ButtonStyle.grey, custom_id="persistent_view:grey")
    async def grey(self, button: discord.ui.Button, interaction: discord.Interaction):
        await interaction.response.send_message("This is grey.", ephemeral=True)


class PersistentViewBot(commands.Cog):
    def __init__(self):
        self.persistent_views_added = False

    async def on_ready(self):
        if not self.persistent_views_added:
            # Register the persistent view for listening here.
            # Note that this does not send the view to any message.
            # In order to do this you need to first send a message with the View, which is shown below.
            # If you have the message_id you can also pass it as a keyword argument,
            # but for this example we don't have one.
            self.add_view(PersistentView())
            self.persistent_views_added = True

        print(f"Logged in as {self.user} (ID: {self.user.id})")
        print("------")

    @commands.command()
    @commands.is_owner()
    async def prepare(ctx: commands.Context):
        await ctx.send("What's your favourite colour?", view=PersistentView())


def setup(bot):
    bot.add_cog(TicTacToeCog(bot))
    bot.add_cog(StreamControlCog(bot))
    bot.add_cog(PersistentView())
#

uhh

#

why are you adding a view as a cog?

#

because i want it in a cog ?

slender lintel
#

as you see bot.add_cog contains "add_cog"

#

so first you should remove that

#

i thought i have to register every class with add_cog in a cog 😄

#

another problem i see is your on_ready method

#
def setup(bot):
    bot.add_cog(TicTacToeCog(bot))
    bot.add_cog(StreamControlCog(bot))
    bot.add_cog(HelpCommandCog(bot))
    bot.add_cog(PersistnatViewBot(bot))
    bot.add_view(PersistentView())

slender lintel
#

like that?

#

your on_ready method should be an event

#

so add the decorator @commands.Cog.listener() above it

slender lintel
#

i did it

#

unexcepted argument bot in PersisentViewBot

#

since it is a cog. you should also have self.bot defined in your __init__ method

#

so

#
    def __init__(self, bot):
        self.bot = bot
        self.persistent_views_added = False
#

okay

#

AttributeError: 'PersistentViewBot' object has no attribute 'add_view'

#

then you can just add the view with self.bot.add_view()

#

in the init?

#

nope in the on_ready event

#

do you see where you have self.add_view?

#

replace that with self.bot.add_view

#

there is

            self.add_view(PersistentView())
#

i replaced it with self.bot.add_view(PersistentView())

#

yes just add .bot. in between self and add_view

#

yes

#

ok no error

#

if i use the command i got this error

#
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 748, in _parse_arguments
    next(iterator)
StopIteration

During handling of the above exception, another exception occurred:
#

raise discord.ClientException(f'Callback for {self.name} command is missing "ctx" parameter.')
discord.errors.ClientException: Callback for prepare command is missing "ctx" parameter.

#

oh ye

midnight cedar
#

your prepare command doesn't have a ctx parameter

#

you could also be missing self

slender lintel
#

ok i go eat pizza ig

#

😄

#

thnx plun

#

okay it works fine 🙂

#

THANK YOU ALL !

#

🙂

misty glacier
# slow dome ```py class welcomeSetupCommand(commands.Cog): @slash_command(name="welcomes...
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 127, in wrapped
    ret = await coro(arg)
  File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 877, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "/home/bots/discord/Aromic4All/python/commands/moderation/welcomeSetupCommand.py", line 26, in welcomesetup
    await ctx.interaction.response.send_modal(welcomeSetupCommand())
  File "/usr/local/lib/python3.9/dist-packages/discord/interactions.py", line 922, in send_modal
    payload = modal.to_dict()
AttributeError: 'welcomeSetupCommand' object has no attribute 'to_dict'

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/bot.py", line 992, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 358, in invoke
    await injected(ctx)
  File "/usr/local/lib/python3.9/dist-packages/discord/commands/core.py", line 135, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: AttributeError: 'welcomeSetupCommand' object has no attribute 'to_dict'```
graceful robin
#
async def gain_command(loot, item, author_id):
        if await get_item(item_id=item, by="uuid", inventory="player_inventories", id=author_id) is not False:
            chance = randint(1, 100)

            for key, value in fish.items():
                if value[0] < chance and chance < value[1]:
                    await add_item(item=key, id=author_id)
                    item = await get_item(item_id=key, by="uuid")
                    return f'You caught **{item["icon"]} {item["name"]}**!'
        else: return False


    @commands.slash_command(name="fish", description="Go fishing")
    @commands.cooldown(1, 120, commands.cooldowns.BucketType.user)
    async def fish(self, ctx):
        await gain_command("7fea4d63-c02a-4057-832a-ba460b8dedc2")

"gain_command is not defined"

midnight horizon
#

but as i said, it keeps coming back

sudden path
midnight horizon
# sudden path Run `pip freeze` and screenshot
aiofiles==0.6.0
aiohttp==3.7.4.post0
aiosqlite==0.17.0
async-generator==1.10
async-timeout==3.0.1
asyncio==3.4.3
asyncio-extras==1.3.2
asyncpraw==7.5.0
asyncprawcore==2.3.0
attrs==21.4.0
beautifulsoup4==4.11.1
brotlipy==0.7.0
bs4==0.0.1
cchardet==2.1.7
certifi==2022.6.15
cffi==1.15.1
chardet==3.0.4
charset-normalizer==2.1.0
colorama==0.4.5
dblpy==0.4.0
idna==2.10
multidict==6.0.2
orjson==3.7.7
praw==7.6.0
prawcore==2.3.0
py-cord==2.0.0
pycares==4.2.1
pycparser==2.21
PyNaCl==1.5.0
python-dotenv==0.20.0
ratelimiter==1.2.0.post0
requests==2.23.0
saucenao-api==2.4.0
soupsieve==2.3.2.post1
typing_extensions==4.3.0
update-checker==0.18.0
urllib3==1.25.11
websocket-client==1.3.3
yarl==1.7.2
youtube-dl==2021.12.17```
#

wait a second, i will uninstall and reinstall pycord

#

bruh, its working

#

i had to reinstall py-cord

slow dome
#
dblpy==0.4.0
slow dome
midnight horizon
slow dome
#

upgrade to the github release for that library

midnight horizon
slow dome
#

which removed that dependency

midnight horizon
#

makes sense

#

ima remove it, just a second

#

done

graceful robin
slender lintel
#

hello everyone, is there an load_extension limitation on how much extensions i can load?

slender lintel
#

its OOP basics

graceful robin
#

what

slender lintel
#

ig you should learn oop

graceful robin
#

ah nvm

graceful robin
slender lintel
slender lintel
slow dome
slender lintel
graceful robin
slender lintel
slow dome
slender lintel
graceful robin
#

bro i know what that is

#

i learned python i did some projects

slender lintel
slender lintel
graceful robin
#

bc i forgot that it was being executed from the main file

slender lintel
# slow dome as long as your computer can handle the cog, you can do it

main.py

[...]

bot.load_extension("cogs.admin_main")
bot.load_extension("cogs.guild_whitelist_events")
bot.load_extension("cogs.logs")
bot.load_extension("cogs.escrows")
bot.load_extension("cogs.xp_system")
bot.load_extension("cogs.config")
bot.load_extension("cogs.user")
bot.load_extension("cogs.token")
bot.load_extension("cogs.marketplace")


bot.run(plugins.get_token())

cogs/marketplace.py

from turtle import position
import discord
from discord.ext import commands
from discord import OptionChoice, option
from discord.commands import SlashCommandGroup, Option
import plugins
import aiohttp
import asyncio
from typing import Union
import random



class Marketplace(discord.Cog):
    def __init__(self, bot):
        self.bot = bot

    mp = SlashCommandGroup(
        'mp',
        'Marketplace commands'
        guild_ids=[993502625574162552]
    )

    @commands.Cog.listener()
    async def on_ready(self):
        print("ye")

[...]

any ideas?

slender lintel
#

nah

#

no

#

and no output from on_ready in cog

#

but when i do the same on_ready in another cog it prints it

slow dome
#

does changing the order affect it?

slender lintel
#

let me try

#

nope

slow dome
#

so it's specifically the marketplace cog

slender lintel
#

yes

slow dome
#

there is a setup function at the bottom of the cog, correct?

slender lintel
#

yup

#

def setup(bot):
    bot.add_cog(Marketplace(bot))
midnight horizon
#

is there a way to add aliases to slash commands?

slender lintel
#

nope

slender lintel
midnight horizon
#

dang it

slow dome
slender lintel
#

yes

slow dome
#

py-cord version?

misty glacier
#

How can i do a dropdown menu with all Channels?

slender lintel
slow dome
slender lintel
#

@slow domebro i am dumb af

slow dome
slender lintel
slow dome
#

...

slender lintel
#

why it didnt throw me an syntax error

slow dome
#

¯_(ツ)_/¯

misty glacier
#

What can I do?

slow dome
misty glacier
#

Thx

misty glacier
slow dome
#

it's a hex

misty glacier
#

I have it

#

Thx for help

midnight horizon
#

how do i create a slash command using cogs?

supple ravineBOT
#

Here's the slash cog example.

limpid schooner
#

so i've got this:

await v.timeout_for(duration=datetime.timedelta(minutes=29*24*60), reason=".")

and yes the member object is working etc

but i keep getting this error

In communication_disabled_until: Invalid communication disabled timestamp```
slow dome
#

so if you want 0+5

#

not just +5

#
await v.timeout_for(duration=datetime.datetime.now()+datetime.timedelta(minutes=29*24*60), reason=".")```
limpid schooner
#

ight

slow dome
#

yes

limpid schooner
#

TypeError: unsupported operand type(s) for +: 'datetime.datetime' and 'datetime.datetime'

ancient gazelle
#

I want to assign a role to everyone on the server.

#

I used server.members to get all members but it returns only 2, the bot and me. How can I get past this?

supple ravineBOT
#

Here's the edits example.

midnight horizon
#

needed it

#

i don't think this is really working anymore

#

at least not for me

wheat topaz
midnight horizon
#

oh

#

k, thx

past garnet
#

With the on_member_remove Listener, is it possible to get why they left? like kicked, banned or etc

past garnet
slow dome
past garnet
slow dome
#

like it should be more recent first

past garnet
#

Ok

past garnet
weak radish
warped token
#

So I want to send a message a specific amount of times, how would I do this? This was my attempt but it failed:

@bot.slash_command(name="desko-grenade",description="pings desko for a specified amount of times")
async def grenade(ctx, amount):
    await ctx.respond("started the grenade",ephemeral =True)
    for i in range(amount):
        await ctx.channel.send("@plush grail")
weak radish
#

try to convert amount from str to int? amount is string

warped token
#

is it done like this then?

@bot.slash_command(name="desko-grenade",description="pings desko for a specified amount of times")
async def grenade(ctx, amount):
    int(amount)
    await ctx.respond("started the grenade",ephemeral =True)
    for i in range(amount):
        await ctx.channel.send("@plush grail")
slender lintel
#

Yes that’s another way you can do it

weak radish
#

nope, you have to assign that to amount again

slender lintel
#

Oh yeah

#

Just do int(amount) inside the for loop

steep verge
warped token
steep verge
#

what other types?

#

the user would only be able to use an integer for that argument

thin goblet
#

does anyone know how to blacklist a user from using slash commands with an sqlite databse. I got the database down but I cna't use an on_message sinceslash commands don't work like that

#

I tried creating

#

acustom decorator

#

but it doesn't seem to work

#

the decorator doesn't even get executed

steep verge
thin goblet
#

hold on

warped token
steep verge
thin goblet
#
def calltracker(func):
  @functools.wraps(func)
  def wrapper(*args):
      if args.author.id in blacklist:
        return func(*args) # this obviously doesn't work but even if I did it like this and it did work I would have an await problem 
  return wrapper
#

won't work

#

but it doesn't even get executed

#

and I get an error with a coroutine

#

a typeError

#

command function must be a coroutine function

steep verge
#

Tbh i'm not very good with doing custom decorators, since I don't use them nor want to use them. So sorry but I can't help you, i'm sure someone else can tho

thin goblet
#

from slash commands

steep verge
thin goblet
#

so thought I could ask even tho its the pycord official server

steep verge
#

so we can't help you, sorry.

thin goblet
#

o alr ty

slender lintel
#

hey can anyone help in #997120888761749636

misty glacier
#

When I print this, [] comes out, why?
When I do guild.name or guild the name of the guild comes up and with guild.id the id but why does guild.channels and guild.text_channels not work?

weak radish
#

intents?

misty glacier
# weak radish intents?

intents = discord.Intents.all()
client = commands.Bot(command_prefix="!", intents=intents)

steep verge
weak radish
#

is this effect?

misty glacier
misty glacier
steep verge
misty glacier
#

Ok

steep verge
#

b!rtfm pyc bot.get_guild

open bearBOT
slow dome
#

why doesn't client have get guild

misty glacier
slow dome
#

are you in the guild

misty glacier
slow dome
#

i mean the bot

misty glacier
#

yes ik

slow dome
#

does it have permissions to view channels

misty glacier
#

The bot has admin

slow dome
#

discord.http.API_VERSION = 9

#

put that at the top of your code

#

before you define your bot

misty glacier
#

About the imports?

misty glacier
slow dome
#

not that high up

misty glacier
slow dome
#

yes

misty glacier
#

ok

#

i try

slow dome
#

then idk

misty glacier
#

Mhh :/

slow dome
misty glacier
#

Why is this?

slow dome
#

because it sets it to true

misty glacier
slow dome
#

b!rtfm pyc intents

slow dome
#

sorry

misty glacier
#

AttributeError: 'NoneType' object has no attribute 'text_channels'

slow dome
#

change it to fetch_guild

misty glacier
#

Result: []

slow dome
#

well this is fun

slender lintel
# misty glacier Result: `[]`

Use get_guild. fetch_guild doesn’t return channels I’m pretty sure. Found something related to this on stackoverflow

misty glacier
slender lintel
#

Why is it a nonetype 🤔

misty glacier
#

idk

steep verge
#

Are you sure the guild id is correct

misty glacier
slender lintel
#

Is the id a string?

wheat topaz
#

Just to be sure, can you show the whole command plz

misty glacier
slender lintel
#

Np

vivid nacelle
#

No. Don’t do that cat_bonk

slender lintel
#

when using cogs howcome i can not use the module easy_pil

#

if i put import easy_pil it will not loadthe cog

steep verge
slender lintel
#

pip install py-cord

steep verge
#

Did the cog load or no?

slender lintel
#

basically it loads the cog

steep verge
#

Ok it didn’t

#

Oh

slender lintel
#

but then the cog doesnt like

#

work

steep verge
#

Ok so then it probably didn’t load

slender lintel
#

yea

#

and its becasue of one line

#

which is

steep verge
#

Read from this message link below regarding cogs not loading on 2.0

#discussion message

slender lintel
steep verge
#

is it an error because of that line?

slender lintel
#

the cog just decides not to load

#

because of that line

slender lintel
vivid nacelle
#

Yes we see that 👀

slender lintel
#

lmfao

vivid nacelle
slender lintel
#

ive been trying to fix this issue all morning

stable torrent
slender lintel
#

i cant move on if i dont fix this

#

basically the cog loads fine without
import easy_pil
but when i put import easy_pil it just stops working

stable torrent
#

so cog doesn't load because of import xd

slender lintel
#

its quite stupid

stable torrent
#

try moving import around

slender lintel
stable torrent
#
import discord
# smth here
import easy_pil
slender lintel
#

ive tried that

#

many times

stable torrent
#

rip

#

huh

slender lintel
#

the import works fine when its in the main file

#

but cogs decide not to work

slow dome
#

fun

slender lintel
#

fun

stable torrent
#

this sounds like something really strange

pliant grail
#

it works when no import?

stable torrent
#

yes

slender lintel
pliant grail
#

such a unexplainable behavior

#

I mean strange

stable torrent
#

could you try using import thing as thing2

slender lintel
#

python being python kekonmeth

stable torrent
#

just in case lol

slender lintel
#

import easy_pil as your_mother no workey

#

still ignores the cog

stable torrent
#

sadge

pliant grail
#

😭

stable torrent
#

do you have any files named easy_pil

slender lintel
#

nah

stable torrent
#

do you have any variables named like that

slender lintel
#

i have a file called main.py a folder called cogs a folder called storage and a file called templates (for html)

slender lintel
stable torrent
#

sadge

pliant grail
#

you've installed easy_pil

slender lintel
stable torrent
#

do you have any

#

on_error

slender lintel
#

nop

stable torrent
#

😔

slender lintel
#

the cog loads

#

but the init doesnt print

#

that it worked

#

:(

pliant grail
stable torrent
#

could you show cog loader code

#

and cog's code

slender lintel
#

ye

#
for event in os.listdir("./cogs/events"):
    if event.endswith(".py"):
        client.load_extension(f"cogs.events.{event[:-3]}")
        print(f"load {event}")```
stable torrent
slender lintel
#

import discord
from discord.ext import commands
import json
from modules.views import WelView
import easy_pil



class OnJoin(commands.Cog):
    def __init__(self, client: commands.AutoShardedBot):
        self.client = client
        print("funny")
      
    @commands.Cog.listener()
    async def on_member_join(self, member):
          
      #funny funny code



        
        
def setup(client: commands.AutoShardedBot):
    client.add_cog(OnJoin(client))```
#

it prints load on join

#

but not print funny

stable torrent
#

try using discord.Cog instead of commands.Cog

pliant grail
stable torrent
#

jic™️

slender lintel
#

i just realised what i did wrong 💀 im gonna sound like a dumbass when i say what i forgot

stable torrent
slender lintel
#

i forgot to install easy_pil

pliant grail
#

problem solved?

stable torrent
slender lintel
stable torrent
#

🤯

slender lintel
#

usually it gives me an error

#

if i dont install something

stable torrent
#

it should

slender lintel
#

and since it didnt say anything i assume i did

#

5 hours of forgetting to install something

pliant grail
#

and how did you realize

slender lintel
#

and realised

#

it wasnt there

#

🙀

slow dome
slender lintel
#

average me being me

pliant grail
#

😱

stable torrent
#

you wasted time of 4 people~

slender lintel
slender lintel
#

am i getting arrested by the python police

stable torrent
#

yes

wheat topaz
#

Tbf that’s really odd; how it could load on your main py file but not on your cog

vivid nacelle
slow dome
vivid nacelle
#

Yes

past gate
slow dome
#

tags save a lot of time

plush tangle
#

How do I decorate slash commands inside a cog?

slow dome
plush tangle
slow dome
#

and make sure the slash command is sparkly clean

plush tangle
#

pls

slow dome
#

you asked how to decorate them.

midnight cedar
#

its discord.slash_command

fringe hatch
#

how to make the bot server deafen itself?

inland acorn
#

slash permission works in slash subcommands?

slow dome
inland acorn
slow dome
#

do an inside check

#

like @commands.check

#

checks

inland acorn
#

ctx.message.author.guild_permissions.administrator this works?

inland acorn
slow dome
inland acorn
#

btw slash subcommands are not getting registered 💀

#

even when a single guild id passed

slender lintel
#

I wanted to get a user object by using await bot.fetch_user but it takes a really long time and slows down other commands. Does anyone know an alternative?

keen root
slender lintel
#

I've tried that but it always returns None

keen root
slender lintel
smoky path
#

Hello, i am trying to get a list with with every guild name and ID that the bot is in. but for some reasons the guild name is always "None" (except one for some reason)
my code:

print(bot.guilds)

What i get:

[<Guild id=461592141521485824 name=None shard_id=None chunked=False member_count=None>,
<Guild id=837590922610737162 name='Rainbow Six [DE] | BOT Test' shard_id=None chunked=True member_count=19> ------------------
]```

any solutions to fix this issue?
fervent pine
#

Hey is there a way to create slash command groups in cogs? I've been trying for the past 2 and a half hours, and still couldn't find a solution.

inland acorn
#

tried everything

fervent pine
#

That sucks man

inland acorn
#

from last 2 days, it worked earlier

smoky path
#

What are you guys trying todo with your slash commands

inland acorn
#

^^

fervent pine
#

Like a year ago there was someone who asked this exact question on the github, and they said it wasn't implemented yet, I guess it changed now but I don't know how to use it.

inland acorn
smoky path
inland acorn
#

@fervent pine using 2.0.0?

inland acorn
#

working in my main bot, cant use now on test bot

smoky path
inland acorn
#

lemme downgrade to rc1

smoky path
#

Downgrade? 💀

#

pip install py-cord==2.0.0b7

#

Try this first

fervent pine
#

Already have 2.0.0 installed

inland acorn
#

okw orked

smoky path
#
    @commands.slash_command(description="Something")
    async def your_cmd_name(
        self,
        ctx,
        user: discord.Option(discord.User, "User", required=True)):```
inland acorn
#

worked

#

2.0.0 got bugs

smoky path
#

gg

inland acorn
#

i remember i upgarded to 2.0 yesterday

fervent pine
#

Then fuck 2.0.0

inland acorn
#

lmao whom should ping now

#

@red tendon

#

2.0.0 is bugged in slash sub groups

fervent pine
#

Also I forgot to put the self in the first place 💀

smoky path
#

are you guys beginners with coding?

inland acorn
#

bruh

fervent pine
inland acorn
#

i was struggling since i upgarded to 2.0

fervent pine
#

SAME

smoky path
inland acorn
#

and see

#

ok now upgrade to 2.0 again

smoky path
fervent pine
#

I got no idea man

smoky path
#

;/

fervent pine
#

I saw this, and I was like wtf

#

Why only this specific one

#

Maybe try get_guild

#

with the ids

smoky path
#

Idk this is even the guild i most want to

#

Maybe cuz the bot is struggling cuz of the member size?

smoky path
fervent pine
#

Then idk man might as well be the lib

smoky path
fervent pine
#

Yeah

#

Same results

#

?

smoky path
smoky path
fervent pine
#

Bruh

#

Might be discord itself then

smoky path
#

maybe cuz of member size (my guess) the server has almost 42K members with 200 channels

fervent pine
#

Oh probably

#

Others are smaller?

smoky path
#

Yes lol way smaller

fervent pine
#

But that's still weird

#

Why wouldn't it show the names

#

It did until now

#

No matter the size

smoky path
#

idk with a cmd and ctx.guild it is working fine and real fast so bruh

fervent pine
#

Meh

#

Idk anymore

#

Maybe try sending a message to each server and getting the context from it then deleting it and getting the names from the context.guild.name?

#

But that's long and stupid

smoky path
#

lmao ye xd

fervent pine
#

It would work though

smoky path
#

But would just result in a mess for every bot restart lol

fervent pine
#

YES

#

And you getting banned or flagged for spamming

#

Okay the version you told us to install works

#

Is that a beta or something?

#

beta 7 of 2.0 ?

#

Seems weird that the beta works better then the production

slender lintel
#

Why b7 and not rc1?

fervent pine
#

Idk man it works so

#

Idc

#

XDDD

smoky path
slender lintel
#

Sounds like a good coder. If it works don’t touch

fervent pine
#

Plus it's modulable so it's okay

smoky path
fervent pine
#

In case something needs a change you can always go tinker yourself with the libraries

inland acorn
#

for me

fervent pine
#

Meh it works on b7 for me so I won't change purposelessly.

inland acorn
#

👍

fervent pine
#

Thanks for the help @smoky path

smoky path
#

Np good luck

fervent pine
#

You guys find what works for y'all, if it does then DO NOT TOUCH.

#

XD

fervent pine
smoky path
#

Thanks :D

inland acorn
#

slash subcommands again disappeared when i upgraded back to 2.0.0

#

:kekw:

#

bug prolly

fervent pine
#

It is

#

Stay rc1 or b7

#

Until it's fixed

vivid nacelle
#

Chill dude. Got damn it

vivid nacelle
misty glacier
#

How can i delete message after click on Button?

sudden path
#

Depends on what you're trying to delete

misty glacier
sudden path
#

b!rtfm interaction.response.delete

open bearBOT
# sudden path b!rtfm interaction.response.delete

I couldn't find a documentation with the name interaction.response.delete! Maybe you used to command wrong? Correct Usage: <prefix>rtfm <docs> [<term>] (eg. b!rtfm py cool)
List of Documentations you can search:
python
pycord
discord.py
yarsaw
nextcord
disnake

sudden path
#

b!rtfm pyc interaction.response.delete

open bearBOT
half marsh
half marsh
#

but im not sure

sudden path
#

Yes indeed

tardy ridge
#

can't import discord after installing py-cord

#

i had an older pycord version but i wanted to upgrade to 2.0

#

tried to install from pypi

#

oop nvm

inland acorn
# vivid nacelle Chill dude. Got damn it

i was trying for sub commands permissions unknowingly that they are still not implemented in sub groups. before that i was struggling for 2 days for slash to appear actually... 😦

i had pushed a new feature to my bot and forgot to add perm restrictions in it, hopefully no one miused it, so yea it works downgrading from 2.0.0 to .0rc1 worked

arctic anvil
#

how do i check if an error is a keyerror

basically i have this:

@bot.event
async def on_command_error(ctx, error):
    global error_count
    if error is KeyError:
        await ctx.reply("A key error occurred. Make sure that your arguments are valid.")```
now no matter what i try it just does not send that string. how do i detect that it's a keyerror?
#

o wait nvm i can just put a try except block in my command

half marsh
#

b!rtfm pyc discod.Exception

half marsh
#

b!rtfm pyc commands.errors

arctic anvil
#

ok

#

thanks

slender lintel
#
        weather = str(weatherData2['list'][3]['weather'][0]['description'])

What is wrong with my code? i want to get the marked one

inland acorn
#

the formatter is confusing

slender lintel
#

4 sure

inland acorn
#

um

#

i was copying

slender lintel
#

wait

#

😄

#

thats the right

#

it´s a forecast from the weather

slow dome
#

What type is weatherData2

slender lintel
#

it´s only the json loads

#

weatherData2 = json.loads(Response2.text)

#

from the response

slow dome
#

what library are you using to get the weather? requests? aiohttp?

slender lintel
#

requests

slow dome
#

then it’s response.json

slender lintel
slender lintel
#

no. there is no reason for async

#

it´s only a daily task

half marsh
half marsh
slender lintel
#

where´s the advantage?

slender lintel
#

works fine for other response but not for this one

#

and i don´t get it

craggy rapids
#
webhook = Webhook.from_url(url,session)
TypeError: from_url() takes 2 positional arguments but 3 were given```
bruh
sudden path
#

session=session

#

It's a kwarg

craggy rapids
#

oh ok

slender lintel
slender lintel
#

ah i think i know where is the problem

#

it´s a dict not a json

craggy rapids
#

hmm does event can be putted in a cogs?

sudden path
#

Yes

#

commands.Cog.listener decorator

supple ravineBOT
#

Here's the slash options example.

icy sluice
#

what’s a kwarg

#

are there specific docs on it?

#

yeah, do you know where i can find em?

#

thank you

misty glacier
#

How can I make something like a main command for example /fun and then a subcommand addemoji?

#

No they are just example pictures lol

#

This is only one example

#

I don't want to do anything with an emoji

misty glacier
#

I just want to make a subcommand

midnight cedar
misty glacier
midnight cedar
misty glacier
#

Thx

misty glacier
# midnight cedar yes

Can I still make a /main command so that there is /welcome where something is returned and /welcome subcommand
So like in the picture

midnight cedar
#

You can't invoke the base group command unfortunately

misty glacier
#

Mhh ok

misty glacier
#

How do I create a SlashCommandGroup in a Cog?
And then how do I add that to the bot? I'm to stupid xd

supple ravineBOT
#

Here's the slash cog groups example.

misty glacier
#

Oh thx xd

misty glacier
#

But something like 2 subcommands in a row is not possible, is it?
So something like /welcome role remove

misty glacier
#

How?

signal grotto
midnight cedar
#

nowhere probably

#

other than the integrations tab

signal grotto
signal grotto
# misty glacier

That’s the description of the command /welcome activate and not of the slashcommandgroup /welcome

misty glacier
#

Oh xd
Idk

#

The command /welcome activate is activated and displayed but the others like /welcome addrole are not.
And the error in the console comes up

half marsh
misty glacier
#

It is in different files so that it remains clearer

sudden path
#

You can't create two slash commands group with the same name.

misty glacier
#

So it has to be in a class?

half marsh
misty glacier
#

Then one is called /welcome1 and the other /welcome2 or what?

sudden path
#

Or just put the commands in the same class

#

What's the point of keeping them separate

half marsh
misty glacier
#

yea xD

sudden path
#

What a dumb reason

half marsh
sudden path
#

A code can be clean with many commands in it

misty glacier
supple ravineBOT
#

Here's the slash cog groups example.

#

Here's the slash groups example.

slow dome
slender lintel
#
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 992, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 358, in invoke
    await injected(ctx)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 127, in wrapped
    ret = await coro(arg)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 1171, in _invoke
    await command.invoke(ctx)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 355, in invoke
    await self.prepare(ctx)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 278, in prepare
    raise CheckFailure(f"The check functions for the command {self.name} failed")
discord.errors.CheckFailure: The check functions for the command sell failed
[...]
        @commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(discord.errors.CheckFailure, error):
            await ctx.respond('📛 **You have not enogh permissions to execute this command!**', ephemeral=True)
        else:
            raise error
[...]
``` where bug (monkey image meme)
mild hatch
slender lintel
# mild hatch u gotta use `on_application_command_error`

didn't help

@commands.Cog.listener()
    async def on_application_command_error(self, ctx, error):
        if isinstance(discord.errors.CheckFailure, type(error)):
            await ctx.respond('📛 **You have not enogh permissions to execute this command!**', ephemeral=True)
        else:
            raise error
#

still doesn't catch the error

mild hatch
#

is the indentation alright?

slender lintel
#

yes

#

dont mind it

mild hatch
#

i think the syntax for isinstance is wrong

slender lintel
#

?

mild hatch
#

it should be isinstance(error, discord.errors.CheckFailure)

slender lintel
#

oh yes

#

thanks

mild hatch
#

see if that works

slender lintel
#

it should

#

yeah

#

thanks

#

it just got of my mind 😄

misty glacier
#

How can I react with a custom animated emoji?

scenic leaf
#
bot = ...
bot.animename = ""

@bot.event
async def on_ready():
    bot.loop.create_task(animecheck())

@tasks.loop(minutes=1)
async def animecheck():
    async with aiohttp.ClientSession() as cs:
          async with cs.get("/recent-release") as r:
            res = await r.json()
            name = res[0]['animeTitle']
            anime = name.replace('(', '')
            anime1 = anime.replace(')', '')
            searchanime = anime1.replace(' ', '-')
            print(searchanime)
            if name == bot.animename:
                print("no new anime")
                return
            else:
                bot.animename = name
                image = res[0]['animeImg']
                episode = res[0]['episodeNum']
                subordub = res[0]['subOrDub']
                async with cs.get(f"details/{search}") as r1:
                    res1 = await r1.json()
                    synopsis = res1['synopsis']
                    genres = res1['genres']
                    embed=discord.Embed(title=f"watch {name} here", url="", description=synopsis)
                    embed.set_author(name="New Uploads")
                    embed.set_thumbnail(url=image)
                    embed.add_field(name="sub or dub", value=subordub, inline=False)
                    embed.add_field(name="genres", value=genres, inline=False)
                    embed.add_field(name="Episodes", value=episode, inline=True)
                    embed.set_footer(text="BBMoon")
                    channel = discord.utils.get(bot.get_all_channels(), id=config.Animeupdatechannel)
                    await channel.send(embed=embed)

it wont loop it either has to send a message or a print but it doesnt do that what am i doing wrong here ?

misty glacier
#

How do I test if a modal was closed without being sent?

little isle
#

How can I check if the bot has a given permission (manage_roles in this case)?

little isle
#

ctx.bot.user is a ClientUser, which doesn't have permissions stuff

#

I figure I could probably get the Member object by querying the guild for the bot's user ID, then get the permissions that way, but that seems cumbersome

little isle
#

Ah, perfect, thanks

scenic leaf
sudden path
#

Try with self.animecheck.start()

#

bot.anime ... in your case

scenic leaf
#

ill try

warped token
#

So idk if this is the right place for it, but I'll go anyway

I'm trying to host my bot on heroku, everything works, only problem is that the slash commands don't show.

Any help would be appreciated!

Here are the logs of heroku:

2022-07-15T20:29:39.000000+00:00 app[api]: Build started by user {my email}
2022-07-15T20:30:16.177536+00:00 app[api]: Release v6 created by user {my email}
2022-07-15T20:30:16.177536+00:00 app[api]: Deploy 48637215 by user {my email}
2022-07-15T20:30:20.000000+00:00 app[api]: Build succeeded
2022-07-15T20:31:35.598773+00:00 heroku[worker.1]: Starting process with command `python main.py`
2022-07-15T20:31:36.290181+00:00 heroku[worker.1]: State changed from starting to up
2022-07-15T20:31:39.783050+00:00 app[worker.1]: Ignoring exception in on_connect
2022-07-15T20:31:39.784076+00:00 app[worker.1]: Traceback (most recent call last):
2022-07-15T20:31:39.784113+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/client.py", line 382, in _run_event
2022-07-15T20:31:39.784114+00:00 app[worker.1]:     await coro(*args, **kwargs)
2022-07-15T20:31:39.784114+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/bot.py", line 1041, in on_connect
2022-07-15T20:31:39.784114+00:00 app[worker.1]:     await self.sync_commands()
2022-07-15T20:31:39.784116+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/bot.py", line 643, in sync_commands
2022-07-15T20:31:39.784116+00:00 app[worker.1]:     registered_guild_commands[guild_id] = await self.register_commands(
2022-07-15T20:31:39.784117+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/bot.py", line 472, in register_commands
2022-07-15T20:31:39.784117+00:00 app[worker.1]:     prefetched_commands = await self.http.get_guild_commands(self.user.id, guild_id)
2022-07-15T20:31:39.784117+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/http.py", line 360, in request
2022-07-15T20:31:39.784118+00:00 app[worker.1]:     raise HTTPException(response, data)
2022-07-15T20:31:39.784135+00:00 app[worker.1]: discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
2022-07-15T20:31:39.784135+00:00 app[worker.1]: In guild_id: Value "Ellipsis" is not snowflake.
2022-07-15T20:31:41.391143+00:00 app[worker.1]: - 983272986058559508 (name: Matt3o0's Test Server)
2022-07-15T20:31:41.391194+00:00 app[worker.1]: - 996900588547751996 (name: Shitters Simulations)
2022-07-15T20:31:41.391194+00:00 app[worker.1]: The bot is in 2 guilds and ready for usage!
sudden path
hardy pendant
#

And on top

#

U most likely copy pasted
And because of that
guild_ids=[...]
Look like that when its expecting integers

warped token
#

yeah, I copy pasted from the pycord guide so I was sure nothing was wrong in my code

hardy pendant
#

Yeah

warped token
#

I'll remove the guild thing

hardy pendant
#

No you can just remove it

#

😅

#

Heroku huh

#

Hmmmmmm

#

However expect delays on ur commands being added to that specific server

warped token
#
2022-07-15T20:44:40.303422+00:00 app[worker.1]: Traceback (most recent call last):
2022-07-15T20:44:40.303438+00:00 app[worker.1]:   File "/app/main.py", line 28, in <module>
2022-07-15T20:44:40.303515+00:00 app[worker.1]:     async def on_ready():
2022-07-15T20:44:40.303527+00:00 app[worker.1]: TypeError: event() missing 1 required positional argument: 'coro'
#

it gives this now

hardy pendant
#

Send

#

Ur on_ready

#

Function

warped token
#
@bot.event
async def on_ready():
    guild_count = 0

    for guild in bot.guilds:
        print(f"- {guild.id} (name: {guild.name})")

        guild_count = guild_count + 1

    print("The bot is in " + str(guild_count) + " guilds and ready for usage!")
hardy pendant
#
@bot.event()
async def on_ready():
    guild_count = 0

    for guild in bot.guilds:
        print(f"- {guild.id} (name: {guild.name})")

        guild_count = guild_count + 1

    print("The bot is in " + str(guild_count) + " guilds and ready for usage!")```
#

😅

#

I think

#

I have a custom setup so 😂

warped token
#

ok lol, it's deploying now...

hardy pendant
#
class Nightmarefever(AutoShardedBot): 
     def __init__(self, command_prefix=set_prefix, intents=intents()): 
         super().__init__(command_prefix, intents=intents) 
         self.__setup__classes__() 
         self.bot = self

Where would i and how would i add case insensitivity to this

hardy pendant
warped token
#

it gives this now

2022-07-15T20:52:10.281548+00:00 app[worker.1]: Traceback (most recent call last):
2022-07-15T20:52:10.281569+00:00 app[worker.1]:   File "/app/main.py", line 27, in <module>
2022-07-15T20:52:10.281652+00:00 app[worker.1]:     @bot.event()
2022-07-15T20:52:10.281670+00:00 app[worker.1]: TypeError: event() missing 2 required positional arguments: 'self' and 'coro'
hardy pendant
#

Ooof

warped token
#

🥲

hardy pendant
#
@bot.event
async def on_ready():
    guild_count = 0

    for guild in bot.guilds:
        print(f"- {guild.id} (name: {guild.name})")

        guild_count = guild_count + 1

    print("The bot is in " + str(guild_count) + " guilds and ready for usage!") 
hardy pendant
#

Idk
I am too tired to think 🤣

slow dome
#

len(bot.guilds)

#

exists

hardy pendant
hardy pendant
#

👀

slow dome
#

I mean sure. But what they are doing is just like 17 times less efficient

hardy pendant
#

🤣 🤷

slow dome
#

it’s like grabbing a fork and instead of going straight to the kitchen, you go the other way around the world and then reach your kitchen

hardy pendant
#

It iz whqt it iz

slow dome
#

¯_(ツ)_/¯

hardy pendant
#

Dont be ocd with other people's code 🤣

#

But yes i understand

slow dome
hardy pendant
#

🤣 🤣 🤣

#

Hey people have to stary somewhere

hardy pendant
#

@warped token


@bot.event
async def on_ready():
    guild_count = 0

    for guild in bot.guilds:
        print(f"- {guild.id} (name: {guild.name})")

        guild_count = guild_count + 1

    print("The bot is in " + str(guild_count) + " guilds and ready for usage!")  
hardy pendant
slow dome
#

;)

hardy pendant
#

Aaah see thats an old version of it that i haven't fixed but i still need to add the case insensitivity

#

Da hell

#

What da

warped token
warped token
#

ok lol

hardy pendant
#

I0 think

#

My brain is

#

Sleepy

#

😩

slow dome
#

then sleep

hardy pendant
#

👍 💯

midnight horizon
#

how do i stop "the bot didn't respond" from appearing in the chat when i don't need it to say anything?

hardy pendant
#

Or don't use slashcommands?

slow dome
slow dome
#

b!rtfm pyc applicationcontext.defer

open bearBOT
hardy pendant
#

Boi this ain't no chat

slow dome
midnight horizon
hardy pendant
#

I recommend arm

#

👍 👀

#

Or am

slow dome
#

I recommend #general

warped token
# hardy pendant <@668874138160594985> ```py @bot.event async def on_ready(): guild_count =...

it gives this 🥲


2022-07-15T21:05:09.858250+00:00 app[worker.1]: Traceback (most recent call last):
2022-07-15T21:05:09.858273+00:00 app[worker.1]:   File "/app/main.py", line 28, in <module>
2022-07-15T21:05:09.858397+00:00 app[worker.1]:     async def on_ready():
2022-07-15T21:05:09.858422+00:00 app[worker.1]: TypeError: event() missing 1 required positional argument: 'coro'
#

again lol

hardy pendant
#

I am way to tired to think to fox that

hardy pendant
#
@bot.event
async def on_ready():
    guild_count = 0

    for guild in bot.guilds:
        print(f"- {guild.id} (name: {guild.name})")

        guild_count = guild_count + 1

    print("The bot is in " + str(guild_count) + " guilds and ready for usage!")  
#

Line 28 breaks

#

Which is the on ready

#

For some reason

slow dome
#

Do you have a requirements.txt

warped token
#

yes

slow dome
#

If so, could you send it

warped token
#

ok

slow dome
hardy pendant
#

It does

warped token
#

you can only use that?

hardy pendant
#

It uses

#

Pycord

#

👀

#

Pycord renames it self

slow dome
#

If it had discord.py that error would've made sense

hardy pendant
#

For some reasons

#

Hmmmmm

slow dome
hardy pendant
#

Oh hmmm

slow dome
#

what is your python version

warped token
#

3.9.13, same as on my pc

hardy pendant
#

Namespace? Interesting.... so python has namespaces 👀

slow dome
#

I'm not a cs major

hardy pendant
#

So modules are namespaces in the sense

hardy pendant
#

C sharp?