#discord-bots

1 messages Β· Page 979 of 1

eager bough
#

nope

#

on_guld()

#

guild

velvet haven
#

huh

#

ohk

eager bough
#

it not on_member()
it on_guild()

hushed galleon
#

they havent even said what problem they're having yet

#

on_member_join and on_guild_join are separate events

maiden fable
#

I know u didn't wanna sound like it but it felt as if u were gonna kill him for using replit if u met him irl πŸ˜†

sick kettle
#

is python really a good language for making a big discord bot?

maiden fable
velvet haven
#

i wanna send welcome message when someone joins my server

frozen patio
sick kettle
#

i have a bot already in rust and i was thinking of adding few commands with python but i am scared of the time it will take to restart

frozen patio
#

Just use cogs for it to run faster in my past experiences πŸ‘

sick kettle
#

and connecting to the discord api

#

i heard it takes hours too if not setup properly

maiden fable
#

rust is also good

maiden fable
sick kettle
sick kettle
maiden fable
#

i mean i code bots in python

eager bough
frozen patio
sick kettle
#

what about shards tho

dull terrace
#

is it more efficient to use try/catch rather than if/else when you have to go through a dictionary of say 2000 entries?

sick kettle
#

wont it take time because of shards

frozen patio
#

I have never used shards

sick kettle
#

imagine a restart that takes approx 2hrs

hushed galleon
#

discord doesnt easily provide this information, so you'd have to manually track the invite uses in the server and see which one increases when they join (or for temp invites check the audit log)

sick kettle
#

would be pain

maiden fable
eager bough
#
(round(bot.latency * 1000))
sick kettle
maiden fable
#

If your VPS specs are good, then sharded bots won't take much to start up

frozen patio
sick kettle
#

big bots prob have custom made gateways

maiden fable
#

What the

#

Who is telling all this to u?

#

Whoever is telling u all this is wrong

sick kettle
#

mee6 is made in python so that news

dull terrace
#
if x in big_dictionary:
   if y in big_dictionary[x]:

### VERSUS ###

try:
    if y in big_dictionary[x]:
except:
    pass
frozen patio
#

My bots can turn on in 4 seconds

sick kettle
#

but cython maybe

frozen patio
#

I thought it was JavaScript

maiden fable
#

@sick kettle calm down don't worry
Even sharded bots don't take much to start

#

You can look at bots in https://discord.gg/dpy, specifically R. Danny.
It is fully made in Python but with the correct specs, takes seconds to start

Discord

Discord is the easiest way to talk over voice, video, and text. Talk, chat, hang out, and stay close with your friends and communities.

sick kettle
#

it would be weird yknow that the whole bot is made in rust but just a small part is made in python

eager bough
#

am i a good person ):

velvet haven
#

@client.event
async def on_member_join(member, message):
embed = discord.Embed(description='Welcome to our guild!', color=random.choice(client.color_list))
embed.set_thumbnail(url=member.avatar_url)
embed.set_author(name=member.name, icon_url=member.avatar_url)
embed.set_footer(text=member.guild, icon_url=member.guild.icon_url)
embed.timestamp = datetime.datetime.utcnow()

        await message.channel.send(embed=embed)
maiden fable
eager bough
#

are you sure?

sick kettle
#

i guess but the users would give a fuck if it will become slow

eager bough
frozen patio
maiden fable
sick kettle
#

do you think i should do some changes to the api wrapper like discord.py or pycord to fit my bot

eager bough
#

eeeeeeee

frozen patio
#

Probably not a question for here, but I do not know how to add a compiler to VS Code

eager bough
sick kettle
#

like changing the gateway according to the current shard size

maiden fable
sick kettle
#

removing unused imports from the library etc

maiden fable
#

PoV: No import is unused

sick kettle
eager bough
frozen patio
#

I think

sick kettle
#

its done in rust so why not in python

eager bough
maiden fable
eager bough
#

yeah

frozen patio
maiden fable
sick kettle
#

ah same thing same thing

eager bough
maiden fable
frozen patio
#

No it is not LMAO

maiden fable
maiden fable
frozen patio
#

Hmm

eager bough
#

reporting to discord... imagin

sick kettle
#

that depends upon how i need it to be at that time

frozen patio
#

Wouldn't it show as a link if it was?

#

πŸ‘€

sick kettle
#

rn i havent even started coding in python just because i am getting paranoid with this "slow" word

maiden fable
frozen patio
#

Python isn't slow

maiden fable
#

It is sometimes faster than other langs like C#

eager bough
#

now what

maiden fable
#

It just gets slower for stuff like GUIs and websites

frozen patio
#

It's how you code it, I recommend using cogs for optimal speed

maiden fable
#

Yes. It depends a lot on how u code
Bad Code -> Slow Speed
Good and Esoteric Code -> Fast Speed (in most cases)

slate swan
sick kettle
#

it isnt slow and ik cause i have been working with python for about 2yrs but adding the discord bot concept to the language is what that makes me paranoid

frozen patio
#

It isn't slow

sick kettle
#

ik bro πŸ˜”

maiden fable
#

Carl bot is coded in Python

slate swan
#

reset i think you have a case of paranoia

eager bough
#

HOW DO I USE PYTHON APP TO FREAKING START MY BOT!!!!!!

frozen patio
#

My bot's latency is 70ms what you talk about?

maiden fable
eager bough
#

NOOO

maiden fable
eager bough
#

BECAUSE I ONLY KNOW HOW SE REPLIT!!!!

sick kettle
#

i shouldnt be overthinking and give it a try and if it really doesnt work out for me then maybe i switch to java or rust

eager bough
#

THIS IS IMPOSIIBLE

maiden fable
frozen patio
maiden fable
eager bough
sick kettle
#

cause i hate rust

frozen patio
#

try that

slate swan
# maiden fable Hm?

the latency attr in the bot class only gives the latency of an ack hb and not the latency to the api

maiden fable
slate swan
maiden fable
slate swan
maiden fable
frozen patio
slate swan
#

lmao

slate swan
maiden fable
#

Can everyone calm down?

slate swan
#

no

sick kettle
frozen patio
#

Yes

eager bough
#

how

slate swan
#

xD jk lol

maiden fable
#

Just go with a single lang dude

slate swan
#

broo wftff bruoo

eager bough
#

can someone help me

sick kettle
#

i could use nodejs yes but that was made by another dev and i am not good with nodejs as much i am with python

maiden fable
#

You will get mad, tryna maintain the bot

frozen patio
sick kettle
slate swan
slate swan
eager bough
sick kettle
#

why do you think the big bots switches languages at a certain point of time

maiden fable
frozen patio
#

πŸ˜„

eager bough
sick kettle
maiden fable
#

@sick kettle Music Bots are against ToS anyways

frozen patio
slate swan
sick kettle
stray creek
#

I am using Pycord library 2.0.0b4, I am making a ping command which can only be used by certain roles. But this is not working, everyone can access it.

Can anyone help me with this please? I even tried has_role()

@bot.slash_command(guild_ids=[GUILD_ID], default_permission=False)
@permissions.has_any_role("admin")
async def ping(ctx):
    """Say hello to the author"""
    await ctx.respond(f"Hello {ctx.author}!")```
eager bough
slate swan
sick kettle
maiden fable
eager bough
#

how uuse cmd for it

#

just past the code in it?

sick kettle
slate swan
#

i think im just gonna leave because of this chaos maybe ill return when the new thread comes(ill probably return later on the day)pithink

sick kettle
sick kettle
#

except that smh

slate swan
#

lmfao

maiden fable
eager bough
maiden fable
#

I mean dude

#

Why r u even getting paranoid?!

slate swan
#

yeah the most popular bot is made with python (private wrapper)

maiden fable
#

Yea

eager bough
#

import gay

maiden fable
#

And the reason they used a private wrapper is cz they just wanted custom syntax for their bot

slate swan
# eager bough yh
  • in the folder make a venv( optional)
  • run your file like py python main.py where main.py is the name of the main file :'/
maiden fable
#

Its not like dpy does anything wrongly πŸ’€

slate swan
sick kettle
#

ig i should give pycord a try and if it doesnt workout then maybe change to nodejs and if that too doesnt workout then cry myself to rust

slate swan
slate swan
maiden fable
eager bough
eager bough
sick kettle
#

disnake never used

slate swan
sick kettle
#

pycord used and contributed ig

slate swan
slate swan
eager bough
slate swan
#

i think they migrated back but not my point

slate swan
sick kettle
#

but i need to relearn a lot of functions then πŸ˜”

eager bough
slate swan
eager bough
#

i only have them in replit

#

/:

slate swan
eager bough
#

2

slate swan
#

ok so

#

copy those files in your local computer

eager bough
#

how

slate swan
#

in a folder

#

πŸ’€

eager bough
#

ok

frozen patio
slate swan
#

yes pls

#

ping me when you're done copying

maiden fable
frozen patio
maiden fable
#

yea

frozen patio
#

Damn, must have been tough xD

slate swan
maiden fable
#

Its easy peasy

frozen patio
#

I could make my own? :OOO

slate swan
slate swan
#

it doesnt hurt to try

frozen patio
#

How many lines would it take?

maiden fable
#

Bruh

slate swan
#

depends on codebase

frozen patio
#

Hmm

maiden fable
#

Don't ever think about the number of lines it will take

slate swan
#

but it will take allot of time because endpoints models etc

frozen patio
slate swan
maiden fable
#

These projects can take upto 1k-2k lines

#

Ofc more than these

frozen patio
#

Mk that is fine

slate swan
#

yts tutorials are horrible just check out ddocs

maiden fable
#

I can bet

slate swan
frozen patio
eager bough
#

@fresh kestrel

slate swan
frozen patio
#

Okay

eager bough
#

@slate swan

frozen patio
slate swan
eager bough
slate swan
#

good

#

in that folder

eager bough
slate swan
#

good

eager bough
#

k

frozen patio
#

Windows 11 cringe ngl

slate swan
#

sometimes

eager bough
frozen patio
#

Windows 10 supreme

slate swan
#

now i'm feeling offended lmao

eager bough
slate swan
eager bough
#

good (:

slate swan
#

in that folder.. open cmd

slate swan
eager bough
frozen patio
#

Oh yeah

#

Idk know where to start

exotic maple
#

`Traceback (most recent call last):
File "C:\Users\ollie\PycharmProjects\Maxy Logs\main.py", line 25, in <module>
confession_channels = json.load(f)
File "C:\Users\ollie\AppData\Local\Programs\Python\Python310\lib\json_init_.py", line 293, in load
return loads(fp.read(),
File "C:\Users\ollie\AppData\Local\Programs\Python\Python310\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\ollie\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\ollie\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Process finished with exit code 1`

Does anyone know how to fix this error? I've been searching it up and trying solutions but i cant find one

slate swan
eager bough
frozen patio
exotic maple
eager bough
exotic maple
slate swan
exotic maple
#

I just havent found a way to fix it

slate swan
eager bough
#

@slate swan

slate swan
#

?

eager bough
#

now what

slate swan
#

ok now

buoyant zodiac
#

How do i get the amount of boost for server?

slate swan
#

instlal required libs @eager bough

eager bough
eager bough
buoyant zodiac
#

install required libraries

#

!d discord.Guild

eager bough
#

how!??!?!?!

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a β€œserver” in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
frozen patio
exotic maple
slate swan
eager bough
#

@slate swan HELP! NOW WHATT

slate swan
slate swan
exotic maple
#

The json file is empty lol

frozen patio
eager bough
#

WAITING...

slate swan
slate swan
frozen patio
#

Ah

slate swan
#

install your libs accordingly

frozen patio
#

This looks like alot of code πŸ‘€

exotic maple
slate swan
#

ok back to u

eager bough
#

uh oh @slate swan

frozen patio
#

Ima go learn and try my best :OOOO

slate swan
eager bough
#

it done

slate swan
frozen patio
slate swan
slate swan
frozen patio
#

Ye

slate swan
#

πŸ’œ

#

hmm

eager bough
slate swan
exotic maple
#

Eito?

eager bough
slate swan
#

and try again ig

eager bough
#

):

slate swan
#

anyone has a script that works for bots checking user status for a invite like discord.gg/python, /python and works for multiple servers, not just one server

slate swan
#

like its able to be configured

slate swan
# eager bough ):

do u have internet connection...? idk.. never had that kind of error.. but it doesn't look like an error with discord.py or with your code

slate swan
exotic maple
#

Checking

exotic maple
#

Ill tell you if it did

slate swan
eager bough
#

now i got instenet

slate swan
eager bough
#

internet

slate swan
eager bough
#

):

exotic maple
eager bough
#

now what i type in cmd @slate swan

slate swan
eager bough
#

e

slate swan
exotic maple
#

discord-py-slash-command

slate swan
slate swan
eager bough
#

):

exotic maple
#

It works it just takes ages to sync the commands

slate swan
slate swan
slate swan
eager bough
exotic maple
eager bough
#

@slate swan

eager bough
slate swan
eager bough
#

@slate swan!!!!

slate swan
#

gimme a min broo

rose gyro
#

Joooo

#

This man has no patience

eager bough
#

😦

rose gyro
# eager bough

Is your OS on the newest version ?
Ussualy outdated certificates are installed this way

slate swan
#

ok @eager bough my answer is still same.. it doesn't look like this is an error with your code or discord.py.. this is something with your pc ig

#

i'll try to look for the solutoin on internet and will let u know if i find any

#

:'/

eager bough
slate swan
#

:'/

eager bough
#

(:

slate swan
#

do this winver in run

#

idk why lmao

#

private channels?

eager bough
buoyant zodiac
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a β€œserver” in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guild’s hash.

str(x) Returns the guild’s name.
slate swan
eager bough
#

):

#

please!!!

slate swan
#

ye :'/

buoyant zodiac
#

trying to get the channels that are private lmao

eager bough
slate swan
#

bruh?

#

i ain't your son :")

eager bough
#

):

slate swan
#

:">

eager bough
#

):

frozen patio
#

@slate swan This is alot of docs

#

Very confusing

#

πŸ˜…

slate swan
eager bough
#

I NEED HELP!!!! @slate swan

#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

slate swan
#

:'/ yes bro?

frozen patio
eager bough
#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

frozen patio
eager bough
#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

slate swan
#

πŸ’€

exotic maple
# slate swan πŸ˜‚ can understand

An exception has occurred while executing command confess: Traceback (most recent call last): File "C:\Users\ollie\PycharmProjects\Maxy Logs\venv\lib\site-packages\discord_slash\client.py", line 1353, in invoke_command await func.invoke(ctx, **args) File "C:\Users\ollie\PycharmProjects\Maxy Logs\venv\lib\site-packages\discord_slash\model.py", line 210, in invoke return await self.func(*args, **kwargs) File "C:\Users\ollie\PycharmProjects\Maxy Logs\main.py", line 67, in confess channel = bot.get_channel(confession.channels[str(ctx.guild.id)]) File "C:\Users\ollie\PycharmProjects\Maxy Logs\venv\lib\site-packages\discord\client.py", line 793, in get_channel return self._connection.get_channel(id) File "C:\Users\ollie\PycharmProjects\Maxy Logs\venv\lib\site-packages\discord\state.py", line 1118, in get_channel pm = self._get_private_channel(id) File "C:\Users\ollie\PycharmProjects\Maxy Logs\venv\lib\site-packages\discord\state.py", line 329, in _get_private_channel value = self._private_channels[channel_id] TypeError: unhashable type: 'list'

When i try and run the command

eager bough
#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

slate swan
#

bro stop

eager bough
#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

eager bough
#

):

frozen patio
#

Ikr

#

This dude cruising for a mute

rose gyro
#

Yea

eager bough
#

@slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan @slate swan

rose gyro
#

At this point im pretty sure he tolls

#

*trols

velvet compass
#

!mute 857785190625181698 1h investigating

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @eager bough until <t:1650056036:f> (59 minutes and 59 seconds).

slate swan
slate swan
#

πŸ˜‚

frozen patio
#

Yeah but only if we need to

#

Or we take the mutes

slate swan
#

ik lmao , i ain't dumb

frozen patio
#

😳

slate swan
#

😳

exotic maple
#

lol

slate swan
#

if it doesn't work.. then.. let's try agian lol

exotic maple
#

Let me test

slate swan
#

alr :'//

#

😭

#

!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.

short harbor
#

need help

slate swan
#

okkk wait.. ig u need to install it from github branch not from pypi

exotic maple
slate swan
#

now ```cmd
pip install discord.py @ git+https://github.com/Rapptz/discord.py

short harbor
#

i make a button with the bot
when i send msg bot replay to my msg with 2 button
i need afet i click to them delet the messege of the buttons

#

how can i do it ,

spring cape
#

Is it possible to add a feature to my discord py bot to restrict users to only be able to send images to a certain channel? Or at least to auto-delete every message that is not an image/video?

frozen patio
#

a filter variable maybe πŸ€”

frozen patio
#

In a codblock please

exotic maple
#

@slate swan

velvet compass
frozen patio
#

!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.

fresh kestrel
#

Someone ping me?

fresh kestrel
slate swan
#

what has happened to this chat

frozen patio
frozen patio
slate swan
fresh kestrel
#

I'm now getting spammed in my DMs

#

Wtf

slate swan
velvet compass
slate swan
#

whats your opinion on the new thread thats coming for this chat?

velvet compass
frozen patio
#

What thread? :OOO

slate swan
slate swan
#

check the whole conversation

open jolt
#

can anyone help me how i remove this

frozen patio
#

Ah

slate swan
#

ill for sure be there

frozen patio
#

Okimii you gave me the right link to the developer docs no?

slate swan
#

i did because?

frozen patio
#

This makes no sense

slate swan
frozen patio
slate swan
#

do you have 2.0

frozen patio
#

Like what is this?

slate swan
#

do you have pycord or 1.7.3?

frozen patio
slate swan
#

delete them

slate swan
frozen patio
#

I just use nextcord ig

slate swan
frozen patio
#

Like what?

slate swan
#

any api thats REST

frozen patio
#

Like this

slate swan
frozen patio
#

So like this yeah?

slate swan
#

thats just showing whats a restful api lol

frozen patio
#

Then what do you recommend I use

slate swan
#

a rest api is a type of an api

#

just wrap any api you would like

frozen patio
slate swan
frozen patio
#

Would it be easier to use REST

slate swan
pliant gulch
#

You can wrap the RESTful discord API

#

It doesn't have to be using the gateway

slate swan
#

andy bro hes starting

pliant gulch
#

the RESTful API isn't hard

slate swan
#

yeah

pliant gulch
#

It's the gateway

slate swan
#

and parsing them and making models

frozen patio
#

what api would you recommend that I wrap

slate swan
#

any maybe a dog api which doesnt gave much endpoints and doesnt use auth or a token and most have 2 entities like i.e big dog and small dog

frozen patio
#

mulesoft?

slate swan
#

never heard of it, wrap any api you would like that can be easier for you!

frozen patio
#

Eh I will just find something else to do

#

Dead chat

slate swan
#

πŸ˜”

frozen patio
#

That is good

magic stump
#
folder_name_head = "head/"
folder_name_head_3d = "head3d/"

#folder = os.path.join(folder_name, nick)

def head(url_2, file_name):

    file = folder_name_head+file_name+".png"
    urllib.request.urlretrieve(url_2, file)


@bot.command()
async def head(ctx, nick):
    else:

        url = f"https://minotar.net/helm/{nick}/100.png"
        file_name = nick

        head(url, file_name)

        await ctx.send(file=discord.File(f"head/{nick}.png"))```
#

head(url, file_name)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

slate swan
#

you probably forgot to await something

magic stump
#

mhm

#

idk

oblique adder
#

can I send modal using command ctx ? or is it only interaction

dapper cobalt
slate swan
dapper cobalt
slate swan
dapper cobalt
#

I'm glad to hear that catheart

slate swan
#

πŸ’œ

exotic maple
#

Hey can someone help me?

slate swan
#

can someone help me rq?

class Counter(discord.ui.View):
    def __init__(self, *, timeout=180):
        super().__init__(timeout=timeout)
    @discord.ui.button(label='Close πŸ“©', style=discord.ButtonStyle.primary)
    async def counter(self, button: discord.ui.Button, interaction: discord.Interaction):
            await interaction.send_message('test')

the error is

AttributeError: 'Button' object has no attribute 'send_message'
#

nvm i figured it out

midnight crane
#

i want to make a music bot and pointers ?

#

or advice

slate swan
#

how do i get the user that clicked the button?

boreal ravine
boreal ravine
boreal ravine
boreal ravine
exotic maple
# boreal ravine yes

I'm trying to make a feature where a user can setup a channel that command outputs are sent to

I want to use a json file to store the data of the setup channels in the guild id it was setup to

boreal ravine
exotic maple
exotic maple
sick birch
midnight crane
#

not*

sick birch
#

Music bots violate YouTube terms of service

magic stump
#

I have the same name

#

Command and function

boreal ravine
midnight crane
sick birch
exotic maple
cold sonnet
sick birch
#

Probably get terminated

meager linden
#

Hey guys so if I have message intents but my bot doesn't have slash commands. It would still work after April right?

cold sonnet
#

yes, of course

#

but you have to apply for message intents once your bot gets verified

meager linden
#

My message intents got approved

#

My bot was verified since like January of previous year

cold sonnet
#

nice I guess

meager linden
#

I've been so stuck with work, i don't have the time nor the patience to update my bot to new slash commands.

cold sonnet
#

I don't think discord likes that though

#

they'll want you to update

meager linden
exotic maple
#

When doing bot updates it takes around an hour for slash commands to sync so It takes forever to do bug tests

cold sonnet
#

no

#

you can sync a command to a guild to test

meager linden
cold sonnet
#

and it won't be available on other guilds

#

which makes it possible to have a test server

#

really cool

exotic maple
#

guilds = [] ?

meager linden
cold sonnet
#

well, you can set a guild for a command and add it to your tree

#

actually, I did forget it since I've only done this once

#

but our guy won't update for a time so I can check later

meager linden
#

I don't know if users even like slash commands but that's just me

cold sonnet
#

discord will probably update slash commands

#

they aren't flawless

cold sonnet
meager linden
#

Eh. I'm happy i got message intents lol.

#

They made me write a privacy policy

#

That I'm not storing any data

cold sonnet
meager linden
#

πŸ‘Ž πŸ‘Ž πŸ‘Ž

#

I'll show lmfao wait

#

Better to write a Google doc than rewrite the whole bot

cold sonnet
#

not much

meager linden
#

Exactly. It isn't much, but after i sent this, my message intents got approved

slate swan
#

heres my error

#
Traceback (most recent call last):
  File "C:\Users\youse\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\youse\Downloads\FlyAscent\DiscordBots\FlyAscent\Embed bot\main.py", line 221, in images
    damsg = await channel.send(embed=embed)
AttributeError: 'str' object has no attribute 'send'

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

Traceback (most recent call last):
  File "C:\Users\youse\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\youse\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\youse\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'send'```
#

channel is a string

#

type hint channel to a discord text channel like so -> channel: discord.TextChannel

#

nah i wanna so like u do .images <channel

#

as said.

#

ok one sec

#

and no need for the parenthesis in the color kwarg

slate swan
#

yes

#

tyyyy

#

πŸ’œ

slate swan
#

I wanna use pillow to make a caption command but it doesnt do anything

hushed galleon
#

looks like you should have gotten a MissingRequiredArgument error in your terminal

#

since you only typed "test" which dpy would parse as the argument for file but leaves nothing for your text parameter

slate swan
#

and how can i make it so it basically detects the image?

hushed galleon
#

you should check ctx.message.attachments to see if the list isnt empty

#

but first, did any error show up in your console

hushed galleon
#

then the command message was either not seen by your bot or a command error handler ate it

#

do any other commands in your cog work?

slate swan
#

I dont have any other commands in there but i can try adding one real quick

#

yea, other commands work in there

hushed galleon
#

hm, do you use any on_command_error handlers?

slate swan
#

not in that cog

hushed galleon
#

is the outside handler attached to your bot (i.e. a global event handler) or just a cog/command-specific handler

slate swan
#

one for the cooldown and one if a command doesnt exist

hushed galleon
#

can you paste the code

slate swan
#

The caption code or the handler?

hushed galleon
#

handler

#

basically if you have a @bot.event for on_command_error, you have to manually print out any errors you see

slate swan
#
#If command not found
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.errors.CommandNotFound):
        embed = discord.Embed(title="![cautionwarning](https://cdn.discordapp.com/emojis/957442062838558761.webp?size=128 "cautionwarning") An error has occurred!", description="**Expection: Not Found: 404**\n The command does not exist.", colour=0x992d22)
        embed.set_footer(text=f"Use {get_prefix}help.", icon_url=f"{bot.user.avatar_url}")
        await ctx.send(embed=embed)

#If cooldown
@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        embed = discord.Embed(title="", description=f"{round(error.retry_after, 2)} seconds left", colour=0x992d22)
        await ctx.send(embed=embed)```
hushed galleon
#

oh you literally do have two on_command_errors

#
  1. with @bot.event it can only store one function at a time, so only the last function is registered
  2. you dont print/re-raise the error afterwards so you cant see when command errors happen
#

what you can do is combine those two handlers into one and tack on a raise error at the end so it shows up in the terminal

frozen patio
#

I don’t think you can pass in ctx in an event.

hushed galleon
#

on_command_error does take (ctx, error) as its parameters

hushed galleon
hushed galleon
#

almost right, use elif in the middle

#

otherwise the raise error runs even if it was an CommandNotFound error

#

afterwards you can run your command again and see any errors you stumble into

hushed galleon
hushed galleon
#

Message.attachments is only a list, you need to index the first Attachment object in that list and then download it to a file using its save() method

#

!d discord.Attachment.save

unkempt canyonBOT
#

await save(fp, *, seek_begin=True, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Saves this attachment into a file-like object.
hushed galleon
#

oh actually, Attachment.read() would be more convenient when storing the image in a BytesIO object for pillow

#
import io
... 
# get the attachment from the user's message
# (this list could be empty)
attachment = ctx.message.attachments[0]

# download the image and store it in-memory
image_bytes = await attachment.read()
input_file = io.BytesIO(input_file)

# pass it to pillow and do your image processing
img = Image.open(input_file)```
worthy mantle
#

Suggest a good tutorial to start making discord bots πŸ˜—

slate swan
worthy mantle
slate swan
worthy mantle
#

it's not being developed anymore

slate swan
#

its development has been resumed

worthy mantle
#

hmm

slate swan
visual island
# worthy mantle isn't discord.py discontinued

Discord.py was discontinued on 8th August 2021 (you can see why, on this gist: https://gist.github.com/Rapptz/4a2f62751b9600a31a0d3c78100287f1). But gladly, it was back on 6th May 2022 (for more information see this gist: https://gist.github.com/Rapptz/c4324f17a80c94776832430007ad40e6).

The main reason the development was stopped was that Discord announced that all of the verified bots had to migrate to slash commands. This needed a huge rewrite and rework to the library which is not worth of time and effort.

The main reason the development was continued was that Discord again announced that it would decommission API versions 6 and 7 on May 1st, 2022. This will break all of the bots that use v1.7.3 as it is using API version 7. In order to save the ecosystem, it made sense for Danny (The creator of Discord.py) to come back.

onyx vapor
#
Ignoring exception in on_guild_remove
Traceback (most recent call last):
  File "C:\Users\****\PycharmProjects\ALL1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\***\PycharmProjects\ALL1\main.py", line 96, in on_guild_remove
    prefixes(str(guild.id))
TypeError: 'dict' object is not callable
Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\***\PycharmProjects\ALL1\venv\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\***\PycharmProjects\ALL1\venv\lib\site-packages\discord\ext\commands\bot.py", line 979, in on_message
    await self.process_commands(message)
  File "C:\Users\***\PycharmProjects\ALL1\venv\lib\site-packages\discord\ext\commands\bot.py", line 975, in process_commands
    ctx = await self.get_context(message)
  File "C:\Users\***\PycharmProjects\ALL1\venv\lib\site-packages\discord\ext\commands\bot.py", line 886, in get_context
    prefix = await self.get_prefix(message)
  File "C:\Users\***\PycharmProjects\ALL1\venv\lib\site-packages\discord\ext\commands\bot.py", line 831, in get_prefix
    ret = await discord.utils.maybe_coroutine(prefix, self, message)
  File "C:\Users\***\PycharmProjects\ALL1\venv\lib\site-packages\discord\utils.py", line 341, in maybe_coroutine
    value = f(*args, **kwargs)
  File "C:\Users\***\PycharmProjects\ALL1\main.py", line 61, in get_prefix
    return prefixes[str(message.guild.id)]
KeyError: '885790789370789938'

Can anyone help me solve this error?

boreal ravine
visual island
sick birch
mortal dove
#

Is there anywhere I can find a list of discord rate limit times? Like x per second, y per minute, etc.?

visual island
#

They aren't documented because they are dynamic and may change at any time.

mortal dove
#

By chance has anyone made one anyways?

slate swan
visual island
#

Yep, you could parse the X-RateLimit-Limit and X-RateLimit-Reset-After from a request header (You probably need to modify the source code though, but a print statement would be enough).

slate swan
#

its kinda dumb not to document ratelimits per endpoint if your still gonna send the header

#

its like not giving the answers before the exam but then giving it on the exam its just pointless like if there was a different outcome of giving the answers first

final iron
slate swan
final iron
#

idk

slate swan
#

exactly

pliant gulch
#

If it were undocumented to prevent endpoint abuse, then they wouldn't even show it in the response header

slate swan
#

in its base case i.e it would be 1/5

pliant gulch
#

Because the base limit can change without further notice from discord

slate swan
#

can it?

pliant gulch
#

What is documented right now is the global ratelimit

#

Which is 50/1s

slate swan
#

yeah

#

so theres no base limit even for endpoints?

pliant gulch
#

There is no "base" ratelimit, because there are many different endpoints

pliant gulch
#

How would there be a base ratelimit if the ratelimits are dynanmic

#

"Because rate limits depend on a variety of factors and are subject to change, rate limits should not be hard coded into your app. Instead, your app should parse response headers to prevent hitting the limit, and to respond accordingly in case you do." (https://discord.com/developers/docs/topics/rate-limits)

Discord Developer Portal

Integrate your service with Discord β€” whether it's a bot or a game or whatever your wildest imagination can come up with.

slate swan
pliant gulch
#

They are dynanmic in the sense that they can change

#

Imagine a static IP address vs a dynanmic IP address

slate swan
#

yes and i thought it was only per request and not time frame

pliant gulch
#

One can change, while the other cannot, it's static

slate swan
#

calm down jeez i know what dynamic means

pliant gulch
visual island
# pliant gulch Mostly just not documented because they are dynamic

Thanks for the information. I got this from a dev too to confirm it:

Individual rate limits are generally not documented on our API docs, and that is for good reason: they can change at any time. We make no guarantees that rate limits will remain the same, and they may end up being variable per application at some point in the future.

pliant gulch
#

Your wrapper will be hashing for the buckets, and they will have their own different ratelimits

regal flame
#

I get this error whenever I try and run my program

Ignoring exception in on_ready
Traceback (most recent call last):
  File "C:\Users\KingPower\OneDrive\Desktop\Python Projects\discordpybot\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:/Users/KingPower/Desktop/discordpybot/main.py", line 16, in on_ready
    user.send(":white_check_mark: Elim Bot has been started up!")
AttributeError: 'NoneType' object has no attribute 'send'
mortal dove
regal flame
#

I copied my ID tho

mortal dove
#

await client.fetch_user

#

try getting the user in your on_ready instead

regal flame
#

ok

slate swan
mortal dove
#

Right, forgot one shouldn't do things in on_ready, sorry πŸ˜“

regal flame
#

I am trying to make a bot that sends a message to console at a specific time but I can't seem to get it to work. Nothing happened when it hit the specified time

regal flame
#

lol

#

how does one make a task?

slate swan
#

i forgot the dir

regal flame
#

ok ty

#

i did this and it doesn't seem to work

slate swan
#

show code

#

it seems like self isnt being accessed so you dont need the argument and did you ran your bot

regal flame
#

yes

slate swan
#

does anyone know how i can make a bot run a command when a webhook thing is sent

slate swan
visual island
# regal flame

Have you started the task? It won't run unless you start it. If you haven't, it's simple: task_function.start(), so in your case it would be printer.start().

regal flame
slate swan
#

How can i add a code to send what my bot does to a webhook

regal flame
#

oh idk how to do that in python

#

i know how to do it in java tho

#

lemme check my java code

slate swan
#

πŸ’”

frozen patio
regal flame
#

but I, myself, is curious and want to look at my java code

visual island
frozen patio
#

Ok

regal flame
regal flame
visual island
regal flame
#

If you mean without the if statement yes

slate swan
#

do you know how to have a bot keep retrying?

regal flame
slate swan
#
from discord.utils import get
from discord.ext import commands

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


@bot.event
async def on_ready():
    print(f'Logged into {bot.user}')


@bot.command(aliases=['presence'])
@commands.has_permissions(administrator=True)
async def status(ctx, status_type: str, *, msg):
    if ctx.author == bot.user:
        return
    await ctx.message.delete()
    if status_type.lower() == 'p' or status_type.lower() == 'playing':
        await bot.change_presence(activity=discord.Game(name=msg))
        embed = discord.Embed(title='Status changed!', colour=discord.Colour.orange())
        embed.add_field(name=f'Status is now "Playing {msg}"!', value='Enjoy the beautiful new status!', inline=False)
        await ctx.send(embed=embed)
    elif status_type.lower() == 'l' or status_type.lower() == 'listening':
        await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=msg))
        embed = discord.Embed(title='Status changed!', colour=discord.Colour.orange())
        embed.add_field(name=f'Status is now "Listening to {msg}"!', value='Enjoy the beautiful new status!',
                        inline=False)
        await ctx.send(embed=embed)
    elif status_type.lower() == 'w' or status_type.lower() == 'watching':
        await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=msg))
        embed = discord.Embed(title='Status changed!', colour=discord.Colour.orange())
        embed.add_field(name=f'Status is now "Watching {msg}"!', value='Enjoy the beautiful new status!', inline=False)
        await ctx.send(embed=embed)


@bot.command()
@commands.has_permissions(administrator=True)
async def statusrole(ctx, role: int, *, checkstring: str):
    removeCount = 0
    if get(ctx.guild.roles, id=role):
        roleObj = get(ctx.guild.roles, id=role)
    else:
        await ctx.send(f":x: I couldn't find a role with id `{role}`")
        return
    await ctx.send(":mag: Please wait. This might take a bit")
    status_members = []
    for member in ctx.guild.members:
        for s in member.activities:
            if isinstance(s, discord.CustomActivity) and checkstring in str(s):
                status_members.append(member)
            elif roleObj in member.roles:
                await member.remove_roles(roleObj)
                removeCount += 1
    if len(status_members) == 0:
        await ctx.send(f":x: I couldn't find anybody with \"{checkstring}\" in their status")
        if removeCount > 0:
            await ctx.send(f":white_check_mark: I removed role with id `{roleObj.id}` from {removeCount} members")
        return
    for member in status_members:
        await member.add_roles(roleObj)
    await ctx.send(f":white_check_mark: Thanks for Added role with id `{roleObj.id}` to {str(len(status_members))} member(s)")
    if removeCount > 0:
        await ctx.send(f":shield: I removed role with id `{roleObj.id}` from {removeCount} members")

bot.run("")```
#

the bot searches for statuses and adds/removes a role

visual island
slate swan
#

but the its at the point where they have to do the command manually

#

for the bot to add it/remove, i want the bot to retry and search on its own

regal flame
regal flame
#

im not sure

slate swan
#

yes

#

loop so itll keep searching after a certain amount of time

#

but idk where to add the loop at

slate swan
#

reaction?

visual island
regal flame
slate swan
#

searching for status

#

look

regal flame
#

OH

slate swan
#
@commands.has_permissions(administrator=True)
async def statusrole(ctx, role: int, *, checkstring: str):
    removeCount = 0
    if get(ctx.guild.roles, id=role):
        roleObj = get(ctx.guild.roles, id=role)
    else:
        await ctx.send(f":x: I couldn't find a role with id `{role}`")
        return
    await ctx.send(":mag: Please wait. This might take a bit")
    status_members = []
    for member in ctx.guild.members:
        for s in member.activities:
            if isinstance(s, discord.CustomActivity) and checkstring in str(s):
                status_members.append(member)
            elif roleObj in member.roles:
                await member.remove_roles(roleObj)
                removeCount += 1
    if len(status_members) == 0:
        await ctx.send(f":x: I couldn't find anybody with \"{checkstring}\" in their status")
        if removeCount > 0:
            await ctx.send(f":white_check_mark: I removed role with id `{roleObj.id}` from {removeCount} members")
        return
    for member in status_members:
        await member.add_roles(roleObj)
    await ctx.send(f":white_check_mark: Thanks for Added role with id `{roleObj.id}` to {str(len(status_members))} member(s)")
    if removeCount > 0:
        await ctx.send(f":shield: I removed role with id `{roleObj.id}` from {removeCount} members")```
regal flame
#

so you want to search for when a player changes their status?

#

user*

slate swan
#

yessir

#

but as of rn

#

it only searches when someone does the command

supple thorn
#

!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
#

i want it to search'=

supple thorn
#

Oh user

#

!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...
regal flame
slate swan
#

where would i put this

supple thorn
#

I'm dumb

#

I forgot discord has a new event for this

supple thorn
unkempt canyonBOT
#

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

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

β€’ status

β€’ activity

This requires [`Intents.presences`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.presences "discord.Intents.presences") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled...
supple thorn
#

The actual right one

slate swan
#

yes

#

now i gotta find out where to put this/replace

supple thorn
slate swan
#
@commands.has_permissions(administrator=True)
async def statusrole(ctx, role: int, *, checkstring: str):
    removeCount = 0
    if get(ctx.guild.roles, id=role):
        roleObj = get(ctx.guild.roles, id=role)
    else:
        await ctx.send(f":x: I couldn't find a role with id `{role}`")
        return
    await ctx.send(":mag: Please wait. This might take a bit")
    status_members = []
    for member in ctx.guild.members:
        for s in member.activities:
            if isinstance(s, discord.CustomActivity) and checkstring in str(s):
                status_members.append(member)
            elif roleObj in member.roles:
                await member.remove_roles(roleObj)
                removeCount += 1
    if len(status_members) == 0:
        await ctx.send(f":x: I couldn't find anybody with \"{checkstring}\" in their status")
        if removeCount > 0:
            await ctx.send(f":white_check_mark: I removed role with id `{roleObj.id}` from {removeCount} members")
        return
    for member in status_members:
        await member.add_roles(roleObj)
    await ctx.send(f":white_check_mark: Thanks for Added role with id `{roleObj.id}` to {str(len(status_members))} member(s)")
    if removeCount > 0:
        await ctx.send(f":shield: I removed role with id `{roleObj.id}` from {removeCount} members")```
#

where would it go

supple thorn
#

It's a event

slate swan
#

yuh yuh

supple thorn
slate swan
#

yea

supple thorn
supple thorn
slate swan
#

ok

slate swan
#

?

supple thorn
slate swan
#

cause

#

How do I enable gateway Intend

supple thorn
supple thorn
slate swan
#

Yeah

#

but in my py 1, the user gotta do the command in order for the bot to check statuses

supple thorn
slate swan
#

ik

supple thorn
supple thorn
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 the Members and Presences intents, which are needed for events such as on_member 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.

supple thorn
#

.json()

#

Who the fuck was that

#

You didn't call json

slate swan
#
async def on_ready():
  await b.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Custom Status"))
  print("Bot Ready")
  async def threading():
    total_seconds_wait=5
    fg=0
    while total_seconds_wait:
      guil = b.get_guild()
      memberList = guil.members 
      for user in memberList :
        fla=0
        for s in user.activities:
          fla=1
          if isinstance(s, discord.CustomActivity) :
            if str(s).find('gg/') !=-1 :
              r = user.guild.get_role()
              if r in user.roles :
                continue 
              else : ```
#

for example this one right here checks statuses and gives/removes role

supple thorn
#

Robin help

sick birch
#

why is the code shaped like a line with negative slope

#

negative linear association πŸ’€

#

anyway

#

the first thing, don't change presence on_ready

supple thorn
sick birch
#

also no need to nest coroutines

#

"Flat is better than nested" I'm sure you know

slate swan
#

my current one doesnt

#

im trying to add something like that 1^ in

supple thorn
slate swan
#

idk where to put it

supple thorn
#

Like on_ready

slate swan
#
async def on_ready():
    print(f'Logged into {bot.user}')```
#

put it there?

#

do i add the before,after

#

or just the on presence update

mortal dove
#

Can anyone help? I don't get what's wrong

await ctx.send(embed = embed, view = TTT_GameView(ctx, self.bot, (ctx.author, ctx.author), ctx.author))


class TTT_GameView(discord.ui.View):
    def __init__(self, ctx, bot, players: List[discord.Member], current: discord.Member):
        self.ctx = ctx
        self.bot = bot
        self.players = players
        self.current = current

That causes this

Ignoring exception in command ttt:
Traceback (most recent call last):
  File "C:\Users\ryano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 191, in wrapped
    ret = await coro(*args, **kwargs)
  File "r:\VSCode-Projects\Discord-Bots\BiscuitBot\cogs\TicTacToe.py", line 21, in ttt
    await ctx.send(embed=embed, view = TTT_GameView(ctx, self.bot, (ctx.author, ctx.author), ctx.author))
  File "C:\Users\ryano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\context.py", line 692, in send
    return await super().send(
  File "C:\Users\ryano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\abc.py", line 1487, in send
    with handle_message_parameters(
  File "C:\Users\ryano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\http.py", line 183, in handle_message_parameters    
    payload['components'] = view.to_components()
  File "C:\Users\ryano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui\view.py", line 216, in to_components
    children = sorted(self._children, key=key)
AttributeError: 'TTT_GameView' object has no attribute '_children'

Does anyone know why? Any help is appreciated :)

boreal ravine
mortal dove
#

Ohh right, I forgot about that. Thanks!

supple thorn
slate swan
#

oh

#

where to put

#

see it gives the role this is find

supple thorn
#

Make on_presence_update in it's on event

slate swan
#

ok ok

supple thorn
slate swan
#

my fault slim

feral lichen
#

how would i get this to find the channel name of the new made ticket and send "ticket opened"

@bot.command()
async def ticket(ctx):
    guild = ctx.guild
    channel = discord.utils.get(ctx.guild.channels, name=f'{ctx.author}')
    role = discord.utils.get(guild.roles, name="Ticket Banned")
    if role in ctx.author.roles:
        await ctx.send("you cannot make tickets!")
        return
    await guild.create_text_channel(f'{ctx.author}')
    await ctx.send("ticket made!")
    await channel.send('ticket opened!')
supple thorn
frozen patio
grave summit
#

hi guys im getting an issue with discord not communicating with my bot, i have it coded so that i should recieve messages in the discord in my terminal as a test but i dont get that

#

any ideas where i might have gone wrong

frozen patio
#

Code please?

grave summit
#

how do i post in a nice fancy box like above

frozen patio
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.

grave summit
#
@client.event
async def on_ready():
    print('we are logged in')

client.run('mytoken')

@client.event
async def on_message(message):
    print(message.content)
    print(dir(message))```
#

i have imported discord

frozen patio
#

Hmm

sick birch
supple thorn
frozen patio
#

Yeah

slate swan
#

Client.run must be below everything

frozen patio
#

Your client.run should be closing your script

grave summit
#

omg am so dumb thanks guys im v new

#

yuss it worked, thank you so much

#

sorry for the stupid questionπŸ˜‚

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.

frozen patio
mellow mountain
#

i might be dumb but... i want to check if the string high is larger or equals 3 while low is range 1-3 and H is 4-6

Im a bloody beginner.

#dice_final = 3
high = (3, 4, 5)
low = (1, 2, 3)

if high == dice_final:
  #DO STUFF
if high < dice_final:
  #DO STUFF
elif high > dice_final:
  #DO STUFF

Basically i need to declare that high is an integer from 1 till 3.. but.. how? Sorry for that stupid question.

supple thorn
#

!paste @slate swan

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.

supple thorn
mellow mountain
#

its for a discord bot.. so i thought it is.

supple thorn
#

Also use =>

mellow mountain
#

high low game. πŸ˜„ Sorry.

supple thorn
frozen patio
supple thorn
grave summit
#

i have another more complex question, i want to have an input('what would you like to search? ') command that can be input through discord with an !ebay command so for example !ebay television. im not even sure what to google to find the answer of what i should put

mellow mountain
#

Alright, thanks.

frozen patio
#

Currently your code would only run events.

supple thorn
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
grave summit
#

oh yeah the code i have already done was just a test to get the bot logged in and working

grave summit
supple thorn
#

Oh you mean an argument

frozen patio
#

You need to do

supple thorn
#

Saw input so thought you were trying to wait for a user's input

grave summit
#

yes so if they type !ebay that activates the bot and searches ebay for television and then sends the url to discord

frozen patio
#

client = commands.Bot(command_prefix = "!")

supple thorn
supple thorn
frozen patio
supple thorn
frozen patio
#

to what?

supple thorn
#

Bot

frozen patio
#

Okay

grave summit
#

oh man this is confusing afπŸ˜‚

slate swan
#

Am I doing something wrong?

supple thorn
frozen patio
#

They both do the same thing

supple thorn
slate swan
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'get' is not defined

Code:

    check_role = get(ctx.message.server.roles, name='Rich Student')
grave summit
#

ok so i have done bot

supple thorn
supple thorn
grave summit
#

so now ! is a command prompt for my bot?

supple thorn
#

It's the prefix, yes

frozen patio
grave summit
#

@client.event
async def on_command('!ebay'):

supple thorn
#

But bot is generally recommended because it's descriptive of what it is

slate swan
#

check_role = discord.utils.get(ctx.message.server.roles, name='Rich Student')
AttributeError: 'Message' object has no attribute 'server'

grave summit
#

does that look ok

grave summit
#

im shooting in the dark ngl

grave summit
#

followed some video for a completely diff bot

frozen patio
#

You need to do a command

supple thorn
#

Also jist use ctx.guild.roles

slate swan
#

Have I been living under a rock or something

#

Have they updated the package?

supple thorn
supple thorn
frozen patio
#
@client.command()
async def ebay(ctx):
    await ctx.send("This is Ebay.")
#

@grave summit

#

That is a basic command

supple thorn
#

Spoonfeed

slate swan
#

It's my code from a year back

supple thorn
#

πŸ˜”

frozen patio
supple thorn
slate swan
#

Been focusing on discordgo and I wanted to try something in py

frozen patio
supple thorn
#

Wouldn't work since hazbob said he uses bot

grave summit
#

what does the (ctx) in brackets mean

supple thorn
grave summit
#

ah

frozen patio
supple thorn
frozen patio
#

Oh

#

I thought it would be the command name

supple thorn
#

No

#

It's context

frozen patio
#

The parameter(s) is *args and **kwargs

supple thorn
#

The context is inside the parameter

frozen patio
#

Yeah

#

Always have to have ctx in a command

slate swan
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'member' is not defined

They updated member too?

frozen patio
#

Yeah

#

I use nextcord Ig

supple thorn
#

You'd have to remake everything in your code

slate swan
#

I will I just need this running before I do

Whats member now?

supple thorn
#

Just start fresh

supple thorn
#

@slate swan exactly what is your code

slate swan
#

just creates a channel in a category if they have certain role

grave summit
#

once i have !ebay setup, how do i add whatever comes after that as an input

supple thorn
frozen patio
grave summit
#

ok ill google how to do that now, thank you

grave summit
supple thorn
#
(ctx, item):
    ...
grave summit
supple thorn
#

Now item is an argument

frozen patio
#

Also you have an on_message event in your code Hazbob

slate swan
#

Member is still not defined, would it be discord.Member?

supple thorn
#

Which will need to be filled or it will raised an error

frozen patio
#

I would recommend adding a line to that so the command will register

supple thorn
grave summit
#

how do i fill an argument

supple thorn
#

I don't know what it looks like

grave summit
#

ah sorry i dont really know what im on aboutπŸ˜‚

supple thorn
slate swan
#

check dms