#discord-bots

1 messages Β· Page 1135 of 1

static topaz
#

So I already have another bot running that handles requests, this would simply be for users to track their favourite shows and be notified when a new episode is available :) currently the code I have checked the sonarr API for upcoming episode info as well as existing files in the library. It's storing and reading data from a sqlite3 db as well. If you like when I get home from dinner i can send through the existing files for clarity?

loud junco
#

πŸ‘€

slate swan
loud junco
slate swan
#

discord.pys repo link? what about it

loud junco
#

ei no

slate swan
#

pip install -U git+https://github.com/Rapptz/discord.py

slate swan
slate swan
#

oh hydro you wanted the full link?😭

loud junco
#

realising i cant copy paste in shell

#

πŸ’€

slate swan
#

πŸ˜”

slate swan
loud junco
slate swan
loud junco
slate swan
loud junco
#

technically yes and no

slate swan
loud junco
#

my bod 9/12/06

#

;-;

slate swan
#

damn hydro is older than me >:(

loud junco
slate swan
#

no wonder I'm still immature

loud junco
slate swan
#

im going to be 16 in jan :(

loud junco
#

elder kekw

loud junco
slate swan
loud junco
slate swan
#

lucky

loud junco
#

hi sarth

slate swan
#

sarth😍

slate swan
#

just in case you want to not use your mouse

loud junco
slate swan
#

same ig

loud junco
#

whatever

slate swan
#

i hate using my mouse

loud junco
slate swan
slate swan
loud junco
slate swan
shrewd apex
slate swan
slate swan
#

yeah sarthak is with me πŸ˜” oki keep waiting

#

hun bun better

slate swan
#

πŸ˜‰

shrewd apex
slate swan
#

I hate git bash πŸ˜”

#

ASscary just don't use ur desktop then, sleep.

#

i love git

#

i use github desktop

loud junco
slate swan
#

but not bash, zsh>>>>

#

zsh?

dusky pine
#

pwsh > *

slate swan
#

me rn: lemon_imp

#

ew

slate swan
slate swan
slate swan
#

!ot

unkempt canyonBOT
slate swan
#

:(

loud junco
slate swan
#

!get-a-pfp

dusky pine
#

zsh is the shit that make yo terminal look like this

loud junco
shrewd apex
#

i used both git cli and the desktop

slate swan
#

ok

#

😑 I don't want any pfp

#

noob anime pfp

#

sparky was an amonger now hes a discord logo

#

πŸ˜”

dusky pine
#

everyone has anime pfp except for me and sparky

slate swan
#

yes

#

imagine having an anime pfp

#

Ye

#

go touch some grass😹

#

very...

loud junco
shrewd apex
#

how does anime pfp and noob relate

slate swan
#

c'mon Sparky, you're sharing your pfp with thousands of ppl, get something unique

slate swan
#

࢞࢞࢞࢞࢞࢞࢞
࢞@slate swan ࢞
࢞࢞࢞࢞࢞࢞࢞
sparky has been surrounded

#

Cringe

slate swan
#

No I'm not

loud junco
#

this is not the sparky that i remember

slate swan
#

I'll go before it becomes the war channel

loud junco
#

πŸ‘€

slate swan
#

sparky was a cool amonger now hes plainer than a minecraft plain

loud junco
shrewd apex
#

guy will be moving on his ass

slate swan
#

Hydro

#

why tf is my alt account beign shown as the contr 😭 helppp

#

you didn't have to say that

loud junco
shrewd apex
loud junco
#

i think everyone know its a read at ur own risk thing

#

🀣

slate swan
slate swan
slate swan
#

I just created the repo rn

shrewd apex
#

make another edit with ur main acc and commit

slate swan
#

hm lemme try

dusky pine
#

we gotchu

#

i got a unique pfp

slate swan
loud junco
slate swan
#

okimii u play minecraft M

loud junco
slate swan
slate swan
loud junco
slate swan
loud junco
shrewd apex
#

kekw

slate swan
#

i don't get spoilers cause i turned them off from settings

#

minecraft command syntax > assembly syntax

slate swan
dusky pine
#

C is easier than mc cmds

slate swan
#

MC cmds are ez I have created tons of builds with it

loud junco
shrewd apex
slate swan
slate swan
dusky pine
#

sm1 should make programming language that compiles to mc

slate swan
shrewd apex
slate swan
#

or just add a PewDiePie pfp like an average 15yo

slate swan
slate swan
slate swan
slate swan
slate swan
loud junco
shrewd apex
slate swan
slate swan
slate swan
#

πŸ’€

#

U play with npc

#

πŸ’€

loud junco
dusky pine
slate swan
slate swan
shrewd apex
loud junco
#

not gonna listen

slate swan
slate swan
slate swan
#

I'd rather listen to it all tbh, I love that song πŸ˜”

#

im an npc 😳

shrewd apex
#

in Minecraft

slate swan
slate swan
dusky pine
shrewd apex
#

lemme download em will listen later

slate swan
#

im not clicking any mp3 files bro

loud junco
slate swan
#

😀

dusky pine
#

is literally 200kb

slate swan
#

Okimii scared of ghosts

#

im not getting rick rolled

#

13 sec rickroll nice

slate swan
dusky pine
loud junco
shrewd apex
slate swan
#

imagine getting Rick rolled

slate swan
#

i trusted you

loud junco
shrewd apex
#

thats like the most vicious curse ever

loud junco
slate swan
robust fulcrum
slate swan
slate swan
#

why my bot no works :c

slate swan
loud junco
dusky pine
slate swan
#

avg depressed person

#

πŸ’€ okimii and me on fire

robust fulcrum
shrewd apex
#

indeed both of u are high

robust fulcrum
loud junco
shrewd apex
#

from lack of sleep

dusky pine
robust fulcrum
slate swan
loud junco
#

i slept 2 hours yesterday and i went to a 10 hours band training and a boring party

robust fulcrum
slate swan
#

Wumpus with the drip😼

robust fulcrum
slate swan
dusky pine
#

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

slate swan
#

@slate swan 😳

shrewd apex
#

btw who is technoblade and why do i see that on every status

robust fulcrum
#

He is yt

shrewd apex
robust fulcrum
#

He ded

slate swan
loud junco
shrewd apex
#

ic

slate swan
shrewd apex
#

sed

slate swan
robust fulcrum
#

My battery low

loud junco
shrewd apex
robust fulcrum
#

πŸ”‹

loud junco
#

pov: technoblade wakes up and challenge u to a 1v1

dusky pine
slate swan
#

technoblade was so uwu πŸ˜” I feel like crying

shrewd apex
robust fulcrum
slate swan
loud junco
robust fulcrum
#

I bored 😴

slate swan
#

you always dont need electricity

#

just need energy

slate swan
robust fulcrum
#

So turn on

slate swan
#

im out

shrewd apex
slate swan
#

πŸ’€ tf sz

robust fulcrum
#

πŸ˜΅β€πŸ’«

dusky pine
#

😭

robust fulcrum
#

😰

loud junco
#

πŸ‘€

shrewd apex
#

i am gonna await u

robust fulcrum
#

Go and sleep

shrewd apex
#

rip typos

loud junco
dusky pine
#

this chat is getting too weird

robust fulcrum
#

Ye

slate swan
#

okimii stop talking bro

loud junco
#

dude be creating python jokes 🀣

dusky pine
#

.topic

lament depotBOT
#
**What feature would you be the most interested in making?**

Suggest more topics here!

shrewd apex
#

all of us high now

loud junco
slate swan
slate swan
robust fulcrum
dusky pine
#

Sarth why does anya use mysql

#

Crying rn

slate swan
slate swan
slate swan
#

that's why it got highlighted lmao

dusky pine
#

clearly postgres better because yeah

slate swan
#

don't come to me with pgsql rants ffs

#

knew that

slate swan
#
/tp @s sarth's_house

guys why isnt my mc command working?πŸ˜”πŸ˜­

dusky pine
slate swan
dusky pine
# slate swan knew that

also you can add ignore_missing_imports = True to your mypy.ini to avoid those type: ignore on aiomysql

robust fulcrum
#

Tf is this chat becoming

slate swan
shrewd apex
slate swan
#

@slate swan 😳

#

nvm i need sleep

supple thorn
slate swan
slate swan
#

HOLD ON

dusky pine
robust fulcrum
#

Go and sleep you all

slate swan
#

what did he sayyyyy

dusky pine
slate swan
slate swan
loud junco
#

got dumped isit

shrewd apex
robust fulcrum
slate swan
#

guys i will only sleep in one condition

loud junco
dusky pine
slate swan
shrewd apex
supple thorn
loud junco
supple thorn
#

Cause mister

robust fulcrum
#

Go and listen music and sleep 😴

loud junco
shrewd apex
slate swan
dusky pine
#

what is love

supple thorn
robust fulcrum
loud junco
slate swan
#

if you guys help me with my complicated error

AttributeError: 'sarth' object has no attribute 'okimiis_love'

?

dusky pine
#

This chat cannot stop being a shithole

slate swan
robust fulcrum
loud junco
naive flower
#

how do i make a slash command bot? the

from discord import app_commands

doesnt work

slate swan
shrewd apex
dusky pine
#

#sus-playground

robust fulcrum
slate swan
shrewd apex
slate swan
#

sarth.py is the file πŸ˜” the class is Sarth

supple thorn
loud junco
supple thorn
#

Only love song i know that has mister is love is war

shrewd apex
#

πŸŽ‰

slate swan
loud junco
#

DUDE

slate swan
shrewd apex
slate swan
#

welcome

slate swan
slate swan
#

πŸ’€

loud junco
#

πŸ‘€

shrewd apex
#

sarth πŸ’ oki

loud junco
#

where is sarth from tho

dusky pine
slate swan
slate swan
slate swan
loud junco
slate swan
#

i live with sarth thats how i know hes telling the truth

slate swan
slate swan
dusky pine
#

l l
I I

#

wait
l 2 3 4 5

slate swan
#

how you know that?

shrewd apex
#

πŸ‘€

slate swan
#

wait did you escaped?

#

why is this channel so wild from the past half hour

#

!ot lets move to some other channel ig

unkempt canyonBOT
dusky pine
#

.topic whenever you guys are here this channel is fucked

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

slate swan
#

OK im done with my lunch

#

boi

slate swan
loud junco
slate swan
#

me too

#

I'm going to sleep now sooo good morning

loud junco
#

good morning

slate swan
#

gunnite ash anya_peek sweet dreams

slate swan
#

expet*

#

expect

#

epxecet*

#

except*

loud junco
#

dude really needs to sleep

slate swan
#

yeah expect

#

*expect

dusky pine
#

espresso*

loud junco
#

*sleep

dusky pine
#

iliveinyourwalls*

slate swan
#

STOP πŸ›‘

#

someone pls drop some real discord bots related question πŸ’€

#

i got you

shrewd apex
loud junco
slate swan
slate swan
dusky pine
loud junco
slate swan
#

@slate swan so i want to yeet a button to you so i know if you want to accept my marriage proposal, but only the yes button sends, that wasnt a mistake

#

😏

loud junco
slate swan
slate swan
loud junco
dusky pine
slate swan
dusky pine
#

Oki get out this channel

loud junco
slate swan
#

ooof

dusky pine
slate swan
#

lets move to some ot pls

dusky pine
#

!ot

unkempt canyonBOT
dusky pine
#

.topic

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

slate swan
dusky pine
slate swan
#

πŸ˜”

loud junco
#

aw

slate swan
#

Ew

#

an event which mutes oki whenever he starts with his timepass

dusky pine
#

I just remembered moderators can see deleted messages

slate swan
#

oh

#

who cares

#

about meπŸ˜”

#

mods

loud junco
#

and u wont see me after this

#

ever again

slate swan
#

well bye I'll go study and sleep

loud junco
slate swan
#

plot twist im a under cover mod reporting all of you guys to get banned by @unkempt canyon shipit

#

MODS

loud junco
dusky pine
#

mods are probably laughing their ass off in the hidden channels

slate swan
#

imagine

slate swan
slate swan
#

rip mpds

slate swan
slate swan
loud junco
#

rip mobs

shrewd apex
slate swan
dusky pine
slate swan
slate swan
slate swan
shrewd apex
slate swan
loud junco
#

πŸ‘€

slate swan
#

okimii go inside poke ball recharge urself

#

someone was about to sleep

shrewd apex
#

how bout i catch both u and sarth and put u both in the same ball

slate swan
slate swan
slate swan
slate swan
slate swan
dusky pine
#

Suck my pokeballs

slate swan
#

broπŸ’€

slate swan
#

Someone was about to study

#

someone was about to change their pfp

#

my laptops' booting

loud junco
slate swan
#

πŸ’€

#

ok final bye

loud junco
slate swan
loud junco
dusky pine
#

all of these jokes

slate swan
#

im being serious

dusky pine
#

one day, oki will fall in love with someone

slate swan
slate swan
dusky pine
#

🀨

loud junco
slate swan
loud junco
slate swan
#

sorry im toxic

#

okimii trying to get sarth back

#

in chat

#

i control him allot but he loves it for some reason

loud junco
#

sus

slate swan
#

Β―_(ツ)_/Β―

#

bro whos this craig bot

#

okimii you cheated on hunter, you wh-

slate swan
#

@slate swan go sleep or phantoms will come

#

hes sleeping

slate swan
loud junco
slate swan
#

just pray to Yato 😳

#

pray to me

#

Who tf is yato

#

no Yato is hotter

#

😼

slate swan
# slate swan Who tf is yato
Noragami Wiki

Yato (倜 (γ‚„) γƒˆ (と) , Yato), also known by his given name, Yaboku (倜 (γ‚„) γƒˆ (ぼく) , Yaboku), is one of the main three protagonists of Noragami. He is an obscure god who aims to become a God of Fortune. In the past, he was known as a God of Calamity. Yato appears to be a young man in his late teens to early twenties with a height of 173cm (5’7”).[cit...

#

itachi > yato

loud junco
slate swan
#

Anime ew

slate swan
loud junco
slate swan
loud junco
slate swan
#

pikachu > every anime character

slate swan
#

i see

#

mhm

#

Who tf is genjutsu now

slate swan
slate swan
slate swan
slate swan
#

Doremon

#

guys lets be honest, sarth > any anime char

shrewd apex
#

pfft

loud junco
slate swan
loud junco
slate swan
loud junco
#

DUDE

#

sarth is literally here

#

no wonder sarth wont go out for a date with u

slate swan
slate swan
shrewd apex
#

sarth is our unit of measurement

slate swan
#

lmaooo

slate swan
#

OK im pinging mods

shrewd apex
loud junco
slate swan
#

please

#

watch sparky get banned

#

<@&831776746206265384> pls control so much ot

loud junco
#

!ot

unkempt canyonBOT
loud junco
#

nigerundayo

slate swan
#

Β―\_(ツ)_/Β―

#

.topic

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

loud junco
#

🀣

visual yarrow
#

Hello everyone. Please stick to the channel topic. For anything else, there are off-topic channels.

slate swan
#

Haha

#

imagine we all get muted

#

ash shhh

#

Rip

#

okay god

#

back to topic

loud junco
#

yes

#

btw i built a bot that day

slate swan
#

nice

loud junco
#

and it did that and this and that

slate swan
#

petition to increase slowmode delay

#

nice

loud junco
#

its kinda fun right?

slate swan
slate swan
#

idc

#

make the slowmode an hour long

loud junco
loud junco
slate swan
#

anyways, get back to topic before the channel gets !shhhhed

slate swan
loud junco
#

aright

#

!shhhh

#

whats that

slate swan
#

!locl

unkempt canyonBOT
#

Thanks to discord.py, sending local files as embed images is simple. You have to create an instance of discord.File class:

# When you know the file exact path, you can pass it.
file = discord.File("/this/is/path/to/my/file.png", filename="file.png")

# When you have the file-like object, then you can pass this instead path.
with open("/this/is/path/to/my/file.png", "rb") as f:
    file = discord.File(f)

When using the file-like object, you have to open it in rb mode. Also, in this case, passing filename to it is not necessary.
Please note that filename can't contain underscores. This is a Discord limitation.

discord.Embed instances have a set_image method which can be used to set an attachment as an image:

embed = discord.Embed()
# Set other fields
embed.set_image(url="attachment://file.png")  # Filename here must be exactly same as attachment filename.

After this, you can send an embed with an attachment to Discord:

await channel.send(file=file, embed=embed)

This example uses discord.TextChannel for sending, but any instance of discord.abc.Messageable can be used for sending.

slate swan
#

Shesh

#

im going to sleep LX so this channel wont go off topic again, right?lemon_raised_eyebrow

#

imma sleep too now fr

loud junco
slate swan
#

Good night guys πŸ‘‹

slate swan
loud junco
shrewd apex
#

goodnight

slate swan
loud junco
#

good morning

slate swan
slate swan
#

yes morning now good night

slate swan
loud junco
slate swan
#

😭

visual yarrow
#

!silence

unkempt canyonBOT
#

βœ… silenced current channel for 10 minute(s).

visual yarrow
#

Guys...

#

This channel is just for talking about Discord bots.

#

Please move your conversation over to one of the off-topic channels.

#

I will hand out mutes!

#

!unsilence

unkempt canyonBOT
#

βœ… unsilenced current channel.

visual yarrow
#

Also, not an appropriate topic of conversation for this server.

dusky pine
#

mods can see deleted msgs?

visual yarrow
dusky pine
#

oh

slate swan
#

Yo

#

me rn: i am innocentπŸ™‚

loud junco
shrewd apex
loud junco
slate swan
slate swan
slate swan
slate swan
#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

slate swan
#

Channel lock

loud junco
#

sounds like a feature all mod bot has

slate swan
#

Hi

#

ghost ping smh

#

again tf

pure crypt
#

Does bot.get_channel(β€œChannelName”) works?

spring flax
#

nope

slate swan
#

No

spring flax
#

you need to pass an channel ID

slate swan
#

you've got to use utils.get or utils.find for a name

#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Changed in version 2.0: The `iterable` parameter is now positional-only.

Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
robust fulcrum
#

What happened here?

slate swan
#

Itrrable as discord channel

#

And atts as name=

pure crypt
#

Then discord.utils.get_channel(β€œChannelName”)?

slate swan
#

@slate swan is there a way to check how two Message objects differ? πŸ˜”

#

i got ratelimit hard because of reactions having a 2/1s ratelimit iirc so now im using a vpn to avoid the ratelimitation lol

#

lol

slate swan
# slate swan their ids

No I mean, their uh.....changes?
like message one has embeds and message two does not, so without actually using conditionals for every message attr

#

I know smh

#

you mean changes as the changes of their contents?

slate swan
#

you can compare embed objects too iirc

#

I uhh nvm

#

ig you can compare objs and if the message obj has them

#

there's no Direct way to compare 2 messages 😦

#

hm ic

robust fulcrum
#

Is there any library to check that message is not toxic or insulting?

shrewd apex
#

perspective api

robust fulcrum
#

Any other?

shrewd apex
#

what key?

slate swan
#

i think he ment auth key

#

to authorize each rq

shrewd apex
#

so get one

slate swan
#

lol

shrewd apex
#

its free anyway Β―_(ツ)_/Β―

slate swan
#

┬─┬ γƒŽ( γ‚œ-γ‚œγƒŽ)

hardy yoke
loud junco
#

btw u can just use that

#

and use if else to get the job done

steep pelican
#

Since cogs can be reloaded without having to stop the bot, is there a way to reload main.py like the cogs?

slate swan
#

no unless it's a cog too

steep pelican
#

Ok

steep pelican
#

Thx

loud junco
steep pelican
#

I updated the code

kindred oracle
#

If you read the whole thread I went to use the dev version after all

steep pelican
#

But I don't wanna restart it on terminal but in command like cogs

#

What's the difference between pycord and d.py

#

Aren't they the same

vocal snow
#

no

patent lark
steep pelican
#

I'm gonna guess pycord is made by inexperienced programmers

patent lark
#

maybe i was too harsh

vocal snow
#

idiots is too harsh. Inexperienced programmers is more accurate

steep pelican
#

Oh so that's the one that got discontinued?

patent lark
#

exactly what i was going to correct myself with ^

steep pelican
#

Which one got discontinue

patent lark
#

discord.py got discontinued for a bit. this is why pycord was made.

steep pelican
#

Ohhh ok

#

Why'd d.py get discontinued

#

Also sorry for too much questions xd

patent lark
#

check out the github that explains

#

dannys github.

steep pelican
#

Oh he owns it

hardy yoke
steep pelican
#

Yeah my mistake

#

I'll probably move the code to cogs

patent lark
#

good idea

steep pelican
#

But wait_for doesn't work in cogs last time I tried

dusky pine
patent lark
#

it does.

steep pelican
#

I wonder what I did wrong

#

Cuz when I moved the code to main.py it worked

patent lark
#

perhaps you didnt set up your cog correctly

#

or make according changes to run the code in cogs

hardy yoke
#

I don't use wait_for but you probably forgot the self? self.bot.wait_for

slate swan
patent lark
#

the error you received should have told you everything.

slate swan
steep pelican
patent lark
#

that kills me

#

do not define your bot (discord.ext.commands.Bot) as "client"

steep pelican
#

Oh wait

patent lark
#

unless you're using discord.Client()

#

for whatever reason

steep pelican
#

self.client = client

#

Is that the one that I only need

dusky pine
#

idk why people still name their Bot instance client

shrewd apex
#

yt

patent lark
patent lark
steep pelican
#

I took it from a yt tutorial and stuck with it

dusky pine
#

youtube is frfr

patent lark
#

copying code from youtube is your first big mistake

dusky pine
#

YouTube is your mistake

patent lark
#

big mistake

dusky pine
#

YouTube Discord bots is a mistake

hardy yoke
#

yeah basically the end of the world if you use youtube

patent lark
#

yep.

hardy yoke
dusky pine
steep pelican
#

Inside the class

hardy yoke
#

yh

steep pelican
#

Ok yep

#

I'm gonna refresh the bot

shrewd apex
#
from discord.ext import commands

class Cog(commands.Cog):

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

async def setup(bot: commands.Bot) -> None:
    await bot.add_cog(Cog(bot))
#

thats all u need

steep pelican
#

What does -> do

slate swan
#

it tells you the function return type

steep pelican
#

Okk

slate swan
#
def foo() -> int:
  return 69
``` the function is returning an integer, so its annotated with int
patent lark
#

it has no change in how your code runs, see it as a typehint

slate swan
#

just helpful for linting

steep pelican
#

What's linting

#

Damn I should learn more

shrewd apex
slate swan
patent lark
#

if you say replit

shrewd apex
#

it will show expected blah, blah....

steep pelican
patent lark
#

thank you.

steep pelican
#

and pydroid3

shrewd apex
#

still better than replit

patent lark
#

mhm.

steep pelican
#

I don't like replit

patent lark
#

good.

steep pelican
#

So complicated

#

And you need to pay for private code

dusky pine
#

yeah... and you bought a VPS right?

#

riiiiight?

patent lark
#

no need - uPtImErObOt

hardy yoke
#

pycharm was too bulky for me, I jus use sublime lol

steep pelican
patent lark
#

vsc is the move

slate swan
# steep pelican Pycharm

type py a = "string" in a .py file, if you hover on it, it gives some documentation about class str, now when you add a . after it, you will find your IDE auto-completing functions for you, thats basically what the type hints work for

steep pelican
#

Also does on_message need self?

dusky pine
patent lark
#

no

steep pelican
slate swan
steep pelican
#

Gonna try the bot now

#

I'm getting a client is undefined error

shrewd apex
#

show ur code

steep pelican
#
@client.event
async def on_message(message):
    channelid = message.channel.id
    ctx = await client.get_context(message)
    if channelid == 886796749258235954:
        
        if message.author != "USAHQ Bot#352":
            await message.add_reaction(u"\u2705")
            
            
        def check(filler, m):
            return m != "USAHQ Bot#352"
            
            
        reaction, user = await client.wait_for("reaction_add", check=check)

        user_roles = [i.name for i in user.roles]
        permitted = False
        for i in ["USAHQ | Operator", "USAHQ |πŸ“› Executive OperatorπŸ“›", "USAHQ |πŸ›‘ModeratorπŸ›‘"]:
            if i in user_roles:
                permitted = True
                break

        if permitted:
            unverified = get(ctx.guild.roles, name="❌unverified❌")
            verified = get(ctx.guild.roles, name="βœ…VERIFIEDβœ…")
            member = message.author
            await member.remove_roles(unverified)  # Removes unverified role
            await member.add_roles(verified)
            await ctx.reply("You are now verified!")
    await client.process_commands(message)```
shrewd apex
#
@commands.Cog.listener()
async def on_message(self, message: discord.Message) -> None:
    channelid = message.channel.id
    ctx = await self.client.get_context(message)
    if channelid == 886796749258235954:
        if message.author.name != "USAHQ Bot#352":
            await message.add_reaction(u"\u2705")
        reaction, user = await client.wait_for("reaction_add", check=lambda i: i.name != "USAHQ Bot#352")
        user_roles = [i.name for i in user.roles]
        permitted = False
        for i in ["USAHQ | Operator", "USAHQ |πŸ“› Executive OperatorπŸ“›", "USAHQ |πŸ›‘ModeratorπŸ›‘"]:
            if i in user_roles:
                permitted = True
                break
        if permitted:
            unverified = get(ctx.guild.roles, name="❌unverified❌")
            verified = get(ctx.guild.roles, name="βœ…VERIFIEDβœ…")
            member = message.author
            await member.remove_roles(unverified)  # Removes unverified role
            await member.add_roles(verified)
            await ctx.reply("You are now verified!")
steep pelican
#

Oh so that's what a listener does

#

It works

#

So I got another error

#

Actually the same error

#

Nvm

#

Do I have to do self.client all the time?

hardy yoke
#

if you're in a cog, yes

steep pelican
#

Can't I just do

client = self.client```
?
slate swan
#

yeah ofcourse inside your function do that, it will still work, but why

steep pelican
#

it's easier

#

I don't wanna keep doing self.cient

#

maybe I'm just lazy

slate swan
#

πŸ—Ώ

loud junco
steep pelican
#

Why isn't ```ctx = await self.client.get_context(message)```` working

I did self.client so why is it still giving me the client is undefined error

steep pelican
steep pelican
upbeat gust
#

wheres that? cog init?

#

cogs dont take client, name your variables properly smh

steep pelican
#

Yep in the cog init

#
        self.client = client```
upbeat gust
#

and the setup function?

steep pelican
#

Ok I think that's the error

#

Gonna try it

upbeat gust
#

dont do client = commands.Bot() and make things confusing for everyone

steep pelican
#

It works

#

I used this "replace all" tool

#

And messed up the code

#

My bad

steep pelican
#

Anymore

upbeat gust
steep pelican
#

Bruh

#

So just don't name it client or bot

#

Actually just don't name it as the bot var from the main.py

rain olive
steep pelican
#

Yeah

#

I'll keep it as client for this bot but will name it bot for new discord bots

rain olive
#

rework ur code

slate swan
#

you can just ctrl+f ctrl+r ;-;

steep pelican
#

Why does commands get run twice

#

Like u!ping runs twice

slate swan
#

you should not have process_commands inside a listener

steep pelican
#

Ok

#

But now I'm curious, why does it make functions run twice

dusky pine
steep pelican
#

Ohh

#

Also message.author returns a user variable right?

dusky pine
#

!d discord.Message.author

unkempt canyonBOT
dusky pine
#

yep

slate swan
#

its returns a Union of Member and User

#

depending upon where the message was sent

steep pelican
dusky pine
#

on_message literally takes a discord.Message

steep pelican
#

Oh ok

#

So that means if I do message.author.roles it should return a list of roles right?

slate swan
#

if the command was used/message was sent in a server, yes

steep pelican
#

Ok

fallow girder
#

I wrote this Code, everything seems fine, when I run the bot, there are no errors. The terminal is blank, but when I run this command, it doesn't work, it doesn't send a response, there is no error in the terminal also.

@bot.command()
async def serverinfo(ctx):
    embed = discord.Embed(title=f"{ctx.guild.name} Info", description="Information of this Server", color=0x4c8d5c)
    embed.add_field(name=':id:Server ID', value=f"{ctx.guild.id}", inline=True)
    embed.add_field(name=':calendar:Created On', value=ctx.guild.created_at.strftime("%b %d %Y"), inline=True)
    embed.add_field(name=':crown:Owner', value=f"{ctx.guild.owner.mention}", inline=True)
    embed.add_field(name=':busts_in_silhouette:Members', value=f'{ctx.guild.member_count} Members', inline=True)
    embed.add_field(name=':speech_balloon:Channels', value=f'{len(ctx.guild.text_channels)} Text | {len(ctx.guild.voice_channels)} Voice', inline=True)
    embed.add_field(name=':earth_americas:Region', value=f'{ctx.guild.region}', inline=True)
    embed.set_thumbnail(url=ctx.guild.icon_url) 
    embed.set_author(name=f'{ctx.author.name}', icon_url=ctx.message.author.avatar_url)
    await ctx.message.delete()   
    await ctx.send(embed=embed)
supple thorn
#

Also it's not avatar_url

#

It's avatar.url

fallow girder
supple thorn
fallow girder
fallow girder
supple thorn
#

Makes sense if you aren't on 2.0

fallow girder
#

I'm not in the 2.0 version of discord.py but 1.7.3 I believe

supple thorn
fallow girder
#

No

#

I have no error message

slate swan
#
# ΠšΠ”
    @commands.command(aliases = ["ΠšΠ”", "ΠšΠ”Π”"])
    @commands.cooldown(2, 60, commands.BucketType.user)
    @commands.cooldown(1, 5, commands.BucketType.user)
    async def command_CD(self, ctx):
        await ctx.send("Π•ΡΡ‚ΡŒ ΠΏΡ€ΠΎΠ±ΠΈΡ‚ΠΈΠ΅")

Dear. is there a way to make it so that the command can be used 1 time every 5 seconds and 2 times every 60 seconds? My team only reads one cooldown line

supple thorn
fallow girder
#

Nope

supple thorn
#

Of adding a print statement in the command

#

To see if it's even being invoked at all

fallow girder
#

I've never used this method personally I'm not sure how it works

supple thorn
#

Well technically the code

hardy yoke
#

if you do then yes, if you don't then no

#

see this for inspo

fallow girder
#

Nothing prints

#

When I do: print(embed)

slate swan
hardy yoke
slate swan
#

AttributeError: 'Member' object has no attribute 'add_role'

What is the correct way to do this?
I am doing it like this: await ctx.author.add_role(member_role)

robust fulcrum
fallow girder
#

Not all prints run

#

I may have found the problem

mighty heath
#

anyone help me in this?
/home/runner/Vejita/venv/lib/python3.8/site-packages/schedule/init.py: 100 : RuntimeWarning: coroutine 'msg_Send' was never awaited
self._run_job(job)
Object allocated at (most recent call last):
File "/home/runner/Vejita/venv/lib/python3.8/site-packages/schedule/init.py", lineno 661
ret = self.job_func()

mighty heath
dusky pine
#

When you are calling that function, add await before it

mighty heath
dusky pine
#

please put await before calling asynchronous functions

dusky pine
#

remove tracemalloc.start

#

why did you even put that there

mighty heath
dusky pine
mighty heath
#

Ignoring exception in on_ready
Traceback (most recent call last):
File "/home/runner/Vejita/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 58, in on_ready
await schedule_job("secs",5)
File "main.py", line 48, in schedule_job
await schedule.every(interval).seconds.do(msg_Send)
TypeError: object Job can't be used in 'await' expression

now this is exception

dusky pine
#

in the schedule.every line

mighty heath
mighty heath
#

I have tried a lot, by referring online forums but not get it

dusky pine
#

no keep the await in the msg_Send()

#

just this line

await schedule.every ...
^^^^^

mighty heath
slate swan
#
    def custom_cooldown(self, interaction: discord.Interaction):
        if interaction.user.id != self.id:
            return None
        else:
            return commands.Cooldown(1, 30)
        
    @discord.ui.button( emoji = f"{e_eco_work}", style=discord.ButtonStyle.green, row=1, disabled=False)
    @commands.dynamic_cooldown(custom_cooldown, commands.BucketType.user)
    async def b_work(self, interaction: discord.Interaction, button: discord.ui.Button):
        if interaction.user.id != self.id:
            await interaction.response.send_message(content="Π’Ρ‹ Π½Π΅ Π°Π²Ρ‚ΠΎΡ€ сообщСния", ephemeral=True)
        else:
            await interaction.response.send_message(content="123", ephemeral=True)

Dear, tell me why the cooldown does not work? button can be pressed continuously

static topaz
#

ok so kinda good news for those playing along at home:

I managed to fix all the errors that were showing up, and the bot is now running. That works fine. I now can't get the bot to react when I enter the prefix in the discord server itself

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.

static topaz
#

I'll be honest, the docs for discord.py confuse the heck out of me haha

cloud dawn
#

It's one of the more well documented library ducky_dave

shrewd apex
cloud dawn
#

I think there are sufficient examples in the docs.

#

You also got the examples in the main branch.

slate swan
#

is it possible to check how many people an specific user invited

#

big brain guy

cloud dawn
#

You can track it but you can't know how many users a specific user invited. Unless you have been tracking it since the creation of the guild.

heady sluice
#

you can track invites in the audit logs, save the invites as objects, every invite has a creator and every join has an invite which was used

#

tracking after tracking

#

at least that's what I know you have to do, never tried it

unkempt canyonBOT
#

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

Returns a list of all active instant invites from the guild.

You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to get this information.
heady sluice
#

oh you don't have to save the invites

cloud dawn
#

Audit log invites could be expired as well.

slate swan
#

you do, because invites can get revoked and removed from Guild.invites

cloud dawn
#

And iterating trough an audit log, errr.. I don't recommend it.

slate swan
#

tbh discord should allow checking that

#

helpful in moderation ;-;

#

Yeah

#

they can just add it as a field in the member object

heady sluice
#

so we talking about discord or dpy now

cloud dawn
#

Both

slate swan
cloud dawn
#

!d discord.on_invite_create

unkempt canyonBOT
#

discord.on_invite_create(invite)```
Called when an [`Invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite "discord.Invite") is created. You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to receive this.

New in version 1.3.

Note

There is a rare possibility that the [`Invite.guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite.guild "discord.Invite.guild") and [`Invite.channel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Invite.channel "discord.Invite.channel") attributes will be of [`Object`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Object "discord.Object") rather than the respective models.

This requires [`Intents.invites`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.invites "discord.Intents.invites") to be enabled.
slate swan
supple cobalt
#

im having a problem with the await and return command

cloud dawn
#

Never seen button cooldowns.

cloud dawn
# cloud dawn Never seen button cooldowns.

If I would make it I would probably just disable the button for x amount of seconds then re-enable it when they are allowed to use it again. People can't spam what they can't click πŸ’

supple cobalt
#

can someone help me with the await and return command?

supple cobalt
#

if message.author == client.user:
return

if message.channel.name == "testing-1":
if user_message.lower() == "hello":
await message.channel.send == (f'Hello {username} !')

#

await and return are unknown

cloud dawn
#

Unknown as in?

viral dock
#

I am trying to make commands for my Discord bot. Does someone know how to fix this error?:
File "main.py", line 22
await message.channel.send('Hello!')
^
SyntaxError: 'await' outside function

This is my whole code:

#imports
import discord
import os

client = discord.Client()

#running bot account
client.run(os.getenv('DISCORD_TOKEN'))

#botcommand
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

#command Hello
@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith("*Hello"):
await message.channel.send('Hello!')

slate swan
#

single space indents πŸ’€

#

uwu

supple cobalt
slate swan
#

And await

#

Ur indents

viral dock
#

oooh yeah sorry I am a beginner

slate swan
#

No πŸ‘

#

!indents

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

U can read this its helpfull

viral dock
#

okay

supple cobalt
prime marten
#

please help

So I made a discord bot, it works with sqlite3, uploaded it to heroku. When I download the repository, the database file remains unchanged, although I made changes in the bot. I made the bot output the database values - and they were changed, but when I downloaded them , there were no changes. How do I download the sqlite3 database file from heroku?

shrewd apex
#

u cant

#

u can connect with link and view from some db viewer tho

unkempt canyonBOT
#

Hey @viral dock!

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

viral dock
#

I am trying to make commands for my discord bot. When I type *Hello in my discord server the bot doesn't respond. Someone know the problem?

#imports
import discord
import os

client = discord.Client()

#running bot account
client.run(os.getenv('DISCORD_TOKEN'))

#botcommand

#command Hello
@client.event
async def on_message(message):
if message.author == client.user:
return

if message.content.startswith("*Hello"):
await message.channel.send('Hello!')

if message.content.startswith("*Hello"):
await message.channel.send('Hello!')

cursive spindle
#

Extension 'cogs.administrator' raised an error: TypeError: object NoneType can't be used in 'await' expression
Enable tracemalloc to get the object allocation traceback

async def load_extensions():
    for filename in os.listdir(".\cogs"):
        if filename.endswith(".py"):
            bot.load_extension(f"cogs.{filename[:-3]}")

async def main():
    async with bot:
        await load_extensions()
        await bot.start(TOKEN)
asyncio.run(main())

Python 2.0 version

viral dock
#

nm

cursive spindle
#

btw do not use on_message event for create commands

#

use @bot.command

robust fulcrum
#

Guys how can we make a email notify in dpy bot?

viral dock
cursive spindle
#
@bot.command()
async def test(ctx):
    await ctx.send("hello")
#

try this and remove on_message event

robust fulcrum
#

@shrewd apex can I ask some thing?

#

Is it possible to make a bot that dm me when i get a email?

shrewd apex
#

use the gmail api

cursive spindle
robust fulcrum
slate swan
#

yes

shrewd apex
robust fulcrum
#

Thanks for help

slate swan
#
    def custom_cooldown(self, interaction: discord.Interaction):
        if interaction.user.id != self.id:
            return None
        else:
            return commands.Cooldown(1, 30)
        
    @discord.ui.button( emoji = f"{e_eco_work}", style=discord.ButtonStyle.green, row=1, disabled=False)
    @commands.dynamic_cooldown(custom_cooldown, commands.BucketType.user)
    async def b_work(self, interaction: discord.Interaction, button: discord.ui.Button):
        if interaction.user.id != self.id:
            await interaction.response.send_message(content="Π’Ρ‹ Π½Π΅ Π°Π²Ρ‚ΠΎΡ€ сообщСния", ephemeral=True)
        else:
            await interaction.response.send_message(content="123", ephemeral=True)β€Š

Dear, tell me why the cooldown does not work? button can be pressed continuously

viral dock