#discord-bots

1 messages Β· Page 40 of 1

cold oyster
#

@dull terrace ??

flat swallow
#

Cuz it would give a straight error of no definiton but it's not

#

So it has alr been defined

cold oyster
#

Wait

#

Can I see the full code?

flat swallow
#

ayo

cold oyster
flat swallow
#

one sec??!! I just reran it and it's working wtf πŸ˜‚

silk fulcrum
#

well... there are a lot of things those could be organised, for example: speed and memory (using ['hey'] instead of {0: 'hey'} is faster), repeating code (could with a function or classes) and OOP stuff

flat swallow
#

nvm

#

it aint

cold oyster
flat swallow
#

lmao

flat swallow
cold oyster
#

braaah

flat swallow
#

ayo πŸ˜‚

silk fulcrum
cold oyster
dull terrace
robust fulcrum
#

How can I fetch a image from message in dpy?

dull terrace
#

idk what the fu

slate swan
unkempt canyonBOT
flat swallow
#

ye

robust fulcrum
#

Ok

cold oyster
#

The frick is this

silk fulcrum
# cold oyster Disnake

hm, im not sure but probably it's required in disnake for arguments to have a description

flat swallow
#

same error

slate swan
#

pass a valid token

flat swallow
#

I did 😭

#

I changed it twice and updated my code to accomodate it

silk fulcrum
slate swan
#

skill issue

dull terrace
dull terrace
#

create a new bot and see if it works

cold oyster
silk fulcrum
flat swallow
cold oyster
#

Ill try pycord maybe..

shrewd apex
dull terrace
silk fulcrum
slate swan
cold oyster
cold oyster
slate swan
dull terrace
silk fulcrum
#

^^^^^^^

cold oyster
silk fulcrum
cold oyster
#

For replit users it does-

shrewd apex
cold oyster
#

Wrong one bruh

silk fulcrum
silk fulcrum
slate swan
shrewd apex
#

how are u gonna make pycord disnake or nextcord work u just change the name for same code and it works 99.99% of the time

golden tapir
#

why error

shrewd apex
#

so if u fail dpy nothing else helping u

golden tapir
#
  if arg  > str(13):
    await ctx.send("You are old enough for this server.")
    member = ctx.message.author
    role = get(member.server.roles, name="Verifyed")
    await bot.add_roles(member, role)
shrewd apex
#

not server

#

verified spelling also wrong

golden tapir
#

my bad

slate swan
dull terrace
#

str(13)

hushed galleon
#

you've been looking at outdated documentation

dull terrace
#

instead of "13"

shrewd apex
dull terrace
#

and how are you

golden tapir
dull terrace
#

it shouldn't be a string

slate swan
cold oyster
#

bruh i need to change this too

slate swan
hushed galleon
dull terrace
cold oyster
#

BRUH

cold oyster
#

IT WORKED

dull terrace
flat swallow
#

πŸ’€

cold oyster
#

da universe changed for me

shrewd apex
flat swallow
#

New bot also not working

cold oyster
#

sometimes i hate python..

flat swallow
#

Frikin improper token my ass

dull terrace
#

i've installed disnake maybe 4 times and never had that issue

cold oyster
#

idk, disnake goin crazy with me

shrewd apex
#

skill issue then

hushed galleon
shrewd apex
#

print it just before the run statement

cold oyster
#

print the shit out

dull terrace
#

i can't imagine you're able to do this without a different error, but is your token in quotes? @flat swallow

shrewd apex
cold oyster
flat swallow
#

u mean here right

cold oyster
#

ima pea

shrewd apex
#

if its not printing shit correctly that means u messed up rule number 1 of any coder

flat swallow
dull terrace
cold oyster
#

back

flat swallow
#

πŸ€¦πŸΌβ€β™‚οΈ

cold oyster
flat swallow
#

That is the token...?

#

I thought its the

cold oyster
flat swallow
#

uhm
client secret

flat swallow
#

Uhhhhh ye imma dip rq

dull terrace
cold oyster
slate swan
junior verge
#

What do you guys think is the best vps for discord bots? and cheap and just easy to use

flat swallow
shrewd apex
#

imagine trying with application I'd instead

cold oyster
dull terrace
#

does no one here use AWS?

cold oyster
junior verge
#

IS ohvcloud good?

shrewd apex
cold oyster
#

i use railway no matter what they say

slate swan
junior verge
#

2gb for 3 euro a month

cold oyster
#

cz i dont give a f

dull terrace
#

1 year free when you sign up on AWS and it's literally the fastest connection you'll get

cold oyster
shrewd apex
#

if u unverified PPL like me no cc nothing not a dollar in pocket use heroku or railway app

flat swallow
#

ty guys so much for putting up with my dumbass 😭 i got it to work now tysm

slate swan
#

either ways, I use my brother's kek

cold oyster
shrewd apex
cold oyster
shrewd apex
#

so lifehack fail

cold oyster
slate swan
shrewd apex
cold oyster
#

but well i make money from rblx gfx' and game dev'ing

cold oyster
#

well lets keep it on topic for now

shrewd apex
#

me only still poor πŸ’€

cold oyster
shrewd apex
#

no work nothing

cold oyster
#

for robux πŸ’€

slate swan
cold oyster
shrewd apex
#

what imagine living it rn

slate swan
#

Asians UniSips

cold oyster
slate swan
#

smh

cold oyster
#

!ot

unkempt canyonBOT
cold oyster
#

thats it

shrewd apex
#

still fine food in foreign only salt and pepper Asia still best

cold oyster
shrewd apex
#

Dubai better coz no taxes pithink

cold oyster
#

im still confused that by asianns do u mean people living in asia or japanese/chinese

slate swan
shrewd apex
#

kek my country not even named πŸ—Ώ

cold oyster
shrewd apex
#

i don't live in China or japan

cold oyster
#

then.

shrewd apex
#

if i was from China i wouldn't be using discord pithink

#

baidu only

slate swan
#

India, yes we know asher

shrewd apex
shrewd apex
cold oyster
slate swan
cold oyster
#

i kinda knew cz ur pfp

shrewd apex
#

my pfp look Indian πŸ‘€ pithink

cold oyster
#

emo anime pics πŸ’ͺ

hollow badger
#

Please keep this chat civil.

cold oyster
hollow badger
#

Also keep it on topic.

cold oyster
#

Alright

shrewd apex
#

yes sir

slate swan
cold oyster
cold oyster
unkempt canyonBOT
slate swan
#

?

cold oyster
#

Can someone tell me some bot ideas

#

Lke cmd ideas

slate swan
cold oyster
dull terrace
cold oyster
slate swan
# cold oyster what.....

a command that adds a listener to check if a member/message was updated and send a message to the user until the user/message is ever untracked

cold oyster
#

never

#

lol--

slate swan
cold oyster
shrewd apex
#

ashley still into voyerism i see

shrewd apex
cold oyster
#

peace.

shrewd apex
#

using buttons

#

and reactions

cold oyster
#

i'd rather make nothing

#

me bad dev lol

robust fulcrum
slate swan
cold oyster
#

3 indians in a row :)

cold oyster
#

gottin

slate swan
shrewd apex
#

back to topic

slate swan
shrewd apex
#

before we are oted

robust fulcrum
#

Guys anyone give me a idea how i can make help comand easily . Is there any way i can get all comamnd names and it's aliases?

slate swan
#

I don't object about the trackers

cold oyster
#

ghost pong

sick birch
knotty agate
#

im having an issue with permissions.

im trying to get my bot to change users nicknames, but everytime it tries to it has an error saying forbidden permissions. but my bot has administraitor and its trying to change my alt accounts nickname who has no permissions? does anyone know whats going on?

sick birch
sick birch
#

Resources section

silk fulcrum
#

oh 😳 kay

slate swan
knotty agate
silk fulcrum
#

i mean gif is too much

slate swan
#

lmao

cold oyster
final walrus
#

does message.edit have a rate limit of about 5 edits per 5 seconds?

silk fulcrum
#

looks too short for a whole game

final walrus
#

If so, is there a way to avoid that? I want to make text animations by editing messages

#

But I get rate limited (I think)

dull terrace
#

5 per second per guild

shrewd apex
#

i tried making marquee text before

golden tapir
#

why am i getting this error\

shrewd apex
#

horrible results

golden tapir
golden tapir
#
@bot.command()
async def create_role(ctx, whatrole):
  await bot.add_roles(whatrole)
shrewd apex
unkempt canyonBOT
#

await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
silk fulcrum
golden tapir
#

i am trying to create roles

final walrus
dull terrace
#

if you have to animate something then you're gonna have to send gifs

final walrus
#

Gifs suck ngl

final walrus
#

I'd rather have it text based

golden tapir
#

is there a way to create roles?

shrewd apex
dull terrace
#

use a gif of discord font with transparent background then?

shrewd apex
unkempt canyonBOT
#

await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") for the guild.

All fields are optional.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to do this.

Changed in version 1.6: Can now pass `int` to `colour` keyword-only parameter.

New in version 2.0: The `display_icon` keyword-only parameter was added...
golden tapir
#

thx

dull terrace
golden tapir
#

thank u

#

i will try it out

#

lol

shrewd apex
golden tapir
#

salt makes everything better

final walrus
#

no salt no sugar

shrewd apex
dull terrace
#

add a tablespoon of marmite

golden tapir
#

no i use hydrogen proixide combined with oxygen with a little heat then BOOM

junior verge
#
@commands.command()
    async def aping(self, ctx):

        id1 = 813824599522541628
        id2 = 574217755692236803
        if ctx.message.author.id == id1 or ctx.message.author.id == id2:
            await ctx.send("Admin ping sent!")
            link = await random.choice(self.ctx.guild.text_channels).create_invite()
            channel = await self.client.fetch_channel(1009396408345964655)
            embed = discord.Embed(title=f"Admin Ping!", color=0xff0000 )
            await channel.send(f"<@{self.ctx.user.id}>")
            embed.add_field(name=f"Latency:", value=f"{round(self.client.latency * 1000)}**ms", inline=False)
            embed.add_field(name=f"Server Name:", value=self.ctx.guild.name, inline=False)
            embed.add_field(name=f"Server ID:", value=self.ctx.guild.id, inline=False)
            embed.add_field(name=f"Owner Name:", value=self.ctx.guild.owner, inline=False)
            embed.add_field(name=f"Owner ID:", value=self.ctx.guild.owner_id, inline=False)
            embed.add_field(name=f"Membercount:", value=len(self.ctx.guild.members), inline=False)
            embed.add_field(name=f"Invite:", value=f"{link}", inline=False)
            await channel.send(embed=embed)
``` I'm confused, also self.ctx.user.id is not correct idk
knotty agate
shrewd apex
#

aping pithink

junior verge
#

?

golden tapir
swift pumice
#

:this

dull terrace
#

why are you using self

swift pumice
silk fulcrum
#

πŸ‘‡

golden tapir
swift pumice
golden tapir
#

my server da best

#

what else do i have

silk fulcrum
golden tapir
golden tapir
shrewd apex
golden tapir
#

thats why i added that

shrewd apex
#

master32 gps system broken πŸ˜”

golden tapir
dull terrace
#

replit, nah repbad froggy_chill

golden tapir
silk fulcrum
knotty agate
# silk fulcrum code?
@client.event
async def on_message(message):
  content = str(message.content)
  keyword = content.split(" ")[0]
  if keyword == "!nick":
    new_name = content.replace("!nick ", "")
    await message.author.edit(nick=new_name)
shrewd apex
#

problem is too many PPL use replit for hosting and then they go get their neighbours bots ratelimited

shrewd apex
knotty agate
shrewd apex
#

PPL who use on_message for commands ....

golden tapir
#

i used to get rate limited all the time Replit

shrewd apex
#

i am saying in wrong place

silk fulcrum
limber bison
#

Local variables vs global variables? Which take more CPU ? If i use more global variables is it ok ?

shrewd apex
knotty agate
shrewd apex
#

yt tutorial always do client = commands.Bot

slate swan
shrewd apex
#

...

slate swan
#

I always get yelled at when I mention them 😭

dull terrace
#
client = commands.InteractionBot()```
shrewd apex
limber bison
knotty agate
#

i dont see how this is relevant since it is a permissions error

silk fulcrum
#

that's not dpy 😭

knotty agate
#

yet the bot has the highest permissions and my alt has the lowest

shrewd apex
#

i never go and say PPL don't use global vars use globals vars no problem don't use global keyword to edit global vars

silk fulcrum
shrewd apex
dull terrace
#

hmm i wonder

shrewd apex
#

u need constants use global variable u need for temporary storage then use functions functions have a local env where local variables are utilised

golden tapir
#

is it possible to delete roles on command

shrewd apex
shrewd apex
golden tapir
#

what is the command?

silk fulcrum
#

wth is TYPE_CHECKING used for in making bot? (saw it in RDanny)

knotty agate
# silk fulcrum could you show full traceback please
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\user\Desktop\mc db\main.py", line 1111, in on_message
    await message.author.edit(nick=ign)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 681, in edit      
    await http.edit_member(guild_id, self.id, reason=reason, **payload)
  File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 248, in request     
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
junior verge
#

How to get the ID of someone in a cog of the user executing the command? its self.user.id right?

final walrus
#

Has anybody else tried making animations through editing text

dull terrace
knotty agate
#

iirc?

dull terrace
#

you don't have the right permissions

shrewd apex
#

u fetch the role then delete

dull terrace
#

there's literally no other reason that error would happen

shrewd apex
#

!d discord.Role.delete

unkempt canyonBOT
#

await delete(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Deletes the role.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this.
shrewd apex
#

strange i checked docs guild has create role but no delete role πŸ—Ώ

knotty agate
shrewd apex
#

one line extra to delete

knotty agate
#

and my alt is only @ everyone

dull terrace
shrewd apex
shrewd apex
#

if it's in a prefix command

silk fulcrum
final walrus
dull terrace
knotty agate
final walrus
#

Is there no better alternative

shrewd apex
#

there is

knotty agate
shrewd apex
#

u read it out in a voice channel

final walrus
#

LOL

#

true

#

make the bot join a vc and stream the animation

silk fulcrum
#

omg ive listened to this 3 hours str8

silk fulcrum
shrewd apex
dull terrace
#

oh own nickname 7739monkathink

knotty agate
#

ok nvm im actually an idiot why did it take me 20 minutes to realise it wasnt trying to edit the person who ran the commands nickname, it was always trying to edit mine (server owner)

sorry for wasting everyone time 😦

silk fulcrum
#

they only hear "we dont sleep at niiight"

shrewd apex
#

it be like this noise from last 3hrs i don't even care anymore

dull terrace
#

alright so it didn't have the right permissions

shrewd apex
#

i have met people who tried to make bot kick owners this is nothing

knotty agate
#

i have no clue how i did not, genuinley. this has been such a waste of time on my part

sorry

shrewd apex
#

smol mistake

dull terrace
#

doge_kek literally happens with everyone dw

honest shoal
#

how can I make my autocomplete like this? (I use disnake)

silk fulcrum
shrewd apex
honest shoal
silk fulcrum
#

now I feel like I switched the world, not a song in background

knotty agate
#

new question: how get a discord.Member from a 'User' object

fetch_user returns a user object but i need a member

dull terrace
#

pretty sure thatll do

shrewd apex
silk fulcrum
unkempt canyonBOT
#

await fetch_member(member_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.

Note

This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.

Changed in version 2.0: `member_id` parameter is now positional-only.
knotty agate
silk fulcrum
#

or get_member

honest shoal
#

I am not asking how to make an autocomplete, I want users to select their argument from autocomplete only

dull terrace
#

oh you have to do this too

dull terrace
#

options = commands.option_enum(["asdfasdf", "asdfasdf"])
then options: options

shrewd apex
silk fulcrum
shrewd apex
#

the code for rdanny

unkempt canyonBOT
#

cogs/utils/context.py lines 3 to 13

from typing import TYPE_CHECKING, Any, Callable, Iterable, TypeVar, Union, Optional, Generator
from discord.ext import commands
import asyncio
import discord
import io


if TYPE_CHECKING:
    from bot import RoboDanny
    from aiohttp import ClientSession
    from asyncpg import Pool, Connection```
silk fulcrum
#

he uses it everywhere

#

not only in context

shrewd apex
#

oh prolly a custom extension to typing lib

#

!d typing.TYPE_CHECKING

unkempt canyonBOT
#

typing.TYPE_CHECKING```
A special constant that is assumed to be `True` by 3rd party static type checkers. It is `False` at runtime. Usage:

```py
if TYPE_CHECKING:
    import expensive_mod

def fun(arg: 'expensive_mod.SomeType') -> None:
    local_var: expensive_mod.AnotherType = other_fun()
```  The first type annotation must be enclosed in quotes, making it a β€œforward reference”, to hide the `expensive_mod` reference from the interpreter runtime. Type annotations for local variables are not evaluated, so the second annotation does not need to be enclosed in quotes.
dull terrace
#

what is a robodanny

shrewd apex
#

nope it's inbuilt

#

dumb me

silk fulcrum
shrewd apex
dull terrace
#

yall need to upgrade to disnake

silk fulcrum
torn sail
#

Yes

dull terrace
#

but that would be a downgrade

honest shoal
shrewd apex
#

it don't matter as long as u can make discord bots and u don't use pycord pithink

silk fulcrum
junior verge
#

How to delete the authors message again

torn sail
junior verge
#

ty

shrewd apex
#

beat me to it πŸ˜”

silk fulcrum
dull terrace
#
Options = commands.option_enum(["Option 1", "Option 2"])

@bot.slash_command(name="monke", description="monkeys are nice")
async def monke(inter:disnake.CommandInteraction, options: Options):
  ...```
honest shoal
#

oh

#

thanks!

dull terrace
silk fulcrum
#

result: very nice

cold sonnet
#

is there a c# discord api wrapper

silk fulcrum
#

must be

cold sonnet
#

what

#

this means no

silk fulcrum
#

lolmao

silk fulcrum
robust fulcrum
#

Hoow can we get command user avatar?

silk fulcrum
#

better display_avatar if you are using dpy 2.0

robust fulcrum
#

Avatar url

silk fulcrum
robust fulcrum
#

Oh k

#

Ty

shrewd apex
#

there is display_avatar.url also

silk fulcrum
#

yeah, for 2.0

slate swan
# silk fulcrum wth is TYPE_CHECKING used for in making bot? (saw it in RDanny)

its used when you want to avoid circular imports and still use the classes for type annotations

# foo.py 
from bar import Banana

class Apple:
    banana: Banana
``` ```
# bar.py

from foo import Apple

class Banana: ...
``` this will raise an import error
but you can avoid that by ```py
# foo.py

import typing
if typing.TYPE_CHECKING:
   from bar import Banana

class Apple:
   banana: "Banana"
silk fulcrum
#

Apple.banana pithink

paper sluice
#

tf is going on pithink

mossy jacinth
#

How can i make it so a button opens up a modal and without sending any messages?

silk fulcrum
#

noway

mossy jacinth
#

πŸ˜”

silk fulcrum
#

!d discord.InteractionResponse.send_modal

unkempt canyonBOT
#

await send_modal(modal, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Responds to this interaction by sending a modal.
silk fulcrum
#

ohkay

mossy jacinth
#

so it is possible 😱

silk fulcrum
#

yes it is

primal token
hot prawn
#

How could I make application commands dpy 2.0

pliant gulch
#

TYPE_CHECKING is nice, but I would almost always prefer forward referencing, only if it weren't for the fact that if I did forward reference I would still need TYPE_CHECKING to make the type-checker know it's defined....

slate swan
#

Any idea?

flat swallow
#

Doubt: How do I get the content the user has entered in their dms
I am making a hangman function

potent spear
flat swallow
#

Guessing this isn't very correct then

potent spear
#

surely not

#

I'll highly suggest you to use the commands.ext extension

flat swallow
#

I should

flat swallow
#

But I have come so far that i am very lazy to change this

potent spear
#

instead of checking for certain strings in the on_message event

#

that'll be very messy

flat swallow
#

Yes

#

leme change the code

potent spear
flat swallow
#

Hope this looks in order

hidden haven
#

Can you have two async def on_message(message) in the same script, or does your code need to be consolidated to one on_message() function?

sick birch
hidden haven
maiden fable
#

event overrides the built in functionality of that ws event whereas listener appends our function to an internal list and doesn't override anything

slate swan
#

that reminds me of that song for no reason

flat swallow
#

So is my code right?

unkempt canyonBOT
#

Hey @flat swallow!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

maiden fable
#

If the song is right, so is the code

flat swallow
#

lmao

#

i need help tho

slate swift
#
async def on_ready():
  print('{0.user}'.format(client))
  print('Is Online')
  print('-----------')
  await client.change_presence(
        status=discord.Status.idle,
        activity=discord.Game(
            name=f",help | In {len(client.guilds)} servers, {len(list(client.get_all_members()))} members. ",
        ),
    )```
maiden fable
#

With?

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swift
#

can someone tell me why it doesnt say in status the correct amount of members

flat swallow
#

thats how i did it

#

its very long tho

maiden fable
#

U can use len(bot.users) too btw

#

!intents u need members intent

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swift
#
intents.members = True
initial_extensions = []```
flat swallow
slate swift
flat swallow
#

Why can't I tick all lol

maiden fable
slate swift
maiden fable
#

commands.Bot(intents=intents)

slate swift
slate swan
# flat swallow Hope this looks in order
  • get_quote id a blocking function, make it non-blocking by using aiohttp instead of requests
  • keep your imports at one place, you're importing datetime randomly anywhere
  • create another test file to test things out, don't do it in the main file
  • Unnecessary try/except in the on_message event
  • it's bot.command not bot.Command in the command decorators
  • hard-coded help command
  • The meme command is blocking, use aiohttp instead of requests
  • The hangman command will never work because of the wrong usage of str.startswith, that is message.author which is a Union of Member and User object, and startswith is an str class method and the use of startswith is wrong too
mossy jacinth
#

How can i make a command to let my bot leave the server?
I want to make a command like !leave so the bot automatically leaves, because kicking, then confirming it annoys me...

slate swift
unkempt canyonBOT
#

await leave()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Leaves the guild.

Note

You cannot leave the guild that you own, you must delete it instead via [`delete()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.delete "discord.Guild.delete").
slate swift
sick birch
slate swift
flat swallow
#

This correct?

mossy jacinth
slate swan
#

you dont really require intents in a Bot

flat swallow
#

now u do

#

for loads of things

slate swift
#

doesnt work still

#

still says ,help | in 48 servers, 48 members

flat swallow
#

WHY ARE MY COMMANDS NOT WORKING 😭

mossy jacinth
slate swift
#

,help | in 48 servers, {number of members}

#

it says the amount of server and help but the members of serv is 48 even tho its in 1k+ member servers

mossy jacinth
slate swift
#

is what i have

mossy jacinth
# slate swift ```@client.event async def on_ready(): print('{0.user}'.format(client)) prin...
@client.event
async def on_ready():
  print('{0.user}'.format(client))
  print('Is Online')
  print('-----------')

  members = 0
  for guild in client.guilds:
      members += guild.member_count - 1

  await client.change_presence(
        status=discord.Status.idle,
        activity=discord.Game(
            name=f",help | In {len(client.guilds)} servers, {members} members. ",
        ),
    )

try this, i used it long ago so it should work

mossy jacinth
cold sonnet
#

but I do

mossy jacinth
#

never used it before

lost lichen
#

hi, i’m trying to make a server lockdown command, so far i have this but it will just send the embed and not change any of the permissions, im confused as this should work, right? what am i doing wrong?

#

i’m running this in a cog

valid glacier
#

Hey, I would like to publish my bot on github. I dont want to inculude files like TOKENS, which are private, how should I do that? The token is stored is in .env file and I know that there is something called gitignore, with which I should be able to ignore this file, but I have very liitle knowledge of git and I dont. want to mess it upπŸ˜…

sick birch
valid glacier
#

like not publish .env file

sick birch
#

Easier to just add to gitignore because all it takes is a slip up

lost lichen
#

yeah

mossy jacinth
#

How can i make my bot send the responses of the Modal into a channel or to me?

tried

id = (the server id here)
await interaction.id.send(response)

and some more things...

lost lichen
#

add *.env to your gitignore

valid glacier
lost lichen
#

gitignore file

lost lichen
valid glacier
hidden haven
#

How do you set a backslash as your command prefix in discord.py? I tried escaping with /\ but it took the prefix to be the literal /\. using just \ leads to an escape error

lost lichen
prisma wedge
#
  File "main.py", line 23, in <module>
    from discord_components import *
ModuleNotFoundError: No module named 'discord_components'``` i randomly got this error
lost lichen
#

have to wait for someone to come up with a solution

#

it’s not an intentional ignore

edgy maple
#

could I host a bot on a old pc by just leaving it on running the code?

edgy maple
#

epic

indigo pilot
honest shoal
silk fulcrum
indigo pilot
silk fulcrum
#

make sure there is

indigo pilot
#

if there wasnt the bot wouldnt even start

silk fulcrum
#

because seems like there isntit would

indigo pilot
#

as it wouldnt be able to sync cmds

honest shoal
#

oh

silk fulcrum
#

ohkay

silk fulcrum
honest shoal
#

is that an http only bot?

indigo pilot
#

i fixed it dpy has a bug lol

#

loop starting before bot loads

#

not a bug but still

#

pain lol

silk fulcrum
#

learn python basiiics

silk fulcrum
prisma wedge
#

i have one more question, i'm implementing slash commands and i pip installed pip install discord-py-slash-commandand i put from discord_slash import SlashCommand and slash = SlashCommand(client, sync_commands=True) in my code and it gives me an error saying ```Traceback (most recent call last):
File "main.py", line 21, in <module>
from discord_slash import SlashCommand
ModuleNotFoundError: No module named 'discord_slash'

silk fulcrum
#

just learn python basics please

#

bro please

#

I know how, you know how to learn right?

#

so you are

prisma wedge
valid glacier
prisma wedge
#

this is a help server, people don't come here to be told to learn

silk fulcrum
#

btw he's already been helped with saying that he needs to use elif

shrewd apex
prisma wedge
#

go read the documentation

silk fulcrum
#

lmao

silk fulcrum
#

aight im gonna try to explain one thing

sick birch
#

Could we please keep to civil folks

spring flax
#

If i want to have a list of IDS and prevent two users from pressing a button each time a command is used, what's the ideal way?

prisma wedge
silk fulcrum
#

You are using if argument == "something": and inside it you do if argument == "something other", do you understand that both they would never be true?

shrewd apex
primal token
shrewd apex
#

@prisma wedge ^^

prisma wedge
#

he literally just told you-

#

Use Elif

prisma wedge
silk fulcrum
#

You did that for some reason, you have to understand what that is for and what do you want to do, and that way you code... I could've told you to use elif instead of second if and move it one indent lower, but if you are not understanding the code you are writing that is a problem

spring flax
#

In the button subclass itself?

shrewd apex
#

how are the users decided upon

silk fulcrum
#

yes, do you understand how that works?

shrewd apex
silk fulcrum
primal token
#

If you understand how it works why do you question your solution and ask for someone to prove that youre correct and then doubt yourself because of the basics of indentation in python?

shrewd apex
#

details πŸ‘€ thinkmon

primal token
#

im not being rude, its just odd to me

silk fulcrum
#

that's how beginners brains work ig

#

idk

shrewd apex
#

should I ask in server or not pithink

primal token
shrewd apex
#

i am no expert in slash command but i think that argument param typehint is causing error

raven bolt
#

typehints are converters in discordpy.

silk fulcrum
#

i think that's because channel is typehinted as TextChannel and being None by default

shrewd apex
silk fulcrum
#

uhm, no? typehint channel as Optional[TextChannel]

#

btw make sure to import Optional from typing

raven bolt
#

wth is Union[] in a function?

glad cradle
primal token
shrewd apex
#

i used = None before no problems for me

silk fulcrum
raven bolt
#

arg may only be one of those args?

primal token
silk fulcrum
shrewd apex
#

but don't typehint Union in slash commands it dosent work with union iirc

glad cradle
#

what's your problem, I've arrived now

shrewd apex
#

is that the full error

raven bolt
#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

primal token
#

either way union really shouldnt be used as the built in union operator (bitwise or/pipes) are a thing

glad cradle
#

is Literal[] for choices?

paper sluice
primal token
silk fulcrum
#

basics of python are not a problem

paper sluice
shrewd apex
#

words of truth pithink

primal token
shrewd apex
primal token
silk fulcrum
#

you should understand what is wrong

shrewd apex
primal token
#

literally the hardest class in my school lmao

shrewd apex
#

it's good to relax by talking πŸ‘

glad cradle
#

!d discord.app_commands.Parameter you could use, I think that your error is related to Literal not 100% sure

silk fulcrum
#

i probably would've explained but that's too long

unkempt canyonBOT
#

class discord.app_commands.Parameter```
A class that contains the parameter information of a [`Command`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.Command "discord.app_commands.Command") callback.

New in version 2.0.
glad cradle
#

ehhmm

#

lemme check

silk fulcrum
primal token
#

type unsafe libraries

#

😳

silk fulcrum
spring flax
#

If i want to have a list of IDS and prevent two users from pressing a button each time a command is used, where would I store the list to compare it, and append to it?

primal token
#

it depends

silk fulcrum
#

hmmm... do i respect my schedule and go to bed or stay here until 1 AM and fall asleep and then wake up at 6:30 cus of an alarm clock

primal token
#

if you want it bound to a view, instance variables, if you want it bound to multiple views, global variables

glad cradle
#

@slate swan

prisma wedge
#
  Cloning https://github.com/Rapptz/discord.py to /private/var/folders/ph/kx_6fd713312kg0lv_rqhflr0000gn/T/pip-req-build-mank_kwh
  error: subprocess-exited-with-error
  
  Γ— git version did not run successfully.
  β”‚ exit code: 1
  ╰─> [2 lines of output]
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

Γ— git version did not run successfully.
β”‚ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
``` im getting this error trying to download dpy 2.0, i have a mac
primal token
glad cradle
raven bolt
#

honest to god nextcord is the one y'all should be using but i'm not gonna force my opinion on anybody

silk fulcrum
glad cradle
silk fulcrum
#

and pycord is shitty itself btw

primal token
#

not really, i would prefer to make a lib myself

glad cradle
raven bolt
#

go ahead make your own discord bot library Gigachad

primal token
glad cradle
#

your option?

raven bolt
spring flax
#

so it would be ```py
class MyNutton(Button):
self.clicked: list[int] = []

async def callback(...):
if interaction.user.id in self.clicked:
return
self.clicked.append(interaction.user.id)

in a command

view = View()
view.add_item(MyButton())
await ctx.send(content, view=view)


Would this use the list per-command usage? meaning it prevents two users from pressing a button each time a command is used
silk fulcrum
#

choices=

#

not :

primal token
silk fulcrum
#
  • Your Option must be quoted...
#

"Your Option"

primal token
#

Youre better of making the lib yourself and knowing every corner of it

silk fulcrum
#

i guess

glad cradle
#

should look like this

argument: str = Option(str, description="argument options", choices=["option 1", "option 2", ...])
silk fulcrum
#

not for channel, channel is separate arg

glad cradle
#

I think he copy pasted some example code

silk fulcrum
#

argument: choices, channel: Channel = None

glad cradle
#

🀭

#

then mb

primal token
glad cradle
#

fixed

silk fulcrum
silk fulcrum
primal token
silk fulcrum
#

uhm, same

paper sluice
silk fulcrum
#

what does this mean

glad cradle
#

show it

paper sluice
glad cradle
#

that's related to some embed obj

primal token
silk fulcrum
glad cradle
#

you're sending a modal?

#

lemme check the shitty docs again

unkempt canyonBOT
#

Hey @slate swan!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

glad cradle
#

btw what's the class modal 2

glad cradle
#

ok lemme read the docs

silk fulcrum
paper sluice
silk fulcrum
silk fulcrum
#

so everyone would see im not doing shit when im doing shit

glad cradle
#

@slate swan you need to use inter.response.send_modal(modal)

glad cradle
shrewd apex
#

for plugins

silk fulcrum
shrewd apex
#

some plugin is there just type discord and search

glad cradle
#

that's for vsc no?

silk fulcrum
glad cradle
#

wdym?

glad cradle
shrewd apex
#

there is one for all ides

glad cradle
#

I can't understand, it should work if there aren't errors in your modal2 class

shrewd apex
#

gn guys phone at 2% for me now

glad cradle
silk fulcrum
mossy jacinth
#

interaction

#

or interaction = inter ig

silk fulcrum
#

and it gave me an error

silk fulcrum
mossy jacinth
#

ok

paper sluice
silk fulcrum
glad cradle
#
  1. it's a coroutine you should await it
raven bolt
#

await coroutines smart

glad cradle
#
  1. in your case is interaction
slate swan
#

any1 know how make a bot pokemon? like poketwo ducky_australia

paper sluice
glad cradle
silk fulcrum
#

wait WHAT, it installed?

glad cradle
paper sluice
glad cradle
#

ryuga magic dance

silk fulcrum
#

where is my presence(

mossy jacinth
#

guys how can i send the modal inputs to the bot owner or into a channel?

glad cradle
#

it's interaction in your case 😐😐😐

#

Inter is an abbreviation of interaction like ctx is an abbreviation of context

paper sluice
silk fulcrum
slate swan
#

Are you trolling or being fr?

silk fulcrum
#

that gear is uninstall or disable

glad cradle
paper sluice
glad cradle
#

I don't like to do spoonfeeding, it's
await interaction.response.send_modal(modal) in your case

slate swan
#

Yeah, a definite troll. Just ignore them.

primal token
glad cradle
primal token
#

ok

glad cradle
#

what is your current code

#

line 292

#

^

#

related to your Modal class

#

do you know OOP in python?

#

!resources

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

glad cradle
#

learn it before creating a discord Bot (you should also learn other things)

sick birch
#

Could we see the Leave class?

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

glad cradle
#

πŸ˜•

except:
        return
livid jacinth
#

Hey i try to make a command to change the highest role of a user. How can i set that the arg should be the color?

@bot.command()
async def c(ctx, arg):
    print("check 1")
    member = ctx.author
    roles = member.roles 
    roles.reverse() 
    top_role = roles[0]
    await top_role.edit(colour=discord.Colour.arg())
    print("check 2")
unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

livid jacinth
#

can anyone help me?

fading marlin
livid jacinth
fading marlin
#

!d discord.ext.commands.ColourConverter you can use this converter then

unkempt canyonBOT
#

class discord.ext.commands.ColourConverter(*args, **kwargs)```
Converts to a [`Colour`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour "discord.Colour").

Changed in version 1.5: Add an alias named ColorConverter

The following formats are accepted...
livid jacinth
#

No I just want to write e.g. -c purple to set the role color to purple

fading marlin
#

that's what the converter does...

glad cradle
#

sup

livid jacinth
slate swan
silk fulcrum
#

Colour πŸ’€

slate swan
#

!d discord.ext.commands.ColourConverter.convert

unkempt canyonBOT
#

await convert(ctx, argument)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The method to override to do conversion logic.

If an error is found while converting, it is recommended to raise a [`CommandError`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError") derived exception as it will properly propagate to the error handlers.
silk fulcrum
#

discrimination

slate swan
#

bri'ish bot

livid jacinth
#

But I cant use this variable

mossy jacinth
#

i still need help sending the modal answers to a channel or me in dms...

slate swan
#

hi guys is there a way i could check if people are spamming too many commands and tell them to slow down or somehow stop them from ratelimiting the bot

digital field
#

any hikari users?

silk fulcrum
silk fulcrum
unkempt canyonBOT
#

await send_modal(modal, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Responds to this interaction by sending a modal.
mossy jacinth
silk fulcrum
silk fulcrum
livid jacinth
#

How can i set the color to arg?

@bot.command()
async def c(ctx, arg):
    print("check 1")
    member = ctx.author
    roles = member.roles 
    roles.reverse() 
    top_role = roles[0]
    await top_role.edit(colour=discord.Colour.arg())
    print("check 2")
digital field
mossy jacinth
vocal snow
#

and pass it as is

silk fulcrum
vocal snow
#

check ColorConverter doc

silk fulcrum
#

ohkay

livid jacinth
#

But i dont know how i can use the the color converter

livid jacinth
#

Or show me that

vocal snow
#

just typehint the arg to discord.Color

livid jacinth
#
 await top_role.edit(colour=discord.Colour.arg())
vocal snow
#

please listen to what im saying 😭

livid jacinth
#
 await top_role.edit(colour=arg())

so? I dont get it?

livid jacinth
# vocal snow this is typehinting arg to int
@bot.command()
async def c(self, ctx, arg: int):
    print("check 1")
    member = ctx.author
    roles = member.roles 
    roles.reverse() 
    top_role = roles[0]
    await top_role.edit(colour=discord.Colour.__init__())
    print("check 2")

Like that?

vocal snow
#

oh my god

vocal snow
livid jacinth
#

I dont understand it

#

Please show me what you mean

hidden haven
#

Is there a nice little guide or gallery floating around showcasing all the ways possible to style embeds and normal text messages beyond just raw function documentation? Specifically for discord.py

vocal snow
livid jacinth
#

Yes ig

vocal snow
#

so

#

typehint the parameter to discord.Colour

#

discord.py will convert the parameter to that type before it is passed to the command callback

livid jacinth
#

Okay but i dont know what i have to do

vocal snow
#
arg: discord.Colour
#

color=arg

livid jacinth
#

Ah okay i know

vocal snow
livid jacinth
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Colour' object is not callable

I get this error

vocal snow
#

code?

livid jacinth
#
@bot.command()
async def c(ctx, arg: discord.Colour):
    print("check 1")
    member = ctx.author
    roles = member.roles 
    roles.reverse() 
    top_role = roles[0]
    await top_role.edit(color=arg())
    print("check 2")
vocal snow
#

so why are you calling arg

livid jacinth
#

What else should I call?

vocal snow
#

don't call anything

livid jacinth
#

Ah okay it works

#

Thank you !

slate swan
#

any1 have a code pokemon

vocal snow
slate swan
#

Can someone put me out of my misery please.

I am using cogs for the first time today, and while adapting my code I have noticed my old code such as client.fetch_user(id) no longer runs past this point.
I believe this to be because having cogs means i need to change all my client.command() etc to commands..command, but when i change client.fetch_user(id) to commands.fetch_user(id) it stops running, no errors displayed either.

Does anyone know why this is?

Code:

        for amt in total:
            id_ = leader_board[amt]
            print('a')
            member = await commands.get_user(id_)
            print('b')
            name = member.name
            pres = users[str(member.id)]["prestige"]```

Entire Output:
```py
>>> Logged in as: AgriCult BETA#2797
>>> a
>>> 
primal token
slate swan
primal token
sick birch
hidden haven
#

What is the best way to 'separate' iterations while still maintaining output in one single embed while using a for loop? I tried embed.add_field(name='a', value= "\n\u200b") -> but I don't want a title and it doesn't really add a space in the way that I want (which is to break up each iteration by a horizontal space or, better yet, some dashed line indicator)

slate swan
# sick birch Do you have any error handlers? Your `client` isn't defined, but you're not gett...

For error handling I have:

    @commands.Cog.listener()
    async def on_command_error(self, ctx, error):
        if isinstance(error, commands.MissingRequiredArgument):
            await ctx.send('Please pass in all required arguments.')

        if isinstance(error, commands.CommandNotFound):
            pass  
  
        if isinstance(error, commands.CommandOnCooldown):
            msg = '**Woah! That\'s too fast!** Please try again <t:{}:R>'.format(int(time.time() + error.retry_after))
            await ctx.send(msg, delete_after=5)

        if isinstance(error, commands.MissingPermissions):
            await ctx.send('You do not have sufficient permissions to use this command!')```
primal token
slate swan
primal token
#

!d str.join | is probably what youre looking for

unkempt canyonBOT
#

str.join(iterable)```
Return a string which is the concatenation of the strings in *iterable*. A [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") will be raised if there are any non-string values in *iterable*, including [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") objects. The separator between elements is the string providing this method.
primal token
sick birch
#

Currently all other errors are silently ignored, and that's a big no-no

slate swan
sick birch
#

Oh, and make sure you import traceback from the stdlib

hidden haven
#

No, I’m talking more about the layout of a modal itself

#

Like so

#

Inside a single modal

slate swan
sick birch
hidden haven
#

Oh sorry yes an embed

sick birch
#

Ah okay. You want sort of a table sort of deal going?

hidden haven
#

My current one outputs everything scrambled and not in an easy-to-read layout

#

Yes exactly

sick birch
#

It's going to be a bit difficult, because things look really weird on mobile, and on different computers zero-width characters will look really strange

#

I think you might want to re-consider how you want them displayed

hidden haven
#

Hm, okay, thanks

sick birch
slate swan
#

ah okay

#

gotcha now

sick birch
#

Do you have any other error handlers? If so, do the same things there

#

Global error handlers can come bite you in the arse if you're not careful

slate swan
#

It's now outputting
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.ext.commands' has no attribute 'fetch_user'

sick birch
#

There we go, we're getting errors now

slate swan
#

this has been an issue since day one for me

sick birch
#

Now you can do what noid suggested

slate swan
#

I've never had errors so I never knew what was the issue

sick birch
#

Bind the bot instance to the cog, then use it as self.bot

slate swan
#

idk what an instance is I'm sorry lol

sick birch
#
bot = commands.Bot(...)

this is your bot instance

slate swan
#

is it possible to get a users about me section with a discord bot

sick birch
unkempt canyonBOT
#

property activity```
Returns the primary activity the user is currently doing. Could be `None` if no activity is being done.

Note

Due to a Discord API limitation, this may be `None` if the user is listening to a song on Spotify with a title longer than 128 characters. See [GH-1738](https://github.com/Rapptz/discord.py/issues/1738) for more information.

Note

A user may have multiple activities, these can be accessed under [`activities`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.activities "discord.Member.activities").
slate swan
#

this?

#bot.py

client = commands.Bot(command_prefix='!', help_command = help_command)```
sick birch
# slate swan OHHHH

So something similar

class MyCog(commands.Cog):
  def __init__(self, bot: commands.Bot, ...) -> None:
    self.bot = bot
    ...

  @commands.command()
  async def my_command(self, ctx: commands.Context, ...) -> None:
    # you can use self.bot to reference the bot instance here

def setup(bot: commands.Bot):
  bot.add_cog(MyCog(bot))
#

That's traditionally how it's done. If you don't want to do all of that, you can also just use ctx.bot

slate swan
sick birch
slate swan
#

so that's what self does then

#

wondered how that worked

sick birch
#

self refers to the class instance

#

Itself, essentially

slate swan
#

yeah

sick birch
#

All non-@staticmethod, and all non-@classmethod will have the instance passed as the first variable to them

slate swan
#

what's the difference?

sick birch
slate swan
#

staticmethod and classmethod

sick birch
#

Not relavant for our usecase, but the more you know the better. Static methods are methods that are part of your class but don't really need an instance. You can just call them like this:

class MyClass:
  @staticmethod
  def static_method():
    ...

MyClass.static_method()
#

Class methods let you construct a class from some given information:

class MyClass:
  @classmethod
  def class_method(cls):
    return cls(...)
slate swan
#

ah, alright

sick birch
#

But your regular function:

class MyClass:
  def regular_method(self):
    ...

must always take self as the first argument

#

Same thing with cogs: self first, ctx after

slate swan
#

that I've to be the most annoying

#

adapting my whole bot for cogs and then not knowing why they dont work

#

because i didnt include self

sick birch
#

Well, now you know why they don't work

sick birch
#

You expect your context to be of type commands.Context but it's actually the instance

slate swan
sick birch
#

But we've got your errors fixed so now you should know why something's wrong

sick birch
slate swan
#

I had this about 2 hours ago

#

I didn't add self, so ctx would have become self right?

#

and that's why it errored?

sick birch
#

Exactly

slate swan
#

robin with the member.activity and user.status it always returns as None and Offiline even when there online and i can see there activity

#

πŸ€¦β€β™€οΈ I'm an idiot

#

i have intents enabled

sick birch
slate swan
glad cradle
# unkempt canyon

as it is written here it can be none if the user is listening to something on spotify with a title longer than 128char

sick birch
slate swan
#

it is

slate swan