#discord-bots

1 messages · Page 992 of 1

paper sluice
#

fairenough

jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 143, in kick
    await member.kick(reason=reason)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 568, in kick
    await self.guild.kick(self, reason=reason)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\guild.py", line 1997, in kick
    await self._state.http.kick(user.id, self.id, reason=reason)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 248, in request        
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\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: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
loud junco
#

wdym?

maiden fable
#

Like get_xxx has pos only arg since that's what makes readability better

jade tartan
#

It has all perms

loud junco
jade tartan
#

whats the code to manage kick members

maiden fable
slate swan
jade tartan
kind trellis
#
embed = discord.Embed(
  title='**NEW SMITH REQUEST!**',
  type='rich',
  colour=discord.Color(0xFF9E00))
embed.set_image = (url={picture.content})```

If `picture.content` is None, will the embed still run without the image, or should I add an if statement?
maiden fable
jade tartan
slate swan
#

Are u trying to kick a person with mod or staff role

slate swan
maiden fable
slate swan
#

!d discord.ui.Button has a style kwarg

unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
jade tartan
maiden fable
#

Add the style=

cloud dawn
heavy tangle
#

@client.command()

does putting something in () do something? idk if i can do something cool with it but i just wanna know what it means.

jade tartan
#

Am basically trying to kick a person that is a member of my server

loud junco
#

its a bit different

maiden fable
#

!d discord.ext.commands.Command see all the kwargs it supports

unkempt canyonBOT
#

class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.

These are not created manually, instead they are created via the decorator or functional interface.
loud junco
#

help me fix my error handler

#
@bot.event
async def on_command_error(ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    seccd = round(error.cooldown.get_retry_after())
    mincd = 0
    hrcd = 0
    rseccd = 0
    rmincd = 0

    if seccd > 59:  
      rseccd = int(seccd % 60)
      mincd = int((seccd - rseccd) / 60)
      if mincd > 59:
        rmincd = int(mincd % 60)
        hrcd = int((mincd - rmincd) / 60)
    else:
      rseccd = seccd
    await ctx.send(f'''
Dont spam :/ 
Try again in another **{hrcd}h {rmincd}m {rseccd}s**
''')
    
  elif isinstance(error, commands.CommandNotFound):
    await ctx.send(f'**{ctx.author.name}**, this command doesnt exist, check your spellling maybe??')
    
  elif isinstance(error, KeyError):
    await ctx.send(f'**{ctx.author.name}**, your account is either not created yet or is not in the latest version. Try `rpm start`')
    
  else:
    raise error
heavy tangle
loud junco
#

i dont have this key in db

#

and i make it run

cloud dawn
# loud junco

This error handler is for discord errors not python errors.

loud junco
#

inside a command

boreal ravine
maiden fable
cloud dawn
#

!d dict.get

unkempt canyonBOT
#

get(key[, default])```
Return the value for *key* if *key* is in the dictionary, else *default*. If *default* is not given, it defaults to `None`, so that this method never raises a [`KeyError`](https://docs.python.org/3/library/exceptions.html#KeyError "KeyError").
maiden fable
#

U can handle a KeyError inside it

loud junco
cloud dawn
loud junco
cloud dawn
loud junco
maiden fable
slate swan
loud junco
#

here

cloud dawn
# maiden fable Why?

Since keyerrors are really specific and meant to be handled anyways. If I get a key error I avoid using key indexing.

loud junco
cloud dawn
slate swan
cloud dawn
#

😂

maiden fable
cloud dawn
loud junco
maiden fable
loud junco
cloud dawn
loud junco
#

i started with javascript

#

and i raged quit after 3 months

slate swan
#
obj = {"key_one": "value_one",
             "key_two": "value_two"}

obj.get("key_three") # returns None

obj["key_three"] # raises a KeyError
maiden fable
#

Cool

slate swan
loud junco
#

ya

#

it just wont tell u the error

maiden fable
#

Agreed

cloud dawn
#

It's like doing

try:
    ... # Whole python program
except:
    pass
maiden fable
#

It once took me 3 hours to fix one React error which was related to me using Python syntax by mistake lemon_pensive

loud junco
#

relatable

jade tartan
#
@commands.has_permissions(manage_roles=True, ban_members=True)
async def kick(ctx, member: discord.Member):
    await member.kick(member) 
    await member.send("You have been Kicked from the server")
``` Is that right?
cloud dawn
#

You can't dm member that aren't in the guild.

#

You would also need to check if you actually kick that person.

jade tartan
#

But am just kicking them not banning them

#

what?

#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 145, in kick
    await member.kick(member)
TypeError: Member.kick() takes 1 positional argument but 2 were given

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

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\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: TypeError: Member.kick() takes 1 positional argument but 2 were given```
cloud dawn
#

You don't need to pass the member

sullen pewter
#

does anyone have roblox api tutorials?

cloud dawn
#

?

brittle bear
#

whenever i try to run a command in a cog with dpy 2.0 i keep getting this error

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "help" is not found
sullen pewter
# cloud dawn ?

the thing that caused the erorr and I sent the correct way to write it

sullen pewter
cloud dawn
sullen pewter
#

ic

karmic lintel
#

i want to use a command like someone uses my bot commands for 100 times in a day , my bot says "You won your daily reward"

what should i do?

cloud dawn
sullen pewter
karmic lintel
cloud dawn
jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 146, in kick
    await member.kick()
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 568, in kick
    await self.guild.kick(self, reason=reason)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\guild.py", line 1997, in kick
    await self._state.http.kick(user.id, self.id, reason=reason)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 248, in request        
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

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

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\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: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
``` My bot has perms what the hell
brittle bear
#

im having issues loading cogs from the bot

#

i just got dpy 2.0 and i start to get this issue

slate swan
#

..

#

error*

jade tartan
#

it does wait missing perms does that mean that i have to give it from the server side right?

#

cuz its thats the case i do have perms for it from server side

slate swan
karmic lintel
#

if someone uses d!drop command of my bot 100 times, then my bot says"you won daily"
how to do that?

slate swan
slate swan
jade tartan
#

ohh wait i think i found it by you saying that

jade tartan
slate swan
jade tartan
#

Yes it has admin role has administrative role

slate swan
#

try remove the adminis perms then kick

dire folio
karmic lintel
slate swan
#

if still doesnt means ur bot role is not higher from the person's role that ur trying to kick

karmic lintel
#

ohhh

dire folio
#

^

jade tartan
#

Please rephrase that again?

dire folio
jade tartan
#

ohh so i cant kick an admin member who has a admin role?

#

Ohh ok

slate swan
karmic lintel
#

i dont wanna check the user

#

its just that if d!drop command is used 100 times it say "blah blah or whatever"

slate swan
#

put i = 0

#

then

#

in ur cmd

#

put i+=1

#

then add the condition

karmic lintel
#

what is i? ... the cmnd?

slate swan
#

ez

loud junco
karmic lintel
karmic lintel
#

you too several people

loud junco
#

i = 0
i is the variable name
0 is the value

#

LOL np

#

btw learn more basic first before doing discord bot

#

if not u gonna end up like me

karmic lintel
#

yah i got it tysm

karmic lintel
loud junco
#

👍

#

good to hear it

paper sluice
#

!global

unkempt canyonBOT
#

When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.

Instead of writing

def update_score():
    global score, roll
    score = score + roll
update_score()

do this instead

def update_score(score, roll):
    return score + roll
score = update_score(score, roll)

For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.

loud junco
#

dont use global

#

just use a class

#

thats what sarthak teach me

slate swan
slate swan
loud junco
#
class Item():  
  def __init__(self, ctx):  
    self.userid = str(ctx.author.id)

    #item
    self.pogchop = db[self.userid + 'pogchop']
    self.cooked_pogchop =  db[self.userid + 'cooked_pogchop']
    self.beef =  db[self.userid + 'beef']
```example
paper sluice
loud junco
#

lemme see

#

reply on that msg

slate swan
#

L

loud junco
#

LMAO

#

wrong code?

#

?

paper sluice
#

....

loud junco
#

send the embed?

#

control c + v LMAO

#

everyone knows this

paper sluice
#

oh

#

i was talking about the embed from !global

loud junco
#

oo

#

bruh moment

#

LOL its ok

#

its replit

#

replit doing replit thing

#

LOL

#

ikr

#

k is not defined

#

what are u trying to do

slate swan
#

!e

class Noob():  
  def __init__(self):  
    self.n = 0
  def k(self):
     self.n+=1
     print(self.n)
Noob().k()

unkempt canyonBOT
#

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

1
slate swan
#

nice

loud junco
#

noice

#

thats how u do it

#

class solves everything

#

including ur daily life problem

#

like what to eat or what to wear

slate swan
#

i hate school and class ;-;

loud junco
slate swan
#

xD

loud junco
#

not classes

#

LOL

slate swan
#

now someone will pop and type !ot

loud junco
#

!ot

unkempt canyonBOT
loud junco
#

LOL

#

and what else can i add to my rpg discord bot

slate swan
#

rpg?

loud junco
#

yaya

slate swan
#

full form?

loud junco
#

u wanna take a look? i screenshot it for u

#

role playing game

slate swan
#

oh

loud junco
#

:/

slate swan
#

:\

loud junco
#

what should i add

slate swan
#

minecraft cool

loud junco
#

LOL

#

its like the child of epic rpg and minecraft

slate swan
loud junco
#

ye

#

i added eat

#

but to restore hp

#

no hunger bar

slate swan
#

oh ye

loud junco
#

u wanna try the bot?

slate swan
#

uh ok

loud junco
#

and tell me what else to add

slate swan
#

did u added that noob enderman!!

loud junco
#

BRUH yes

#

enderman is pro tbh

slate swan
#

and those noob aim bots skele!!

loud junco
#

kayya be writing a long essay telling us to !ot

slate swan
loud junco
#

LOL

paper sluice
#

what did u make a game? what is going on?

loud junco
slate swan
#

minecraft in dc

loud junco
#

kinda

#

but noob

paper sluice
#

ah k

loud junco
#

kayya be writing a REAL LONGGGGGG ESSAY

loud junco
#

get warned for advertising KEKW

dire folio
loud junco
#

sure

paper sluice
loud junco
#

AWHAWHAHAW

#

hi

sick birch
#

Only text inputs are supported at the moment

#

For that reason they’re quite limiting

#

I’d like to see more components like dropdowns, radio buttons, sliders, etc

slate swan
#

back

#

literally

#

snail typer?

loud junco
#
@bot.event
async def on_command_error(ctx, error):
  if isinstance(error, commands.CommandOnCooldown):
    seccd = round(error.cooldown.get_retry_after())
    mincd = 0
    hrcd = 0
    rseccd = 0
    rmincd = 0

    if seccd > 59:  
      rseccd = int(seccd % 60)
      mincd = int((seccd - rseccd) / 60)
      if mincd > 59:
        rmincd = int(mincd % 60)
        hrcd = int((mincd - rmincd) / 60)
    else:
      rseccd = seccd
    await ctx.send(f'''
Dont spam :/ 
Try again in another **{hrcd}h {rmincd}m {rseccd}s**
''')
    
  elif isinstance(error, commands.CommandNotFound):
    await ctx.send(f'**{ctx.author.name}**, this command doesnt exist, check your spellling maybe??')
    
  elif isinstance(error, KeyError):
    await ctx.send(f'**{ctx.author.name}**, your account is either not created yet or is not in the latest version. Try `rpm start`')
    
  else:
    raise error
```someone help
#

key error not handled

#

and its spamming my console

loud junco
supple thorn
#

:0 kayya got tired of a anime avatar

#

Nevermind it's a gif

vernal pike
#
from dhooks import Webhook
import cv2
import time
WEBHOOK_URL = "https:/discord.com/api/webhooks/1"
cam=cv2.VideoCapture(0)
last_recorded_time = time.time() # this keeps track of the last time a frame was processed
while True:
    curr_time = time.time() # grab the current time

    # keep these three statements outside of the if statement, so we 
    #     can still display the camera/video feed in real time
    suc, img=cam.read()
    #operation on image, it's not important
    cv2.imshow(...)

    if curr_time - last_recorded_time >= 2.0: # it has been at least 2 seconds
        # NOTE: ADD SOME STATEMENTS HERE TO PROCESS YOUR IMAGE VARIABLE, img

        # IMPORTANT CODE BELOW
        last_recorded_time = curr_time
#

how to fix it dont sends files

#
1: take camera capture every 2 second
2: save it like %pcname%_capture.jpg
supple thorn
vernal pike
#

#?

supple thorn
vernal pike
#

alrdy did that

supple thorn
vernal pike
#

its finished

#

they close it

slate swan
#

ahem ahem why does everybody come off to the discord bots channel to ask random questions....or I wonder if the same happens elsewhere....

karmic lintel
#
i = 0
i += 1

if i == 100:
   await text_channel.send('100 turns over')
   i = 0

why isn't my variable i resetting?

vernal pike
#

30minuts

slate swan
#

you have to setup a loop

i = 0

while i =< 100:
  await channel.send()
  i += 1
karmic lintel
#

oh loops

slate swan
#

thats basic python so ¯_(ツ)_/¯

karmic lintel
#

my bad, i got now!

#

'-'

slate swan
#

sheesh

#

why not use the on_command event for that?

karmic lintel
#

pokemon lets go pikachu is been downloaded in my background so net slow

slate swan
#

and store it in botvars

karmic lintel
#

i'll try ❤️

dapper tapir
#

currently i got this
how would i make this delete the message that triggered it?

        if "esp" in message.content:
         await message.reply('Please do not call out cheaters. Make a ticket here [#952679827046006804](/guild/267624335836053506/channel/952679827046006804/)', mention_author=True)```
sick birch
#

a command or all commands?

dapper tapir
#

but like how?

#

this is the only thing i dont know how to do lmao

karmic lintel
#

just delete it

dapper tapir
#

could you give me a example on how this would work

karmic lintel
#

ya only 1

unkempt canyonBOT
#

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

Deletes the message.

Your own messages could be deleted without any proper permissions. However to delete other people’s messages, you need the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission.

Changed in version 1.1: Added the new `delay` keyword-only parameter.
karmic lintel
slate swan
#
bot.commands_count = {}

@bot.listen("on_command")
async def commands_counter(ctx: commands.Context):
  if ctx.command.name in bot.commands_count:
    bot.commands_count[ctx.command.name] += 1
    return True
  bot.commands_count[ctx.command.name] = 1
  return True

that would work, wont it?

sick birch
dapper tapir
karmic lintel
#

ohh my mistake

karmic lintel
dapper tapir
sick birch
#

Not sure if “on_command” is an event

sick birch
#

I see

dapper tapir
torn sail
sick birch
#

That’s more of an all command pre command hook

slate swan
#

yep

supple thorn
#

Wait isn't delete_after only for deleting the bot's message?

dapper tapir
#

i still dont get what i need to do?

brave forge
#

how will my attitude towards you change when I finally learn this damn disocrd.py . I will be able to open my server on this and I will ban all pindos for English

torn sail
dapper tapir
supple thorn
torn sail
karmic lintel
#

if == 100:
await channel.send('1234')
set i = 0

dapper tapir
#

i was jut letting him know

olive osprey
dapper tapir
#

thank you so much

supple thorn
olive osprey
supple thorn
olive osprey
brave forge
#

@slate swan do you know how to make two reactions to a command type you write a command, a message appears with two reactions, you click on one, one appears and you click on the other, another message appears??

#

@supple thorndo you know how to make two reactions to a command type you write a command, a message appears with two reactions, you click on one, one appears and you click on the other, another message appears??

supple thorn
#

What

slate swan
#

would an async check work?

strong vector
#
Bot.py:: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  bot.load_extension("cogs."+str(cog))
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

is there an away to await it?

for cog in cogs:
    bot.load_extension("cogs."+str(cog))
supple thorn
brave forge
#

@slate swan do you know how to make two reactions to a command type you write a command, a message appears with two reactions, you click on one, one appears and you click on the other, another message appears??

strong vector
supple thorn
strong vector
supple thorn
strong vector
supple thorn
#

You could subclass commands.Bot and put your load_extension inside the setup_hook and await it there

supple thorn
#

Ask ashley

#

👀

zinc phoenix
#

Hello, do you guys know any good weather apis for discord bots

brave forge
#

@slate swan after user = await self.bot.wait_for('reaction') what you need to write

strong vector
#

not good english talker

slate swan
supple thorn
#

There's a weather section here

#

Check them out

zinc phoenix
paper sluice
strong vector
slate swan
#

@strong vector wait

strong vector
supple thorn
strong vector
#

hm

supple thorn
#

Watch penguin copy that code and come back with errors later

strong vector
winged bone
slate swan
slate swan
winged bone
supple thorn
supple thorn
winged bone
slate swan
#

¯\_(ツ)_/¯

slate swan
winged bone
#

Because of something called lambda calculus

#

but don't ask me about that

supple thorn
#

Silent da

#

Be a lamb and add these 2 ints together

winged bone
#

🐑-duh

strong vector
#

@slate swan i reommand creating a fuc can handle everything

slate swan
strong vector
slate swan
#

@strong vector that was for you, but I prefer subclassing Bot (rather than the second one)

slate swan
#

those comments are almost all wrong

#

💀

#

now god okimii shall correct ahem ahem

#

or maybe you know what

strong vector
#

@slate swan

async def wait_for(timeout, message ,colour=discord.Color.red()):
    try:
        SelfComd = await bot.wait_for(
            "message",
            check=lambda message: message.author == ctx.author and message.channel == ctx.channel,
            timeout=timeout
            )
        return False,SelfComd
    except TimeoutError as e:
        E = await Embeded(description=f'timeout, bye ❌', colour=colour, text = "timeout Error")
        return True,None

Embeded

async def Embeded(title=None,description=None,colour=None,text=None):
    embed = Embed(description=description, colour=colour)
    embed.set_footer(text = text)
    return await ctx.send(embed=embed)

i made this fuc when i was working on my bot

slate swan
slate swan
# slate swan now god okimii shall correct ahem ahem
  1. the bot class isnt "built in" its just a class in the discord.py library
  2. an init dunder is the initiate of the class which gets called on a class initiate or a creation of an instance which __new__ gets called as well
  3. super accesses an instance of the parent class.
  4. you deleted the message
brave forge
slate swan
slate swan
supple thorn
#

Someone starred my wrapper

#

Joy ducky_drawing

slate swan
slate swan
slate swan
supple thorn
slate swan
#
  1. that is correct
  2. yes
#

most meta classes are a subclass of type and not obj yes

#

Hello, small help
how can I make a button which when I press execute a command?
I tried to make the button sends the command on the channel so that bot see it and respond to it
but bot seems to not respond to commands which sent from the bot itself
any ideas?

slate swan
supple thorn
#

English?

slate swan
#

💀

slate swan
winged bone
#

I program in French don't you?

slate swan
#

bro

supple thorn
slate swan
#

my keywords are in spanish what do i do

slate swan
unkempt canyonBOT
supple thorn
slate swan
#

lmaooo

supple thorn
#

They show up at the most random of places

slate swan
#

any help 😦

supple thorn
slate swan
#

yes

supple thorn
slate swan
#

in a year

winged bone
#

@supple thorn Already slaughtered a lamb today?py lamb = lambda food: eat(food) del lamb

supple thorn
#

Don't be like dani

sick birch
#

Let's keep it on topic guys

strong vector
# slate swan pardon? what do I do with this?

it is a fuc works like every fuc but await
what it does its wait for ___

timeout:

The timeout parameter is passed onto 
asyncio.wait_for(). By default, it does not timeout. Note that this does propagate the asyncio.TimeoutError for you in case of timeout and is provided for ease of use.

try statement
handle the timeout error
if timeout error then
return True,None
true mean error been handle so it must tell the user he took a long time to response
None that mean couldnt take the user input

elif not timeout error then
return False,selfcmd
as you see the False that mean there is no errors
selfcmd that is the wait_for self

supple thorn
slate swan
slate swan
sick birch
sick birch
#

Like a slash command?

slate swan
#

yes

#

but the author is the bot itself

supple thorn
sick birch
#

You don't call slash commands from within your code

#

It has to be dispatched by the gateway

slate swan
#

I made the button send it on the channel

sick birch
#

How do you "send" a slash command?

slate swan
#

actually my commands starts with . not /

supple thorn
slate swan
#

but here is my button callback

strong vector
sick birch
sick birch
strong vector
slate swan
sick birch
#

If it's not a slash command you should be able to invoke() it

slate swan
#

sorry explain more

slate swan
#

all what I want is to execute command in the bot when user clicks a button

#

I thought in sending the command from the bot ad bot will respond

sick birch
#

Don't think so

#

might be useful but you have to pass in a context

slate swan
#

I used this also

#

but no luck

strong vector
unkempt canyonBOT
#

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

4
slate swan
#

there is also one that was like <s:somekind of code>

strong vector
slate swan
slate swan
slate swan
slate swan
#

hm?

paper sluice
#

Hello

slate swan
#

hi

strong vector
slate swan
slate swan
#

nvmd

slate swan
# slate swan in code

!e

from datetime import datetime

print(datetime.utcnow().timestamp())

that should work ig?

unkempt canyonBOT
#

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

1650638905.114956
slate swan
#

yeah ^^

strong vector
#

i don't mean your code doesnt look nice

slate swan
sick birch
slate swan
#

after that ill make a ratelimiter and then a better restclient and then a cache impl and then models or something else

sick birch
#

so good luck. much respect for trying

strong vector
# slate swan I know?

what, do you think now, do you want the code or not.
the fuc is so helpful with big codes.

slate swan
paper sluice
#

now + ??

winged bone
strong vector
slate swan
cedar niche
#

Hello

paper sluice
strong vector
#

not good at english

slate swan
cedar niche
#

i'am making a team

slate swan
cedar niche
#

To make projects and bots

paper sluice
#

!e

import datetime
import time

print(time.mktime(datetime.datetime.now().timetuple()))
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

1650639265.0
paper sluice
#

github copilot ftw

slate swan
low latch
#

@cedar niche please don't advertise your team/server here

slate swan
#

h?

winged bone
slate swan
cedar niche
#

know*

paper sluice
oblique adder
#

How do I make captcha harder to bypass ?

slate swan
#

its already hard

oblique adder
#

someone bypassed it

fathom sequoia
#

O

sick birch
slate swan
oblique adder
paper sluice
#

show ur code

strong vector
sick birch
slate swan
oblique adder
slate swan
#

im confused what to do

sick birch
#

Said again, not much you can do about it

#

It's just luck really that you get an easy captcha an OCR can pick up

paper sluice
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

1663266085.292083
slate swan
#

how

paper sluice
#

wdym

slate swan
#

i just tried that

#

and it didnt worked for me

paper sluice
#

¯_(ツ)_/¯

slate swan
#

full same

paper sluice
#

whats the err?

slate swan
#

ig it was an import issue

paper sluice
#

the error tells you what the issue is

slate swan
#

ye

#

it was the import issue

cloud dawn
slate swan
#

lol

cold sonnet
#

!e
print("Yes" if 0.6 + 0.3 == 0.9 else "No")

unkempt canyonBOT
#

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

No
cloud dawn
slate swan
#

!e
print("Yes" if "Y " == "Y" else "No")

unkempt canyonBOT
#

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

No
sick birch
unkempt canyonBOT
#

@sick birch :white_check_mark: Your eval job has completed with return code 0.

0.19999999999999996
sick birch
#

very good at math indeed

slate swan
#

see bad at letters

cold sonnet
#

you put a space

pliant gulch
slate swan
cold sonnet
#

they're just very specific

slate swan
#

words are better than numbers

cold sonnet
#

cap

sick birch
spring flax
#

Why's is like that?

sick birch
#

It's just how computers do floating point math

slate swan
#

words are 26 and numbers only 10

cold sonnet
slate swan
#

more combination +more security

cold sonnet
sick birch
#

go ahead and read IEEE 754 for more info

cold sonnet
#

we all understood it but I'm not satisfied with that

slate swan
#

ok so

#

if password or code len is 2

pliant gulch
slate swan
#

then numbers can only be like 1 2 3 4 5 6 7 8 9
ex can be many

pliant gulch
#

Windows and Linux have different ways of doing floating point math

sick birch
pliant gulch
#

They end up with different numbers sometimes

cold sonnet
#

uh

slate swan
#

but not much combinations as words

sick birch
#

I think it also has a bit to do with the interpreter implementation?

warm tulip
#

hey guys can someone help me

slate swan
sick birch
warm tulip
#

how i can add my bot a welcomer that dms member in private

cold sonnet
#

there's a high chance we can do that

cloud dawn
#

My calculator (a computer) ends up with 0.9 folks, time to switch.

cold sonnet
#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

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

use this event

#

then you have a member object aswell

#

so you can do await member.send("Hello hi hello")

slate swan
#

6541+{$!FK:KKSALDH@)(%FLAF~(YHR$@"}{!#(&
this will take years to be cracked

#

by brute force

sick birch
#

brute forcing isn't all that effective

pliant gulch
#

inb4 quantum computers

slate swan
#

hashing cannot be

cold sonnet
#

why would someone with a computer like that want to hack someone

cloud dawn
#

rainbow tables

sick birch
#

that's one

slate swan
cloud dawn
#

Not like windows hard to bypass

sick birch
#

social engineering, unsecured systems, etc

pliant gulch
cloud dawn
#

Anyways Discord bots huh

cold sonnet
#

no

cloud dawn
#

quantum computer running Discord bots.

cold sonnet
#

yes

slate swan
#

python dc must have a channel with this topic

sick birch
slate swan
#

uh

sick birch
#

beat you to it

cold sonnet
#

I don't think we helped dark light very well

slate swan
#

@warm tulip pls ask once again sorry

#

nvmd

#

imagine downloading rainbow tables without wifi

cold sonnet
#

sending someone a dm on_member_join

slate swan
#

should i...... do that

cloud dawn
#

send ads

slate swan
#

spoonfeeding?

slate swan
cloud dawn
#

Amazon searcher but make all link affiliate.

pliant gulch
#

Serve ADs when running commands\

cold sonnet
#

make them unskippable

cloud dawn
slate swan
#

if discord has ads then its like stack here

#

imagine white ads in dark theme

cloud dawn
#

Speaking about ads

#

raid shadow legend

cold sonnet
slate swan
austere solstice
#

!d discord.Embed

slate swan
#

..

maiden fable
slate swan
cloud dawn
#

How have you missed that ad

maiden fable
#

Lmao it is everywhere

cloud dawn
#

Not as much as back in corona but yeah.

cold sonnet
#

it is still

velvet haven
#
if msg.startswith("g!tictactoe"):
        def check(m):
          return m.content.lower.startswith("g!place ") and m.channel == channel
        try:
          mg = await client.wait_for("message",timeout=25.0,check = check)
        except asyncio.TimeoutError:
          gameOver = True
          await channel.send("You lost because you did not respond in time")```
#

is it correct

cloud dawn
velvet haven
#

yea

cold sonnet
#

m.content.lower()

cloud dawn
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client"), This class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
velvet haven
#
@commands.Cog.listener()
    async def on_message(self,message):
      global gameOver
      msg = message.content.lower()
      channel = message.channel
      if msg.startswith("g!tictactoe"):
        def check(m):
          return m.content.lower.startswith("g!place ") and m.channel == channel
        try:
          mg = await client.wait_for("message",timeout=25.0,check = check)
        except asyncio.TimeoutError:
          gameOver = True
          await channel.send("You lost because you did not respond in time")```
cold sonnet
velvet haven
#

ohk

maiden fable
velvet haven
cold sonnet
#

it is a Bot instance though

#

clients don't have cogs

slate swan
cold sonnet
maiden fable
cold sonnet
#

bad

velvet haven
#

it says mg is defined but not used in my code editor

velvet haven
#

what?

cold sonnet
#

hm, they are both used

#

oh mg

slate swan
#

..

velvet haven
#

ye

cold sonnet
#

well it's not used

#

what do you wanna use it for

#

check what's after g!place

slate swan
velvet haven
#

for timeout error

maiden fable
slate swan
#

ok

#

..

velvet haven
cold sonnet
#

yeah check what's the int

#

so you can use it

velvet haven
#

huh?

cold sonnet
#

😔

velvet haven
#

it varies from 0-8

#

ok i get it

cold sonnet
#

gtg sorry

#

anyways good luck

slate swan
#

im here

velvet haven
#

imma test it real quick

#

ah it works

slate swan
#

nice

olive osprey
#

Just a quick question, can I do this somehow in an one liner?

x = str(guild.bans)
return len(x)
carmine sundial
high sun
#
return len(str(guild.bans))

This could work, you may even leave out the str() iirc

olive osprey
carmine sundial
#

yeah why is the str() there?

olive osprey
#

I'm converting it from a method into a string, else I can't use len

carmine sundial
#

doesn't that return a list tho?

olive osprey
#

Nope

high sun
#

But it doesn't return a method

carmine sundial
#

also why would the string length be useful?

olive osprey
unkempt canyonBOT
#

async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

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

Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list.

Examples

Usage...
slate swan
olive osprey
#

^

slate swan
#

!d discord.Role

unkempt canyonBOT
#

class discord.Role```
Represents a Discord role in a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild")...
#

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

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

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

in the roles parameter can I use id?

olive osprey
#

What's atomic?

slate swan
#

or do I need to fetch the role first

high sun
unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
slate swan
#

Do I need to provide reason and atomic?

#

or is that optional

flint isle
#

@bot.command(name='msg')
async def msg(ctx, mid):
    message = await fetch_message(id=mid)
    If message.reactions:
      #message has reactions
      print('message has reaction')
    Else:
      #message as no reactions 
      return

Error

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 31, in <module>
    start(fakepyfile,mainpyfile)
  File "/data/user/0/ru.iiec.pydroid3/files/accomp_files/iiec_run/iiec_run.py", line 30, in start
    exec(open(mainpyfile).read(),  __main__.__dict__)
  File "<string>", line 51
    If message.reactions:
       ^
SyntaxError: invalid syntax

[Program finished]
olive osprey
#

"If"

flint isle
#

Ok thx

olive osprey
#

Also, else instead of Else

slate swan
#

it gives unknown message error lol

high sun
#

!d discord.Guild.get_role

unkempt canyonBOT
#

get_role(role_id, /)```
Returns a role with the given ID.

Changed in version 2.0: `role_id` parameter is now positional-only.
empty kernel
#

I've never created a discord bot. Are there any high level resources that talk about the kinds of things you can do with discord bots?

flint isle
#

@bot.command(name='msg')
async def msg(ctx, mid):
    message = await fetch_message(id=mid)
    if message.reactions:
      #message has reactions
      print('message has reaction')
    else:
      #message as no reactions 
      return

Error

loading embed cog
Ready!
Ignoring exception in command msg:
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "<string>", line 50, in msg
NameError: name 'fetch_message' is not defined

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

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/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: NameError: name 'fetch_message' is not defined
olive osprey
high sun
#
@bot.command(name='msg')
async def msg(ctx, mid):
    message = await ctx.fetch_message(id=mid)
    if message.reactions:
      #message has reactions
      print('message has reaction')
    else:
      #message as no reactions 
      return
empty kernel
slate swan
#

Hey guys my command works perfectly fine but then when I add this it says unknown message.
role = ctx.guild.get_role(963581797764055070)
await member.add_roles(role)

sick birch
#

Can we see the full traceback?

olive osprey
#

Unknown message? Thonk

slate swan
#

Ignoring exception in command queue:
Traceback (most recent call last):
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\bopae\Downloads\Self made\Orders\KWS's order\main.py", line 188, in queue
queuetoken(token)
File "c:\Users\bopae\Downloads\Self made\Orders\KWS's order\main.py", line 76, in queuetoken
transport = paramiko.Transport((vps_ip, 22))
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\paramiko\transport.py", line 433, in init
addrinfos = socket.getaddrinfo(
File "C:\Program Files\Python39\lib\socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

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

Traceback (most recent call last):
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\bot.py", line 994, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 894, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 176, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: gaierror: [Errno 11001] getaddrinfo failed
Ignoring exception in command queue:
Traceback (most recent call last):
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 167, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\bopae\Downloads\Self made\Orders\KWS's order\main.py", line 173, in queue
await ctx.message.delete()
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\message.py", line 1147, in delete
await self._state.http.delete_message(self.channel.id, self.id)
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\http.py", line 331, in request
raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message

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

Traceback (most recent call last):
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\bot.py", line 994, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 894, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\bopae\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 176, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10008): Unknown Message

high sun
#

In what function are you using this?

slate swan
#

-queue

#

That is to add a line to an embed's description

olive osprey
#

Code?

slate swan
#

ok wait

worldly solstice
#

Heya, whats a clean and fairly easy way to host my bots online 24/7? Any suggestions? Thanks in advance 🙂

high sun
slate swan
#
#queue
@bot.command()
async def queue(ctx, member:discord.Member, amount, token):
    await ctx.message.delete()
    chnl = bot.get_channel(int(queue_channel))
    message = await chnl.fetch_message(int(queue_message))
    embeds = message.embeds
    embed = embeds[0]
    emb_dict = embed.to_dict()
    try:
        description = emb_dict["description"]
        newemb = discord.Embed(title="kWS's Queue", description=f"{description}" + "\n" + f"{member.mention} = {amount} claims")
    except:
        newemb = discord.Embed(title="kWS's Queue", description=f"{member.mention} = {amount} claims")
    await message.edit(embed=newemb)
    role = ctx.guild.get_role(963581797764055070)
    await member.add_roles(role)
    time.sleep(5)
    restart()
    ```
#

this is command

olive osprey
#

Well, the list is out of range lol

high sun
slate swan
#

guild is not defined

high sun
#

No I see

olive osprey
high sun
#

I see

olive osprey
slate swan
#

Aight will try that lol

olive osprey
#

god my english is so broke today

slate swan
#

ctx.message.delete is not message tho

high sun
#

Message not found, when trying to delete the message

high sun
olive osprey
#

^

worldly solstice
olive osprey
slate swan
#

it's the channel id

olive osprey
#

is queue a d.py function?

slate swan
#

wait wdym?

olive osprey
#

You should maybe considering just putting the channel ID in there

slate swan
#

Well, I found out when I put the await ctx.message.delete() at the end it adds the role succesfully

#

But it adds the person to the queue twice

#

for no darn reason

olive osprey
#

Is your bot running multiple times?

flint isle
#

Ok so the following code won't enter the second if statment. I'm trying to get it to check if a message has a ✅ reaction

@bot.command(name='msg')
async def msg(ctx, mid):
    message = await ctx.fetch_message(id=mid)
    if message.reactions:
      #message has reactions
      print(mid)
      if await ctx.fetch_message(id=mid) == '✅':
      	await ctx.send('checkmark', delete_after=5)
      	print('if statment 2')
      	return
      print('message has reaction')
      await ctx.send('reaction detected',delete_after=10)
    else:
      #message as no reactions 
      return
slate swan
#

That's a good idea thanks
I think my friend might be running the bot too

flint isle
slate swan
#

It works! thank you guys!

olive osprey
#

No problem, have fun working on your bot!

flint isle
olive osprey
#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
olive osprey
#

@flint isle ^

flint isle
olive osprey
#

Existing ones?

flint isle
#

Its command that looks at a message that is selected and checks for the checkmark reactikn

olive osprey
#

I don't really understand what you mean

flint isle
#

I'll try that thx

#

So copy the checkmark and paste it in?

olive osprey
#

Don't mind that emoji lol, yes just copy paste it in without a space

flint isle
#

I don't understand lol. I tried both but it didn't work

#

No. I'm trying to get the command to copy the message to another channel if it had the checkmark on it previously

echo wasp
#

Good morning, afternoon, night I would like to know how to get the member count out of guild.members

echo wasp
echo wasp
# sick birch `len(guild.members)`

[<Member id=8938564683136217118 name="Bro's SMP Bot" discriminator='7548' bot=True nick=None guild=<Guild id=804564012184977438 name="Bro's Gun Server (Season 1)" shard_id=None chunked=False member_count=81>>] (not valid ids)

sick birch
#

That's the only one it shows?

echo wasp
#

Yep but it shows member count

sick birch
#

!intents

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.

olive osprey
sick birch
flint isle
#

loading embed cog
Ready!
911326876562227261
[<Reaction emoji='✅' me=False count=1>]
message has reaction

unkempt canyonBOT
#

property member_count```
Returns the member count if available.

Warning

Due to a Discord limitation, in order for this attribute to remain up-to-date and accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified.

Changed in version 2.0: Now returns an `Optional[int]`.
echo wasp
sick birch
#

well you need intents.member = True to get member info

echo wasp
sick birch
#

main

echo wasp
echo wasp
vale wing
#

@sick birch could you recommend a solution for discord bot project structure with docker

sick birch
#

The project structure is up to you

#

Docker only acts as a mini-VM to run your code

vale wing
#

Well not exactly the structure

sick birch
#

It doesn't care what code or how your code is structured

sick birch
echo wasp
#

Ok

olive osprey
drifting arrow
#

does discord no longer support setting a footer for embeds?

vale wing
#

So I have the AI model file that I want to have access to even outside the container and I just need to find out whether to launch the training algorithm inside of the docker or outside

olive osprey
sick birch
vale wing
#

Yes -v tag seems like a solution but I haven't tested it yet

drifting arrow
#

then why isnt this working?

@commands.command()
    async def age(self, ctx, submittedtext):
        bmapi = BMAPI()
        user_ids = await bmapi.get_ids(submittedtext)
        if user_ids:

            playerinfo = await bmapi.playerinfo(user_ids["bmid"])
            embed = discord.Embed(
                title=f"{playerinfo['playername']} - {playerinfo['steamid']}",
                url=f"https://www.battlemetrics.com/rcon/players/579979635{user_ids['bmid']}",
            )
            embed.add_field(name="Test", value="Test", inline=False)
            embed.set_footer("This was made by a chad.")
            
            await ctx.send(embed=embed)

when I remove the footer it works but with it, nothing happens

sick birch
vale wing
#

I finally understood that volumes remain in docker container forever and just persist data and bind mounts let you persist data + store the file in more accessible place

drifting arrow
drifting arrow
olive osprey
#

!d discord.Embed.set_footer

unkempt canyonBOT
#

set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.

This function returns the class instance to allow for fluent-style chaining.
vale wing
#

See it has kwarg-only params

#

Everything after * is kwarg only

drifting arrow
vale wing
#

And yeah as for "no error in console" you probably have bad error handler that eats the errors

#

It would certainly raise an error

sick birch
#

Do you have on_command_error anywhere in your code?

vale wing
#

Make sure you have

else:
    raise error```
in your error handler or make another informer about unexpected exceptions
olive osprey
#

If I remember right, it doesn't throw any error, but I'm not sure

vale wing
#

TypeError most likely

drifting arrow
vale wing
#

!e ```py
def f(*, e):
pass

f(20)```

unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<string>", line 4, in <module>
003 | TypeError: f() takes 0 positional arguments but 1 was given
olive osprey
#

Nevermind, it does throw an error

TypeError: set_footer() takes 1 positional argument but 2 were given
vale wing
#

Yeah see

rapid jetty
#

I'm looking for a partner that work with discord.py and know how to make slash commands

slate swan
vale wing
#

I know how to make slash commands with dpy but I don't like their implementation so imma pass

sick birch
#

me neither

vale wing
#

Oh heck undefined variables

olive osprey
slate swan
#

ill make a better impl than dpy for slash commands😳

sick birch
slate swan
sick birch
#

For some reason all the forks and even d.py smush them together

vale wing
slate swan
sick birch
slate swan
#

its called nakano😳

vale wing
#

😳

drifting arrow
#

slithers away back into whatever dark corner he slithered out from

stone beacon
#

Mi gusta

slate swan
#

😏

#

i have culture

#

copy pasted?

olive osprey
#

Where's the problem

#

And why are so many variables undefined

vale wing
#

Define your variables 👌

#

Clearly the best solution

slate swan
#

seems like it

olive osprey
#

bruh

slate swan
#

having so much undefined vars without noticing🤨

olive osprey
#

Do you know the basics of Python?

vale wing
#

What service to use to make good docs for a discord bot

#

Besides HTML + CSS cuz I am too lazy

olive osprey
#

whaz

#

So, you don't know if you know the basics of Python?

#

Learn basic Python Define your variables, that's it

drifting arrow
#

I have to use slash commands if my bot will be used on multiple discords correct?

olive osprey
vale wing
#

Isn't it like for code

rapid jetty
#
@bot.command()
async def pprate(ctx):
  pp_list = []
  n = random.randint(0, 12)
  embed = discord.Embed(title="pprate", description=f"Your pp {pp_list[n]}"
rapid jetty
#

you can do this way

#

ok

vale wing
#

I meant docs for bot, like carl has

#

I could build a whole site ofc but wondering if there are ready solutions for that

#

Not really

#

Well lemme show you carl's

dull terrace
#

anyone else finding their bot is taking ages to connect?

vale wing
#

It seems like they are using some wiki engine

rapid jetty
#

it worked?

vale wing
dull terrace
#

No i mean like right now, i don't know if my internet from home is just messed up rn

vale wing
#

For my bot which is in > 100 it takes around 2 pins

dull terrace
#

doesn't usually take this long

rapid jetty
#

I forgot the await, lemme fix it

vale wing
rapid jetty
#
@bot.command()
async def pprate(ctx):
  pp_list = []
  n = random.randint(0, 12)
  embed = discord.Embed(title="pprate", description=f"Your pp {pp_list[n]}"
  await ctx.send(embed=embed)
vale wing
#

K

#

Seems like HTML is the only way 😩

rapid jetty
#

just put the PPs inside the pp_list, like you made before

vale wing
#

You could just multiply = symbol on randint if you want to have differing length

rapid jetty
#

????

slate swan
#

you can just f"8{'='*random.randint(1,16)}D"

olive osprey
#

bruh

#

Did you copy paste the code from somewhere?

slate swan
olive osprey
#

Man, it looks like to me that you don't know the basics of Python, either you can continue doing "stupid" stuff, or you learn Python first. I suggest the second one, I'm just trying to help you, it's really better to learn the basics first

rapid jetty
#

What do you put here?

#

oh

#

lol

olive osprey
#

bruh

slate swan
olive osprey
#

What

#

I think he was asking what the other guy did put there lol

slate swan
#

oh

rapid jetty
#

I know how to use

olive osprey
slate swan
#

no contextpithink

rapid jetty
#

np

slate swan
rapid jetty
#

I dont think so

slate swan
#

depends on the library youre using

olive osprey
#

Didn't you just say that you didn't copy the code

slate swan
#

im out if its pycord

#

and i have a feeling that it is.

rapid jetty
slate swan
olive osprey
#

What do you mean with "watching the video"

slate swan
slate swan
#

is it open source yet?

#

don't use thrid party libraries for slash commands
use discord.py master or a fork

slate swan
#

i will maybe next week when i have the event system ready

rapid jetty
slate swan
rapid jetty
#

You said it'll have slash commands right?

slate swan
#

💀

slate swan
#

new of the api

#

so all endpoints will be in it

rapid jetty
#

no

rapid jetty
slate swan
#
for i3 in mycursor:
    rank +=1
    if rank == 1:
      user_string+=f"**1.** | User: <@{i3[0]}> - {i3[2]} Tickets\n"
    elif rank == 2:
      user_string+=f"**2.** | User: <@{i3[0]}> - {i3[2]} Tickets\n"
    else:
      user_string+=f"User: <@{i3[0]}> - {i3[2]} Tickets\n"```
Error;
 ```   rank +=1
TypeError: can only concatenate str (not "int") to str```
sick birch
#

Oh my

#

Well put 👏

slate swan
#

yes😳

slate swan
#

Nakano

#

oh i know now

#

its not open sourced yet

slate swan
#

my pfp is Miku Nakano

#

so yes

slate swan
slate swan
#

quintessential quintuplets

slate swan
olive osprey
olive osprey
#

Asuna & Zero Two>>

slate swan
#

!ot

unkempt canyonBOT
slate swan
#

okay ash

slate swan
#

i see you're influenced wid hunter

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

Suggest more topics here!

slate swan
#

oh i didnt read it

#

"discord ai bot" reminds me of caeden's jarvide which we started but never finished 😂

slate swan
#

ty for reminding me that i could do that too

slate swan
slate swan
#

well i dont remember correctly but someone was working on the machine learning part

olive osprey
#
> hi

You mean this?

#

hi

slate swan
#

yes they do

olive osprey
#

Ye it does

slate swan
#

thats just discord being discord

olive osprey
#

Discord, that's a discord bug, that also happens sometimes when using it in a normal message

warm tulip
#

How I can add reaction role to my bot?

#

To give reaction role

#

How to ay

slate swan
#

!d discord.on_raw_reaction_add / on_reaction_add

unkempt canyonBOT
#

discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
olive osprey
#

Damn, looks like a copied code to me

slate swan
#

!d pkgutil.extend_path

unkempt canyonBOT
#

pkgutil.extend_path(path, name)```
Extend the search path for the modules which comprise a package. Intended
use is to place the following code in a package’s `__init__.py`:

```py
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
```...
slate swan
#

dont open your libs src

#

it will say it wasnt found because of relative imports

#

ignored againpithink