#discord-bots

1 messages Β· Page 919 of 1

boreal ravine
#

"disnake"

slate swan
#

disnake and its a bot subclassworksonmymachine

spring stone
#

:/

steep estuary
#
msg = message.content.split()
checking = msg.count(element)
if checking > 5:
  await message.send("Please Don't Repeat Same Words")
steep estuary
spring stone
#

@slate swan

boreal ravine
limpid storm
#

:/

slate swan
spring stone
slate swan
drowsy thunder
slate swan
#

wa

limpid storm
#

hi i wanna ask something!

boreal ravine
#

@drowsy thunder

steep estuary
drowsy thunder
spring stone
#

@sinful ridge LoL

limpid storm
boreal ravine
#

@sinful ridge english only

slate swan
limpid storm
#

:/

slate swan
#

error 404

steep estuary
#

ig not sure

limpid storm
# slate swan yes

like i've created a music bot but when i use it and play a song it's ping rise up like hell, can anyone tell how to fix that?

spring stone
#

@sinful ridge dm

steep estuary
cloud dawn
drowsy thunder
cloud dawn
sinful ridge
#

@slate swan :/

#

how are you :/

spring stone
#

πŸ˜’

slate swan
#

fine

limpid storm
slate swan
#

ill call mods

drowsy thunder
limpid storm
steep estuary
slate swan
limpid storm
#

oh

maiden osprey
#

Where should I host my bots GF_stressedkid
Except heroku,replit and buying my own server

spring stone
#

@slate swan hru

limpid storm
slate swan
unkempt canyonBOT
slate swan
limpid storm
slate swan
steep estuary
spring stone
maiden osprey
slate swan
maiden osprey
spring stone
#

@slate swan how to make a bot??

slate swan
spring stone
slate swan
maiden fable
#

πŸ‘€ Mrinal do be back after a long time

spring stone
steep estuary
slate swan
#

any problem?

sinful ridge
#

@slate swan u know python?

#

or copy paste :/

steep estuary
maiden fable
#

Against ToS

steep estuary
#

youtube dl and lavalink are against tos

#

that's why i am not trying them

#

...

spring stone
#

...

drowsy thunder
#

How to fix

spring stone
#

@slate swan block kyu kiya πŸ€“

slate swan
drowsy thunder
slate swan
drowsy thunder
#

Also your breaking a rule

#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

sinful ridge
#

:/

drowsy thunder
slate swan
drowsy thunder
slate swan
steep estuary
drowsy thunder
#

I cant

daring olive
#

hi everyone

slate swan
#

hi

drowsy thunder
#

This channel is full of idiots

slate swan
drowsy thunder
#

For no reason

daring olive
#

please only use english here. don't post random insulting gifs, or gifs in general
step away if you don't want to engage

sinful ridge
steep estuary
drowsy thunder
sinful ridge
daring olive
unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @sinful ridge until <t:1647791722:f> (59 minutes and 59 seconds).

drowsy thunder
maiden osprey
maiden fable
slate swan
#

yes

boreal ravine
drowsy thunder
maiden fable
maiden osprey
#

I am also new so can't say

slate swan
#

Hi

#

hi

drowsy thunder
slate swan
#

U guyz know how to code a bot?

slate swan
boreal ravine
slate swan
slate swan
boreal ravine
slate swan
#

lol

#

@slate swan please suggest me a library

maiden osprey
slate swan
drowsy thunder
#

Didnt work

slate swan
maiden osprey
drowsy thunder
drowsy thunder
slate swan
slate swan
drowsy thunder
#

@slate swan you even know python

slate swan
drowsy thunder
boreal ravine
slate swan
#

please stop Ryan

slate swan
drowsy thunder
slate swan
slate swan
#

discord.py is the official library with always the easiest and most creative ways of doing its own stuff

slate swan
#

what

#

what

drowsy thunder
drowsy thunder
slate swan
final iron
slate swan
drowsy thunder
slate swan
#

soon it will also catch up

slate swan
slate swan
final iron
drowsy thunder
final iron
drowsy thunder
slate swan
#

danny stated talking with discord a lot

slate swan
torn sail
#

It’s not the official one but yes it’s the most used for python

final iron
boreal ravine
slate swan
#

let's stay at the word "original" python wrapper

final iron
slate swan
slate swan
drowsy thunder
#

@final iron

slate swan
#

lol

drowsy thunder
#

See that verified icon?

final iron
drowsy thunder
#

See it,if not then I would suggest an eye checkup

slate swan
#

..

boreal ravine
slate swan
#

.

drowsy thunder
slate swan
#

well, one of the requirements is to get verified is the subject has to be official

boreal ravine
#

and it doesn't mean it's official

final iron
slate swan
#

same as here

final iron
#

Any server can get verified if they meet the criteria

slate swan
#

which is?

#

:/

#

why we here?

slate swan
drowsy thunder
slate swan
#

you can't get a fortnite server verified if you don't ask epic games to make your server official

#

same with dpy

drowsy thunder
final iron
slate swan
#

not sure

torn sail
#

Some of you guys clearly don’t know what it means to be a verified server

slate swan
drowsy thunder
#

Guys nobody helped me here

final iron
#

Just because the dpy server is verified doesn't mean it's the official library

boreal ravine
slate swan
drowsy thunder
torn sail
drowsy thunder
slate swan
boreal ravine
drowsy thunder
drowsy thunder
#

I am sure i didnt do a

slate swan
slate swan
#

documentaries

drowsy thunder
daring olive
slate swan
#

NO

#

not youtube

drowsy thunder
slate swan
#

all youtube tutorials are outdated

torn sail
#

YouTube tutorials a not very good and very outdated

boreal ravine
slate swan
#

and incredibly misleading

slim ibex
slate swan
slate swan
drowsy thunder
boreal ravine
drowsy thunder
drowsy thunder
slate swan
steep estuary
slate swan
slate swan
#

Ryan, your error is overall not dpy related, but we're sure something has to be there 😒

steep estuary
slate swan
#

my carpenter can't fix my toaster even tho it's in my house and he works with houses

drowsy thunder
#

@boreal ravine I cut and pasted the line,it doesnt work,may i dm you the replit url?

boreal ravine
#

don't paste it

slate swan
#

😒

boreal ravine
#

rewrite the line

drowsy thunder
steep estuary
#

try writing again

boreal ravine
slate swan
#

now repl

boreal ravine
#

don't use replit for discord bots sad_cat

slate swan
#

kayle save me

gaunt ice
#

i am using vsc now

#

its pog

slate swan
#

Replit

While this may seem like a nice and free service, it has a lot more caveats than you might think, such as:

  • The machines are super underpowered.

    • This means your bot will lag a lot as it gets bigger.
  • You need to run a webserver alongside your bot to prevent it from being shut off.

    • This isn't a trivial task, and eats more of the machines power.
  • Repl.it uses an ephemeral file system.

    • This means any file you saved via your bot will be overwritten when you next launch.
  • They use a shared IP for everything running on the service.
    This one is important - if someone is running a user bot on their service and gets banned, everyone on that IP will be banned. Including you.
    Heroku

  • Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.

  • Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.

  • Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.

  • Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)

  • Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.

inland crest
#

hey help pls

gaunt ice
#

see

inland crest
#

how to host my bot online forever free without replit, uptimerobot

slate swan
#

use a vps or a raspberry pi

slim ibex
slate swan
#

nothing's free in life, darling

boreal ravine
#

Use a free hosting website

slim ibex
slate swan
gaunt ice
#

if anything is free ur the product , legendary quote by someone

slate swan
#

what

#

well that's interesting

gaunt ice
#

ye no cap bruh

slate swan
#

I'm gonna go think about that in the corner

boreal ravine
#

Best free host: || ||

slim ibex
drowsy thunder
#

Guys,still dont work

slim ibex
#

...

drowsy thunder
#

@boreal ravine @steep estuary

steep estuary
boreal ravine
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

drowsy thunder
steep estuary
#

remove the space

drowsy thunder
inland crest
slate swan
#

..

inland crest
#

it literally is down more than 50

#

% and reqs replit

inland crest
drowsy thunder
drowsy thunder
#

Literally verified bots use it

#

Seriously,I am not kidding

dapper cobalt
#

Not really. Most large bots are hosted on a VPS.

drowsy thunder
inland crest
#

uhh bro

#

im not 18 how am i to get a card

final iron
#

Ask your parents or a friend

#

If you're looking for hosting options the GitHub student developer pack is an option

#

If you're under 18 you should still be in some sort of education

maiden fable
#

U mean the Digital Ocean credit?

final iron
maiden fable
#

hosting with github student

final iron
maiden fable
#

!d discord.Message.jump_url

unkempt canyonBOT
maiden fable
#

jump_url

#

yea

final iron
#

But I know there's a couple

maiden fable
#

message.attachments then

quick gust
#

rest are domains and tools

slate swan
#

digital ocean ad

#

on youtube i remember

quick gust
maiden fable
#

Lol

mighty dust
#

how do i make a discord bot change my nickname in a server

#

nvm i got it

slate swan
#

wo

gaunt ice
#

hm

dapper cobalt
slate swan
uncut comet
#

hey has anyone got any examples they can link me for buttons?

slate swan
#

lib?

uncut comet
#

lib?

slate swan
#

library

uncut comet
#

sure

slate swan
#

which module bro?

uncut comet
#

idk im discordpy 2.0

hoary cargo
#

Damn you're the dpy itself

slate swan
uncut comet
slate swan
tacit token
#

guys how to convert json to utf-8?

tacit token
#

i create bot who set lang.

#

#bruh

slate swan
#

your question isnt related to dpy

tacit token
mortal thistle
#

Hello

#

I'm badly stuck

#

How can I use a single sqlite connecting throughout my bot files?

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

mortal thistle
#

but I have different cogs

slate swan
#

how can i continue writing messages in the next line using one send function

slate swan
mortal thistle
#

I mean there should be only one sqlite connection in my main.py

#

and I want access to it in all other files

slate swan
mortal thistle
slate swan
#

oh

mortal thistle
#

for line break

slate swan
#

thanks

slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

001 | Hello
002 | World
slate swan
mortal thistle
#

oops

#

anyways he got the solution

slate swan
#

\new line

mortal thistle
#

what abt mine

slate swan
#

well it wouldnt matter

#
self.bot.db

in this case db is the variable and self.bot is the bot instance thats passed in your cog class initiate

mortal thistle
#

okay

#

another question

#

what If I don't use cogs?

#

like everything in a single file LOLI

slate swan
#

same thing its bound to a bot instance

mortal thistle
#

whats the difference between using cogs and not using cogs?

slate swan
#

cogs are extensions of listeners and commands

mortal thistle
#

I've tried both

slate swan
boreal ravine
#

Hello guys

supple crescent
#

!paste

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.

boreal ravine
slate swan
slate swan
slate swan
#

spinoff*

tacit token
#
def url_filter_cache(db_response):
    try:
        url_filters[db_response[0]].append(db_response[1])
    except KeyError:
        url_filters[db_response[0]] = [db_response[1]]

for i in db_response:
    url_filter_cache(i)

response_string = {}
for i in os.listdir('./languages'):
    if i.endswith('.json'):
        with open(os.path.join('./languages', i,encoding='utf-8')) as file:
            response = json.load(file)
        response_string[i.strip('.json')] = response

def get_lang(guild, response):
    try:
        return response_string[server_config[guild.id]['language']][response]
    except:
        return response_string['english'][response]

    with open(os.path.join('./languages', i,encodings='utf-8')) as file:
TypeError: join() got an unexpected keyword argument 'encoding'
boreal ravine
tacit token
#

how?

#

i try make a bot who speak in franch / enlish / turkey / Hungary

cold sonnet
#

open(os.path.join('./languages', i, encoding='utf-8'))
open(os.path.join('./languages', i), encoding='utf-8')

boreal ravine
slate swan
#

okay nvm idt that mee6 was written in python welp

#

is it?

cold sonnet
#

mee6 is an amateur bot anyways

slate swan
#

yeah

cold sonnet
#

😳

slate swan
#

ik it uses a private wrapper but i thought it was made with js

tacit token
slate swan
#

it has voice recieve unless it has its own api

cold sonnet
#

mee6 has voice receiving?

slate swan
#

yeah

cold sonnet
#

bro

slate swan
#

recording voice stuff

cold sonnet
#

anyways

tacit token
#

Mee6 python bot? The oldest update in github says lang python

cold sonnet
#

I want voice receiving too 😦

slate swan
tacit token
#

Nope. The most famous is Rythem

slate swan
#

rip dank memer

cold sonnet
boreal ravine
#

No offence but I don't give a fuck what language it's made out of, just give the link

slate swan
#

k

cold sonnet
#

just tell me how they made voice receiving

boreal ravine
#

jk troll

tacit token
#

yeah right

cold sonnet
#

actually, discord doesn't even support that

#

how do they get away with it

maiden fable
tacit token
#

200k

maiden fable
#

Nextcord too

cold sonnet
#

wtf

boreal ravine
maiden fable
#

Who tf says that it is not supported

cold sonnet
#

now you're telling me nextcord has done something

maiden fable
slate swan
cold sonnet
maiden fable
#

tf

maiden fable
#

That too, the article is also old, yea

cold sonnet
#

where do y'all get these news though

boreal ravine
maiden fable
cold sonnet
#

I never get these news so early

maiden fable
slate swan
#

leave discord bots, return to AI dev

maiden fable
cold sonnet
#

not that kind of news

#

the dpy ones

maiden fable
final iron
#

Can you send the docs on it?

cold sonnet
maiden fable
# final iron Wait what

Yea, if not nextcord, then its pycord (idk I am confused most of the time between the two)

cold sonnet
#

def not pycord

boreal ravine
#

pycord has it

cold sonnet
#

liar

pliant gulch
#

Pycord stole the impl (PR) for voice receive

boreal ravine
#

definitely lying

slate swan
cold sonnet
pliant gulch
#

It had a PR, yes

pliant gulch
#

It wasn't for production though

final iron
#

Has the feature for voice receive been implemented in pycord yet?

maiden fable
slate swan
cold sonnet
#

did u say meh

boreal ravine
maiden fable
#

Ah my bad, I always get confused between the two since both do be cord

#

gtg match started

slate swan
#

pycords src gives me a stroke each time i see itdead

slate swan
final iron
cold sonnet
#

πŸ‘πŸΏ

boreal ravine
slate swan
#

lol

slate swan
boreal ravine
gaunt ice
cold sonnet
#

well if I made some breaking changes to a wrapper, I'd fucking atleast take credit

maiden fable
slate swan
#

69 ISSUES

gaunt ice
#

the on_member_update comes in which of the categories

slate swan
cold sonnet
gaunt ice
cold sonnet
#

!d discord.on_member_update

unkempt canyonBOT
#

discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.

This is called when one or more of the following things change:

β€’ nickname

β€’ roles

β€’ pending...
slate swan
#

pycord's syntax is so shit, no offence

gaunt ice
#

umm

cold sonnet
#
status

activity

nickname

roles

pending

complete the list

slate swan
#

yeah that

gaunt ice
slate swan
gaunt ice
#

on_user_update

slate swan
#

on member update

boreal ravine
#

on_member_update for 2.0

gaunt ice
cold sonnet
slate swan
gaunt ice
#

!d discord.on_user_update

unkempt canyonBOT
#

discord.on_user_update(before, after)```
Called when a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") updates their profile.

This is called when one or more of the following things change:

β€’ avatar

β€’ username

β€’ discriminator...
cold sonnet
#

wth

final iron
#

I kind of like the voice receive and I kind of dislike it

gaunt ice
#

ik it sounds dumb

cold sonnet
#

I'd say it does make sense

slate swan
#

im having a stroke reading pycords src so dont mind me

#

just use the voice recorder of your device huh

gaunt ice
#

imagine discordpy brings recording voices....

#

ppl can literally create ai and stuff with dat

slate swan
#

imagine recording voices and selling them on the dark web-

gaunt ice
#

true

slate swan
#

me rn: AG_Smirk

#

I mean, copyright idea

#

ok nvm am being weird

pliant gulch
slate swan
#

f

cold sonnet
gaunt ice
#

sed

slate swan
cold sonnet
#

people on my server already do that with music bots lmao

#

False

pliant gulch
#

Stops it from recording either way no?

cold sonnet
#

we won't disable all URLs because some people are dumb enough to click some of them

cold sonnet
#

:bruhkitty:

#

no nitro

#

and if it ever came to voice receiving, I'd finally have my way of turning off the lights

maiden fable
#

@cold sonnet I am DMing u smth

cold sonnet
#

ono

boreal ravine
maiden fable
#

πŸ˜” Stop it

gaunt ice
#

everyone has nitro........

#

even kayle does

#

nvm ot

slate swan
#

kayle simps for nitro

maiden fable
#

Stop it

#

Take this to DMs, not here

cold sonnet
#

steelseries had free nitro giveaway for everyone, Epic Games aswell before

slate swan
#

yup

cold sonnet
#

neither don't we have that much

boreal ravine
maiden fable
#

It does cost like 1/4th of my pocket money here

#

Like idk 7 USD per month

cold sonnet
maiden fable
#

Wait make that 10

boreal ravine
cold sonnet
#

no

boreal ravine
#

@slate swan hey

cold sonnet
#

that's my acc

maiden fable
#

almost 1/2 pocket money

cold sonnet
#

wait lemme get on that

maiden fable
slate swan
slate swan
cold sonnet
#

meh

boreal ravine
maiden fable
#

Huh there is? Idk

slate swan
#

meh

slate swan
maiden fable
#

O nvm

gaunt ice
#

classic bad

maiden fable
#

Yea, I just clicked the Subscribe lmao

gaunt ice
#

no banner cmon

slate swan
#

@cold sonnet fuck you

cold sonnet
#

fuck you too

slate swan
#

bro

#

wtf

gaunt ice
#

more like love u

slate swan
#

@cold sonnet @slate swan i thought you guys were the same personrooMonkaS

cold sonnet
#

fuck me

slate swan
#

we sent the same image gopher

cold sonnet
#

😎

unkempt canyonBOT
cold sonnet
#

Imma logout and stop ot

slate swan
cold sonnet
#

you'll never see meh dpy coder anymore

boreal ravine
#

not expensive

slate swan
boreal ravine
#

goodnight kids allie_sleep finger_wave

left crater
#
        self.clear_items()
        await self.ctx.edit(view=None)
        return``````
Task exception was never retrieved
future: <Task finished name='discord-ui-view-timeout-06ea066112d8f19a0e78789cf04a90d8' coro=<MyView.on_timeout() done, defined at C:\Users\nikit\PycharmProjects\dpamong\docs\main.py:336> exception=AttributeError("'Context' object has no attribute 'edit'")>
Traceback (most recent call last):
  File "C:\Users\nikit\PycharmProjects\dpamong\docs\main.py", line 338, in on_timeout
    await self.ctx.edit(view=None)
AttributeError: 'Context' object has no attribute 'edit'``` why no work?
boreal ravine
slate swan
slate swan
boreal ravine
slate swan
slate swan
unkempt canyonBOT
slate swan
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited message is returned instead.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
slate swan
#

since the attr returns a Message obj just use this method ^

left crater
#

await self.ctx.message.edit(view=None) like this?

slate swan
boreal ravine
#

maybe you are

maiden fable
#

πŸ˜” Stop it

gaunt ice
#

no

slate swan
boreal ravine
#

two pings?

maiden fable
#

DUDE STOP YOU BOTH

echo wasp
#

Hey yall question is there a contains function

boreal ravine
slate swan
gaunt ice
slate swan
maiden fable
#

!ot

unkempt canyonBOT
boreal ravine
gaunt ice
#

wait no

echo wasp
# slate swan pardon?

Is there a function for like example py if message contains discord.embed: do something

slate swan
#

!d discord.Message.embeds

hoary cargo
unkempt canyonBOT
gaunt ice
#

cmon

vital steeple
#

im trying to add something where if they miss spell a word the bot says "invalid input"

slate swan
hoary cargo
slate swan
gaunt ice
hoary cargo
#

you make more ot by asking me to stop ot tbh, so stop

slate swan
raven matrix
#

Hey how to make Discord bot

#

?

gaunt ice
slate swan
echo wasp
vital steeple
#

im trying to add something where if they miss spell a word the bot says "invalid input"

raven matrix
slate swan
raven matrix
#

I'm new

unkempt canyonBOT
#
Fat chance.

No documentation found for the requested symbol.

gaunt ice
#

nvm im bad with path

slate swan
vocal plover
slate swan
#

bro

#

let him have his moment

boreal ravine
#

why was alec demoted

vital steeple
# slate swan code

elif message.content.lower() == 'support': await message.channel.send('Perfect Choice, What Payment Method Would You Like To Use? **okay')

vocal plover
vital steeple
slate swan
raven matrix
slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

No
slate swan
#

as basic as i can do it

cold sonnet
slate swan
#

yeah its a bot but it cant like learn etc like ais do

cold sonnet
#

it's easier to say these are like factory robots

cold sonnet
#

you code something into it and it does it when you turn it on

#

it's more than that ofc...

slate swan
raven matrix
slate swan
#

would i just have to import await

#

no?

slate swan
cold sonnet
#

you're doing this on_message

slate swan
cold sonnet
slate swan
#

only Context has the reply attr

#

which only commands have context

cold sonnet
#

hm

slate swan
#

ohhhh. Alright mb, thanks

#

show scopes

#

the scopes should be bot and application.commands

#

not the link

#

send a ss of the perms and scopes

cold sonnet
#

lemme invite that bot real quick

slate swan
cold sonnet
#

y

slate swan
#

you probably need more perms

#

once you open the ticket it prints out, and whenever you are closing the ticket it prints it out, i dont like that, is there an fix for that

#

excuse me?

cold sonnet
#

lemme go see your code real quick

#

brb

slate swan
slate swan
cold sonnet
#

yeah lower won't be uppercase

slate swan
#

^

#

upper() would

cold sonnet
#

elif message.content.lower() == 'support':

slate swan
#

not worried abt that lmao

cold sonnet
#

should be

slate swan
#

!e

print("lol".upper())
print("LOL".lower())
cold sonnet
#

it always goes to the else statement

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

001 | LOL
002 | lol
slate swan
#

it will always be false

cold sonnet
slate swan
cold sonnet
#

in this server

#

I get a dude like this

slate swan
slate swan
# slate swan pardon?

lmao, when the message author saying something invalid then the bot prints out INVAILD, but if another bot says something the bot doesnt print out anything

cold sonnet
#

your on_message

#

probably has something like

slate swan
slate swan
cold sonnet
#

if message.author.bot:
return

#

do you have smth like this

slate swan
#

ni

#

my code atm

elif message.content.lower() == 'SUPPORT': await message.channel.send('SUPPORT IS COMING') else: await message.channel.send("INVAILD")

#

show the whole function

cold sonnet
#

show your whole on_message function

#

and change
elif message.content.lower() == 'SUPPORT':
to
elif message.content.lower() == 'support':

slate swan
#

^

#

alright ill show my whole function wait one moment

#
async def on_message(message): 

    if message.author == client.user:
        return

    if message.content.lower() == 'support': 
        await message.channel.send('support on the way')

    elif message.content.lower() == 'hello':
        await message.channel.send('hey how are you')```
cold sonnet
#
    if message.author == client.user:
        return
```do you know what that means
slate swan
cold sonnet
#

the whole thing won't continue if the message's author is the bot

cold sonnet
#

ig...

#

no prefix

slate swan
cold sonnet
#

it ain't !support or !hello

slate swan
#

i dont want commands lmao for thoses

#

so it wont trigger for no reason

slate swan
cold sonnet
#

so chain, does it work?

slate swan
#

@cold sonnet

cold sonnet
#

so

#

good

cloud dawn
slate swan
cloud dawn
#

You just need the right tools.

slate swan
cloud dawn
slate swan
#

because when the mesage auther says something wrong then the bot prints INVAILD

cold sonnet
#

oh I understand

slate swan
#

it will always

cold sonnet
#

should remove it

slate swan
#

it always checks all the messages and if its wrong it will just send invalid so i suggest commands lol

mortal thistle
#

how to remove all reactions from a message?

slate swan
#

!d discord.Message.clear_reactions

unkempt canyonBOT
#

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

Removes all the reactions from the message.

You need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this.
uncut comet
#
AttributeError: 'Member' object has no attribute 'avatar_url'

i updated to discord 2.0 how do i get avatar url now?

uncut comet
#

thanks

cold sonnet
#

can I make an init function an async function

manic wing
#

is the short answer

#

make a classmethod

cold sonnet
#

when do those even get called

#

jesus, Caeden is writing a book

#

Class Methods
Let’s compare that to the second method, MyClass.classmethod. I marked this method with a @classmethod decorator to flag it as a class method.

Instead of accepting a self parameter, class methods take a cls parameter that points to the classβ€”and not the object instanceβ€”when the method is called.

Because the class method only has access to this cls argument, it can’t modify object instance state. That would require access to self. However, class methods can still modify class state that applies across all instances of the class.

I see

manic wing
#

!e ```py
import asyncio

class x:
async def bleh(self):
print(".")
@classmethod
async def start(cls):
self = cls()
await self.bleh()
return self

asyncio.run(x.start())```

unkempt canyonBOT
#

@manic wing :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 6
002 |     @classmethod
003 |                 ^
004 | IndentationError: unindent does not match any outer indentation level
manic wing
#

fuck mobile

cold sonnet
#

!e

import asyncio

class x:
    async def bleh(self):
         print(".")
    @classmethod
    async def start(cls):
         self = cls() 
         await self.bleh()
         return self 

asyncio.run(x.start())
#

god I'm dumb

unkempt canyonBOT
#

@cold sonnet :white_check_mark: Your eval job has completed with return code 0.

.
manic wing
#

that’s what a classmethod does

slate swan
#

it returns an instance of the class which some people use it as an initiate

cold sonnet
#

hm

#

and it is called on startup

maiden fable
slate swan
#

it helps when you need to call a coroutine on a creation of a class instance

cold sonnet
#

it's what I'm thinking about, but Idk how to call it

#

do I even have to

#

yes, but I call it with await

#

and I can't use await outside an async function

manic wing
#

it also used for injecting variables in a class

cold sonnet
#

this is a paradox

manic wing
cold sonnet
#

right

manic wing
#

meh

cold sonnet
#

meh

manic wing
#

if you have an event loop you can run tasks off of it

cold sonnet
#

let's say I don't

#

and that this whole convo is ot

#

but it's dumb

        asyncio.run(self.move)

    async def move(self):
        await asyncio.sleep(5)
        self.rect = self.rect.move(
            posnum(pos[0])*45, 
            (int(pos[1])-1)*80
        )
        print("done")
```ValueError: a coroutine was expected, got <bound method Piece.move of <Piece Sprite(in 2 groups)>>
runic bay
#

Is there a good tutorial for making bots? I'm trying to make a Crypto tipping bot.

cold sonnet
runic bay
next heath
#

Sup im having trouble to find how im getting a ban Reson can someone help me Im using on_member_ban event

slate swan
#

how would I set a rich presence for my bot?

cold sonnet
unkempt canyonBOT
#

property status```
[`Status`](https://discordpy.readthedocs.io/en/master/api.html#discord.Status "discord.Status"): The status being used upon logging on to Discord.
cold sonnet
#

nvm

#

!d discord.ext.commands.Bot.activity

unkempt canyonBOT
cold sonnet
#

here's an example

bot = commands.Bot(
    command_prefix = "%", 
    intents = disnake.Intents.all(), 
    activity = disnake.Game(name="With u")
)
maiden fable
#

hm

cold sonnet
#

mh

cold sonnet
#

still

vale sierra
#
@bot.event
async def on_raw_reaction_add(payload):
    if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
        msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]

        if payload.message_id == msg_id:
            guild = bot.get_guild(payload.guild_id)

            for category in guild.categories:
                if category.id == category_id:
                    break

            channel = guild.get_channel(channel_id)

            ticket_channel = await category.create_text_channel(f"ticket-{payload.member.display_name}",
                                                                topic=f"Channel pour {payload.member.display_name}.",
                                                                permission_synced=True)
            overwrites = {
                guild.default_role: discord.PermissionOverwrite(read_messages=False),
                guild.me: discord.PermissionOverwrite(read_messages=True, send_messages=True),
            }

            message = await channel.fetch_message(msg_id)
            await message.remove_reaction(payload.emoji, payload.member)

            await ticket_channel.send(
                f"> {payload.member.mention} Merci d'avoir crΓ©er un ticket ! Si vous voulez fermez ce channel, utilisez **'-close'**.")

            try:
                await bot.wait_for("message", check=lambda
                    m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close",
                                   timeout=3600)

            except asyncio.TimeoutError:
                await ticket_channel.delete()

            else:
                await ticket_channel.delete()
``` hello i have a error with this ticket code (key error = server id)
final iron
#

!e

my_dict = {1: "hi"}
print(my_dict[2])
unkempt canyonBOT
#

@final iron :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 2
final iron
#

@vale sierra

#

The key in the dict doesn't exist

vale sierra
feral timber
#

If I use the interactions webhooks instead of the gateway, is there a way to get the bot user to show as online?

maiden fable
feral timber
#

Gateway is disabled if you use the interactions endpoint, at least as far as I understand

maiden fable
#

only interactions

#

See, only interactions, that is slash commands and context commands and select menu and button clicks

feral timber
#

Right, right
All that's only supported by the Gateway.
But I'm using the interactions endpoint, so I can't use the Gatway.
I enabled the interactions endpoint and created a bot user for my application. But the bot only shows as offline. Is there a way to have a bot show as online using the interactions endpoint?

maiden fable
#

Nope, you need to connect to the gateway

haughty meadow
cold sonnet
#

I'm gonna check, thanks

slate swan
final iron
slate swan
nova bear
slate swan
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

['l', 'o', 'l', ' ', 'i', 'm', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g']
slate swan
#

!d discord.ext.commands.Bot.latency

unkempt canyonBOT
#

property latency```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.

This could be referred to as the Discord WebSocket protocol latency.
nova bear
slate swan
#

and why make it a list? it would just send the list

nova bear
#

i want it to send like

#

hi
thanks
test

slate swan
#

ah

nova bear
#

instead of
hi thanks test

slate swan
#

!e print("This\nmakes\na\nnewline")

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

001 | This
002 | makes
003 | a
004 | newline
slate swan
#

\n makes a new line

nova bear
#

so would i put that after what i wanted

slate swan
#

for each word yes

nova bear
#

tysm

final iron
#

Instead of hard coding it you could just make a list and then use "\n".join(my_list)

#

!e

my_list = ["hi", "thanks", "test"]
print("\n".join(my_list))
unkempt canyonBOT
#

@final iron :white_check_mark: Your eval job has completed with return code 0.

001 | hi
002 | thanks
003 | test
final iron
#

@nova bear

slate swan
final iron
#

Hard coding smh

nova bear
#

thanks

final iron
#

!d str.join

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.
slate swan
final iron
slate swan
lusty sky
#

how do i make it check this?

@commands.check(MYID or FIN)```
#

how can i make it check multiple IDS?

slate swan
#

is it over the top to make a subclass to set a default color for embeds rooThink

#

i think its not its just 3 lines

manic wing
slate swan
lusty sky
#
def owner():
    async def predicate(ctx):
        return ctx.author.id == [840606037378728007, 325749184902856715, 264862322751832066, 289794361758187522, 949119850788311070]
    return commands.check(predicate)```
Why doesnt this work?
manic wing
#

and i probably wouldnt decorate functions like that

lusty sky
#

alright thank you

blazing lagoon
#

Is there an option to suppress responses from interactions with e.g. selection menus?

vital steeple
#

I need help adding this, I would add certain words to a word list, alright and if the user types something that isnt on that word list the bot will have, invalid word

fresh orchid
#

So I have this function (ctx and self are defined)

async def button_next_day_callback(interaction:discord.Interaction): 
            
            if interaction.user != ctx.author:
                await interaction.response.send_message("You can't control the game of other people", ephemeral=True)
                return

            await interaction.message.edit(embed=embed_how_many, view=None)    

            user = interaction.user


            
            answer_how_many = await self.client.wait_for('message', check=lambda message: message.author == interaction.user)
            answer_how_many = answer_how_many.content 

But after the bot waits for my message and gets the content I will get the following error

Ignoring exception in view <View timeout=180.0 children=3> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Next day' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\zockerbande\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ui\view.py", line 373, in _scheduled_task
    await interaction.response.defer()
  File "C:\Users\zockerbande\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\interactions.py", line 494, in defer
    await adapter.create_interaction_response(
  File "C:\Users\zockerbande\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\webhook\async_.py", line 211, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

Is there any way to wait for an message without getting this error?

torn sail
#

!d discord.InteractionResponse.defer

unkempt canyonBOT
#

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

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

This is only supported with the following interaction types...
vital steeple
#

I need help adding this, I would add certain words to a word list, alright and if the user types something that isnt on that word list the bot will have, invalid word

final iron
#

You have to manually add it with a string

slate swan
#

yeah yeahSajunaSip

final iron
#

I'm at the gym

#

You're interrupting my workout smh

slate swan
#

on any error
my code crashes and stop running

i dont care about errors, i just want to my code stay running event if it hit a error
not in specified part, in the whole code

slate swan
winged bone
slate swan
winged bone
#

also if you expect the errors, you could use a try-except block to do something in the case it happens

final iron
slate swan
slate swan
final iron
slate swan
hoary cargo
#

SUS fat people are not healthy

final iron
#

πŸ—Ώ

slate swan
hoary cargo
#

MR_canny_9 zamn

#

StickBugged i switched to digital ocean and idk what to do πŸ—Ώ

lyric tusk
#

how do i make a dashbord

final iron
#

Well do you know js/html?

hoary cargo
lyric tusk
hoary cargo
final iron
#

You'll get a better response

final iron
lyric tusk
hoary cargo
dry junco
#

Im trying to make bot use embeds and it says this when i use the command?

discord.errors.ClientException: Callback for displayembed command is missing "ctx" parameter.

slate swan
#

well youre missing context

hoary cargo
slate swan
silent ermine
#

wait hold on

slate swan
#

you cant call the dict

silent ermine
slate swan
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | TypeError: 'dict' object is not callable
slate swan
#

yeah

silent ermine
#

ye i figured it out ty

slate swan
#

emoji looks creepy for some what reason

#

Try checking your wifi's latency or stuff since your bot is running on your IDE and I think that your IDE would be connected to the wifi, Im not that good in that area Β―_(ツ)_/Β―

#

@silent ermine love the emoji bro

slate swan
#

So im not sure lol

#

πŸ’€

slate swan
alpine furnace
slate swan
slate swan
#

well im still learning it so say thermodynamics lol

alpine furnace
#

What in quantum physics

#

Nice

slate swan
silent ermine
slate swan
slate swan
silent ermine
alpine furnace
#

But bro

alpine furnace
#

Atoms aren’t the things that have a probability

#

It only affects electrons

#

=

slate swan
scarlet aurora
#

how can i make something that grabs a api and send it through the discord bot

scarlet aurora
#

to call an api

silent ermine
#

ok like before i tried to append a user to a json array

    @add.command()
    async def pilot(self, ctx, pilotUserID):
        with open("./databases/staff/pilots.json", "r+") as f:
            pilot = json.load(f)
        if ctx.guild.id in pilot:
            pilot[str(ctx.guild.id)].append({
                "ID": pilotUserID,
            })
            f.seek(0)
            with open("./databases/staff/pilots.json", "r+") as f:
                json.dump(pilot, f, indent=4)
            await ctx.send("Added {} to the database.".format(pilotUserID))
        else:
            pilot[str(ctx.guild.id)] = {}
            pilot[str(ctx.guild.id)].append({
                "ID": pilotUserID,
            })
            f.seek(0)
            with open("./databases/staff/pilots.json", "r+") as f:
                json.dump(pilot, f, indent=4)
            await ctx.send("Added {} to the database.".format(pilotUserID))```
and the error:
```py
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'dict' object has no attribute 'append'```
supple thorn
silent ermine
supple thorn
#

How about just

#
pilot[str(ctx.guild.id)] = {"ID": pilotUserID}
supple thorn
#

πŸ—Ώ

silent ermine
hasty raptor
#

Does anyone know a good python api for slash commands

silent ermine
#

not overwrite the current one

supple thorn
silent ermine
#

i cant append to a dict

supple thorn
#

Dict has no attribute append

silent ermine
hasty raptor
#

Can someone please help me with slash commands

silent ermine
hasty raptor
silent ermine
torn sail
hasty raptor
#

How to migrate my regular commands to slash commands

silent ermine
torn sail
#

They said they might make something called mixed commands (both message and slash) but as of now I’m just copying the code with interaction instead of ctx

hasty raptor
#

Can you send a link to the docs please

torn sail