#discord-bots

1 messages ยท Page 875 of 1

jolly basalt
#

it shows Help : none

boreal ravine
#

it doesn't have help?

jolly basalt
#

so, how do i add that variable 'help' to my command

boreal ravine
#

add a docstring to the command

#

or use the help kwarg in the command's decorator

hot rune
boreal ravine
hot rune
#

replit

#

its in replit

proven scarab
boreal ravine
#

use the package manager

#

or do the what suwa said in the shell

proven scarab
#

does repl.it let you install packages?

boreal ravine
#

yes

proven scarab
#

oh cool

hot rune
#

where is it

boreal ravine
#

left tab

proven scarab
hot rune
#

wht should i search

boreal ravine
hot rune
#

version1.7.3?

boreal ravine
#

yes

jolly basalt
boreal ravine
#

yes

hot rune
#

if i learn how to make discord bots will it also give me a base in python

jolly basalt
# hot rune help

usually when you import a package and run, replit automatically installs that package

boreal ravine
#

it all depends on you though

jolly basalt
hot rune
#

okay thx

cunning ice
#

now pls I want someone to tell me how can I host my bot for free 24/7 ?
I don't know anything about hosting so if anyone answers pls answer in a beginner friendly method pls

cunning ice
#

um no

#

I don't have money xd

cunning ice
proven scarab
#

you can try self hosting

cunning ice
proven scarab
#

get a spare pc/laptop and keep it on with the script running

cunning ice
#

a good hosting server is what I want

#

for free

#

As mmy bot has the main purpose to welcom on join

proven scarab
#

you could host a bot on repl.it i think

#

haven't tried myself

stray carbon
#

nvm

#
@client.command()
async def bruh(ctx):
  button = discord.ui.Button(label="Hi", style=discord.ButtonStyle.green)
  view = discord.ui.View
  view.add_item(item=button)
  await ctx.send(Hi, view=view)
Command raised an exception: TypeError: add_item() missing 1 required positional argument: 'self'
maiden fable
#

u need an instance of View class

#

view = ui.View()

small igloo
#
e = []
    for n in range(len(item_name)):
        i = item_name[n]
        e.append((item_name[i], item_emoji[i], database.check_item(name, i)))
    aeeee = map(e)
    print(aeeee)``` TypeError: list indices must be integers or slices, not str `holy duck`
maiden fable
#

@stray carbon fixed that?

maiden fable
small igloo
lament mesa
#

!d map

unkempt canyonBOT
#
map

map(function, iterable, ...)```
Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional *iterable* arguments are passed, *function* must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For cases where the function inputs are already arranged into argument tuples, see [`itertools.starmap()`](https://docs.python.org/3/library/itertools.html#itertools.starmap "itertools.starmap").
lament mesa
#

it takes a function and an iterable

small igloo
#

๐Ÿ—ฟ now what function

lament mesa
#

wot

slate swan
#

do ya see any error?

jolly basalt
slate swan
#

in my code?

red sundial
slate swan
#

kk

stray carbon
brittle axle
#

Guys do you know any free vps through which i can host my discord bot. The vps should be free and shouldnt ask for any payment verification

stray carbon
#

I was reading abt interactions ๐Ÿ˜…

brittle axle
red sundial
#

the one company that had free hosting removed it

brittle axle
#

nice

red sundial
#

cause they were facing losses

brittle axle
#

so i guess i have to stick to replit

red sundial
#

although you could try railway.app maybe

brittle axle
red sundial
boreal ravine
#

embeds are easy to make, why would you need a "creator" for one?

manic wing
#

save code length

slim ibex
#

!e

print(list(map(lambda x: x * x, [x for x in range(10)])))

unkempt canyonBOT
#

@slim ibex :white_check_mark: Your eval job has completed with return code 0.

[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
manic wing
#

or you can just save 30 bytes with list comp

slate swan
#

only applies if you're a student and have a school-issued email id

slate swan
#

The free tier

spring flax
#

I may be missing context tgen

#

Then

slate swan
#

You can apply for azure's free tier if you meet those criteria, that's all

spring flax
#

Also can someone remind me how to convert datetime.now into a format that can be used by the markdown timestamps

slate swan
#

int(datetime.timestamp())

#

datetime being the datetime object

spring flax
#

!d datetime.datetime.timestamp

unkempt canyonBOT
#

datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time").

Naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.

For aware [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:

```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
```   New in version 3.3.

Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
spring flax
#

Got it thanks

small igloo
#
e = []
    for n in range(len(item_name)):
        nyeh = item_name[n]
        e.append((item_name[n], item_emoji[nyeh], database.check_item(name, nyeh)))
    aeeee = map(lambda x: f"\n{x[1]} {x[0]}: {str(x[2])}", e)
    qq = list(aeeee)
    i.add_field(name="--ingredients--", value=qq[2]+qq[3]+qq[4]+qq[6]+qq[9]+qq[11]+qq[15]+qq[21]+qq[22]+qq[24])
    i.add_field(name="--items--", value=qq[5]+qq[7]+qq[8]+qq[10]+qq[12]+qq[13]+qq[14]+qq[23]+qq[25]+qq[37])
    i.add_field(name="--boost--", value=qq[35]+qq[36])
    i.add_field(name="--potion--", value=qq[16]+qq[17]+qq[18]+qq[19]+qq[20])
    i.add_field(name="--minerals--", value=qq[26]+qq[27]+qq[28]+qq[29]+qq[30]+qq[31]+qq[32]+qq[33]+qq[34])
    i.add_field(name="--sacred items--", value=qq[0]+qq[1])
    await ctx.channel.send(embed=i)``` i want so when item count is 0, it wont add the item to items list in my inventory, any best way?
manic wing
#

idk what programming language youre trying to do but that ainโ€™t this one

stray carbon
#
snipe_message_author = {}
snipe_message_content = {}
snipe_author_avatar = {}
message_deleted_at = {}

@client.event
async def on_message_delete(message):
     snipe_message_author[message.channel.id] = message.author
     snipe_message_content[message.channel.id] = message.content
     snipe_author_avatar[message.channel.id] = message.author.avatar_url
     message_deleted_at[message.channel.id] = int(time.time())

in on_message_delete
snipe_author_avatar[message.channel.id] = message.author.avatar_url
AttributeError: 'Member' object has no attribute 'avatar_url

stray carbon
#

it worked earlier but stopped working when i updated discord.py

#

ok

stray carbon
#

message.author.display_avatar?

manic wing
#

both work

stray carbon
#

ok

small igloo
small igloo
manic wing
#

display_avatar and avatar return the same thing

small igloo
jade tartan
#

Hey peeps do any one know how to make like this?

jolly basalt
small igloo
manic wing
#

avatar_url is <=1.7 and in beta its avatar and display_avatar

jade tartan
#

like have the user profile image and the namre

#

name

small igloo
manic wing
unkempt canyonBOT
#

set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.

This function returns the class instance to allow for fluent-style chaining.
jade tartan
#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.mention}", value="โœ…Verified 18+โœ…", inline=False)
    embed.add_field(name='Name', value=str(ctx.author.name), inline=True)
    await ctx.send("What Is Your Name?")
    msg = await client.wait_for('message')
    await ctx.send("What Is Your Name?")
    msg = await client.wait_for('message')
    await ctx.send(embed=embed)
    print(f"The embed has been send")```
small igloo
jade tartan
#

Right?

#

nvm i got it

jolly basalt
#

discord.ui doesnt exist?!?

maiden fable
jolly basalt
#

wtfff

jade tartan
#

it got the author name but not the author profile image

#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.mention}", value="โœ…Verified 18+โœ…", inline=False)
    embed.add_field(name='Name', value=str(ctx.author.name), inline=True)
    embed.set_author(name=ctx.author.display_name, url=embed.Empty, icon_url=embed.Empty)
    await ctx.send("What Is Your Name?")
    msg = await client.wait_for('message')
    await ctx.send("What Is Your Name?")
    msg = await client.wait_for('message')
    await ctx.send(embed=embed)
    print(f"The embed has been send")```
maiden fable
stray carbon
#
@client.command()
async def bruh(ctx):
    button = discord.ui.Button(label='Click')
    view = discord.ui.View()
    view.add_item(item=button)
    await ctx.send('Hi', view=view)

i want the the bot to send message "Hi" when someone clicks button

slim ibex
#

!d discord.Embed.set_author

unkempt canyonBOT
#

set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.

This function returns the class instance to allow for fluent-style chaining.
slim ibex
#

you probably should make an ACTUAL class view

slim ibex
#
class SomeView(discord.ui.View):
  def __init__(self, ...) -> None:
    ...

  # components here
slim ibex
stray carbon
#

how to create interaction ๐Ÿ˜…

#

oh

jade tartan
#

embed.set_author(name=ctx.author.display_name, url=embed.Empty, icon_url="") Like this?

slim ibex
jade tartan
#

ohh ok

slim ibex
#

embed.set_author(name=ctx.author.display_name)

jade tartan
#

i got that one

slim ibex
#

(ik python zen says explicit is better than implicit, but setting args to what their default is explicitly ain't it)

jade tartan
#

still nothing

slim ibex
#

well you have to set the author icon_url to something if you want something to show. I was just saying that if you aren't going to set it to anything, no need to specify it

bleak flower
#

Its a dsicord bot, but its a python problem, idk where to send it in...

async def war(ctx, hour=None, day=None):
    time_obj = time.localtime()
    local_time = time.strftime("%a %b %d %H:00:00 %Y", time_obj) # Year, Month, day, hour
    time_sting = time.strptime(local_time)
    time_tuple = (0, 0, day, hour, 0, 0, 0, 0, 0)
    war_time = str(time.mktime(time_sting + time_tuple)).split(".")[0]
    await ctx.channel.send("<t:" + war_time + ":F>" + " <t:" + war_time + ":R>" )

its gives me the error

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: mktime(): illegal time tuple argument

I dont know how to fix it, and already searched about it on google... can anoyne help me?

slim ibex
#

!d time.mktime

unkempt canyonBOT
#

time.mktime(t)```
This is the inverse function of [`localtime()`](https://docs.python.org/3/library/time.html#time.localtime "time.localtime"). Its argument is the [`struct_time`](https://docs.python.org/3/library/time.html#time.struct_time "time.struct_time") or full 9-tuple (since the dst flag is needed; use `-1` as the dst flag if it is unknown) which expresses the time in *local* time, not UTC. It returns a floating point number, for compatibility with [`time()`](https://docs.python.org/3/library/time.html#time.time "time.time"). If the input value cannot be represented as a valid time, either [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") or [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "ValueError") will be raised (which depends on whether the invalid value is caught by Python or the underlying C libraries). The earliest date for which it can generate a time is platform-dependent.
slim ibex
#

seems like the function doesn't accept tuples as an argument

jade tartan
slim ibex
#

effectively what you've done is:
str(time.mktime(time.strptime(local_time) + (0, 0, day, hour, 0, 0, 0, 0, 0))).split(".")[0]

hot rune
#

nothings happening

slim ibex
#

first off, cogs are supposed to be in a separate file

#

its __init__ not _init_

#

you are missing :'s and indentation is horrendous

hot rune
#

mb its my first day tryna code

slim ibex
slim ibex
slim ibex
hot rune
#

how do i learn the lang

slim ibex
unkempt canyonBOT
#
Resources

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

bleak flower
slim ibex
#

@bleak flower it seems time.mktime doesn't take the two arguments you supplied it, especially the tuple argument

#

try removing the tuple argument and see what happens

hot rune
#

i dont understand wht it does its just showing me something like filters and all wht should i do to get started

jade tartan
#

I have one more question but let just try this

slim ibex
#

ik it won't work, but I want to see the error

slim ibex
#

i highly recommend Automate the Boring Stuff

jade tartan
bleak flower
# slim ibex ik it won't work, but I want to see the error
async def war(ctx, hour=None, day=None):
    time_obj = time.localtime()
    local_time = time.strftime("%a %b %d %H:00:00 %Y", time_obj) # Year, Month, day, hour
    time_sting = time.strptime(local_time)
    time_tuple = (0, 0, day, hour, 0, 0, 0, 0, 0)
    war_time = str(time.mktime(time_sting)).split(".")[0]
    await ctx.channel.send("<t:" + war_time + ":F>" + " <t:" + war_time + ":R>" )

like this? this works

slim ibex
#

it works?

bleak flower
#

yes

slim ibex
#

does it give the outcome you wanted

jade tartan
#

@slim ibex it doesnt work

bleak flower
jade tartan
#

Damn

slim ibex
#

docs command trippy

#

@jade tartan try ctx.author.avatar_url

bleak flower
slim ibex
#

you can get current time (time command was executed) with datetime.datetime.utcnow iirc

#

i'm not sure about the time in the command part

hot rune
slim ibex
#

yes

#

in python specifically

#

but i believe it goes over some CS principles

jolly basalt
#

this piece of code returns a runtime error

#

RuntimeWarning: Enable tracemalloc to get the object allocation traceback

#

but i checked again and again

#

i didnt forget await anywhere

#

@slim ibex sorry for ping but im fumbling

cunning ice
#

Pls help me in hosting my bot 24x7
I made it in Atom text editor
Pls ping if anyone answes

slim ibex
jolly basalt
slim ibex
#

lets see before i sleep

#

show this members iterable

jolly basalt
#

members = mods.members

#

members of a role

slim ibex
#

can you show more traceback?

#

or does it not give a specific line

jolly basalt
#
@bot.command('report')
async def report(ctx):
    '''
    Report the current trending game to the online moderators, you can choose to whom should you report
    '''
    blacklisted_ppl = open('blacklist.txt', 'r')
    ppl = blacklisted_ppl.readlines()
    print(ctx.author.id)
    for i in ppl:
        if str(ctx.author.id) == i:
            embed=discord.Embed(title="Action denied", description="You cannot run the ??report command as you are blacklisted from using this command", color=0xd31212)
            await ctx.send(embed=embed)
            return
    file = open('database.txt', 'r')
    game = file.read()
    mods = discord.utils.get(ctx.guild.roles, name = "๐Ÿ’‚๏ธ๏ธฑModeration Team")
    members = mods.members

    id = list(map(lambda m: m.id, members))
    print(id)
    for i in id:
        user = await bot.fetch_user(i)
        if str(user.status) == 'online' or str(user.status) == 'dnd':
            button = Button(label = user.name, style=discord.ButtonStyle.green)
            biew = View()
            biew.add_item(button)

            await ctx.send('Select an online member', view = biew)
cunning ice
slim ibex
cunning ice
#

sad

slim ibex
#

vultr is pretty much "free" though. its like $5 a month or maybe even lower

#

they charge by the second

jolly basalt
#

first my command checks if the user is blacklisted, then it gets all the ppl with the "mod" role then i get their names and then i proceed to make a button for each online moderator

jolly basalt
#

is that it

slim ibex
#

that wont fix but thats a syntax error

jolly basalt
#

soo

#

can you look at that code and figure out whats wrong

slim ibex
#

is there any specific line the traceback says?

jolly basalt
#

ive read that a million times ๐Ÿ˜ข

jolly basalt
#

print(id) prints coroutine object Command.call at 0x00000189D4634200>

maiden fable
#

U didn't await smth

slim ibex
#

!d discord.utils.get

#

not a coro

jolly basalt
maiden fable
#

Code

late mauve
#

hey how can i get the uptime of the bot?

jolly basalt
maiden fable
maiden fable
#

!botvar if u need help with botvars

unkempt canyonBOT
#

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

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

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

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

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

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

jolly basalt
maiden fable
slim ibex
#

add await before list(map(...))

#

idk if thats it, but it might be

maiden fable
#

Heh?

#

Why tho ๐Ÿ‘€

jolly basalt
slim ibex
#

well, it returns a coro

jolly basalt
slim ibex
#

its a coroutine

#

i'm just going on a whim. it might not be it

maiden fable
#

Ah cool

jolly basalt
#

it used to print ```
Ready!
813058518625157180
<coroutine object Command.call at 0x0000022ABC1758C0>

and then raise the exception
#

now its just ```
Ready!
813058518625157180

and it doesnt return an error, nor does it do smth
maiden fable
#

Ayyy GJ @slim ibex

slim ibex
#

lol i think its fixed

jolly basalt
jolly basalt
maiden fable
#

@jolly basalt whats the issue tho

slim ibex
#

well atleast the error is fixed

jolly basalt
#

now it doesnt say that

#

the issue is fixed

slim ibex
#

yeah because you awaited that coroutine object

maiden fable
#

So the command is now fixed, right?

#

Ah okay cool. Thought u still needed help

jolly basalt
#

ty moai

slim ibex
#

that debug print saved you

#

holy shit

jolly basalt
#

lol yeah, i was confused so i printed it

slim ibex
#

btw for your open()'s, use context manager so the file is closed after, and pls dont use .txt files as a database

#

anyways im off for the night.

slate swan
jolly basalt
#

this is a rudimentary version

jolly basalt
slate swan
maiden fable
maiden fable
slate swan
maiden fable
#

U check for JSONDecodeError

analog current
#

how to run aiohttp TCP site with discord bot in a cog?

maiden fable
#

Web stuff not my area of expertise

maiden fable
#

Then u can help him (:

fluid spindle
#

Out of curiosity, what happens to Member.mention if the user has left the server?

fluid spindle
#

That looks like an id

maiden fable
#

invalid-user

maiden fable
tall dust
maiden fable
#

Nvm, discord broke

fluid spindle
#

ok, cool, thanks

maiden fable
jolly basalt
#

dammit wrong server

maiden fable
#

Haha it's fine

#

BTW u sure wrong server? ๐Ÿ‘€

jolly basalt
#

yes, it is a problem, i dont want to annoy ya'll ;-;

maiden fable
#

Felt like a bot/code problem

jolly basalt
#

ive been asking too much doubts lol

maiden fable
#

Haha okay

#

U using disnake, right?

#

Mind showing the whole traceback?

#

Nothing more?

#

Weird... Is the command showing any options in the GUI?

slate swan
maiden fable
#

According to the code, there ain't, but according to the error, there are lmao

#

"Application command interaction options values"

#

U on the latest disnake version?

maiden fable
#

Weird, try asking in the disnake server

jolly basalt
#

i tried to not bug ya'll

#

that ids is an object

#

a callback object

potent spear
#

don't crosspost I'd say

jolly basalt
#

<coroutine object Command.call at 0x0000015156FBF840>

jolly basalt
#

i just dont understand

potent spear
#

Lonely, he's asking help from different guilds

jolly basalt
#

i need to know why this happened, i not only need a solution, i need to find why it does that

potent spear
#

idk why you'd give multiple people looking for the same problem

jolly basalt
#

this has worked multiple times before, why does this show just in this cmd

potent spear
#

he isn't even showing errors or where he prints, this is just funny at this point

potent spear
jolly basalt
#

im done, ig

#

ill read the docs, fine

potent spear
#

your "issue" isn't coming from the lines you think it is
you're not giving is any context

jolly basalt
#

bruh

#

what im trying to do with this snippet is to get all the id's of members with a specific role

#

usually when you do that, you get the ids

slate swan
#

!d discord.Role.members

unkempt canyonBOT
slate swan
#

use a list comprehension, easy stuff

jolly basalt
#

yeah, when i posted this exact thing on the discord.py server, all they do is say something else that doesnt work

boreal ravine
jolly basalt
#

see?

boreal ravine
#

what're you trying to do?

potent spear
#

he just needs the ids of all members with that role

#

I already gave you the solution in the other guild, but yeah...

boreal ravine
slate swan
#

well, idk, I prefer list comps more than lambda

potent spear
#

^

jolly basalt
#

btw, member_ids = [member.id for member in guild.members] doesnt work

boreal ravine
#

thats guild

potent spear
#

it's mods.members instead of guild.members ofc

#

I just gave a similar example so you wouldn't copy paste and COMPREHEND

slate swan
boreal ravine
#

why are you saying bruh?

jolly basalt
#

most prolly, its some problem with my pc

#

it returns an empty list, im restrarting

dry kelp
#

How can i turn off the guild community using a bot?

jolly basalt
slate swan
#

its a lot different

#

you were using a Guild object whereas that contains a Role object

jolly basalt
#

that returns

slate swan
boreal ravine
#

@jolly basalt does the role have members?

slate swan
#

lmao

dry kelp
#

How can i turn off the guild community using a bot?

jolly basalt
jolly basalt
#

bruh im restarting

thick sigil
#

Do you even have members intent

potent spear
#

press x for doubt

jolly basalt
#

and i enabled it in discord.dev

thick sigil
#

Dev portal

jolly basalt
#

yeah ofc

thick sigil
#

What if you print mods.members

potent spear
jolly basalt
#

bruh i dont use that

potent spear
#

then remove it

dry kelp
jolly basalt
#

i just forgot to remove it

potent spear
jolly basalt
#

it does return a correct list

potent spear
jolly basalt
#

and i had checked the spelling

potent spear
jolly basalt
#

im done

#

no, isnt

potent spear
jolly basalt
#

my head is burning, im taking a nap

#

fuck discord

dapper cobalt
jolly basalt
potent spear
dapper cobalt
jolly basalt
#

ive copied and pasted the same thing onto the discord.utils.get

dapper cobalt
#

Why not use guild.get_role(role_id) instead?

jolly basalt
#

ill put that in my checklist, im gonna go take a nap, cuz this shouldnt happen

dapper cobalt
#

While it wouldn't make a great difference, but it'd be a bit more exact I think?

potent spear
jolly basalt
potent spear
dry kelp
#

How can i turn off the guild community using a bot?

faint mason
#

does anyone know the command in python to add emoji and remove

dry kelp
#

How can i turn off the guild community using a bot?

heavy folio
#

idt you can

dapper cobalt
unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
dapper cobalt
#

!d disnake.Guild.edit

unkempt canyonBOT
#
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., region=..., afk_channel=..., owner=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the guild.

You must have [`manage_guild`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_guild "disnake.Permissions.manage_guild") permission to use this.

Changed in version 1.4: The rules\_channel and public\_updates\_channel keyword-only parameters were added.

Changed in version 2.0: The discovery\_splash and community keyword-only parameters were added.

Changed in version 2.0: The newly updated guild is returned.
spring flax
#

How does 2fa work then for that

dapper cobalt
dapper cobalt
jolly basalt
#

bruh, it worked after i restarted

#

HOW

spring flax
#

2fa should raise forbidden then

dapper cobalt
jolly basalt
#

i was messing with path n' stuff, maybe its that, idk

slate swan
stiff anvil
#
from discord.ext import commands

# -------------------- Cogs --------------------

class admin(commands.Cog):
    def __init__(self, client):
        self.client = client

# -------------------- Launch --------------------

    @commands.Cog.listener()
    async def on_ready(self):
        print('Loaded Admin Commands')

# -------------------- Ban Command --------------------
    
    @commands.Cog.listener()
    async def ban(ctx, message, member, *, reason = None):
        await member.ban(reason = reason)
        await message.reply(f"Banned {member}")

# -------------------- Cogs Setup --------------------

def setup(client):
    client.add_cog(admin(client))

#

why this isn't working?

#

ping me

quick gust
#

ban command has an event decorator

stiff anvil
#

how can i fix it

quick gust
#

firstly

#

you didn't pass self in the "command"

#

it's inside a cog, pass self

#

second, the decorator is @commands.command()

stiff anvil
quick gust
#

the one you used is for events

stiff anvil
#
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/home/container/.local/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: AttributeError: 'str' object has no attribute 'ban'

quick gust
#

typehint member to discord.Member

stiff anvil
#
    raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.Admin_Commands' raised an error: NameError: name 'discord' is not defined
#

@quick gust

#
from discord.ext import commands

# -------------------- Cogs --------------------

class admin(commands.Cog):
    def __init__(self, client):
        self.client = client

# -------------------- Launch --------------------

    @commands.Cog.listener()
    async def on_ready(self):
        print('Loaded Admin Commands')

# -------------------- Ban Command --------------------
    
    @commands.command()
    async def ban(self, message, ctx, member : discord.Member, *, reason = None):
        await member.ban(reason = reason)
        await message.reply(f"Banned {member}")

# -------------------- Cogs Setup --------------------

def setup(client):
    client.add_cog(admin(client))

current code

quick gust
#

you haven't imported discord

stiff anvil
#

from discord.ext?

quick gust
#

from discord import Member

#

then typehint to Member

stiff anvil
#
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
#

WHY IS IT SO HARD TO BAN A MEMBER

#

omfg

#
discord.ext.commands.errors.MemberNotFound: Member "test" not found.
#

@quick gust any ideas?

nimble plume
#

Bro?

stiff anvil
nimble plume
#
    async def ban(self, message, ctx, member : discord.Member, *, reason = None):
```Huh?
stiff anvil
#

so what?

nimble plume
#

Wdym by message

stiff anvil
#

message.reply...

nimble plume
#

U can do ctx.reply?

#

Its not event bro

#

Remove the message

stiff anvil
#
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
nimble plume
#

Missing perms

stiff anvil
#

I swear it has Admin

quick gust
#

you don't

stiff anvil
#

I SWEAR!!!

nimble plume
#

No u dont

stiff anvil
#

I DO

nimble plume
#

Code is not wrong

stiff anvil
#

I HAVE THE SAME ROLE AS THE BOT

potent spear
nimble plume
#

Wait

stiff anvil
#

Makes sense

stiff anvil
#

BUT THE ROLE IS HIGHER!

slate swan
nimble plume
#

U can compare it with top_role

potent spear
stiff anvil
#

<@&831776746206265384> change that fucking slowmode!

slate swan
slate swan
#

!d discord.Member.top_role cof cof

unkempt canyonBOT
#

property top_role: Role```
Returns the memberโ€™s highest role.

This is useful for figuring where a member stands in the role hierarchy chain.
potent spear
stiff anvil
#

bruh...

nimble plume
nimble plume
slate swan
nimble plume
#

He has administrative perms

#

If this

nimble plume
stiff anvil
#

That's what I thought

#

Thank you guys โค๏ธ

slate swan
#

.....

nimble plume
#

Ok

#

Loeya

stiff anvil
#

What :'(

nimble plume
#

Nothing

dapper cobalt
slate swan
nimble plume
#

Lol

stiff anvil
#

๐Ÿ˜ข

slate swan
nimble plume
#

Different message spotted

#

Wait wrong

potent spear
#

was it always 6 secs? nice

nimble plume
#

No they changed

stiff anvil
#

Don't bully me <3

nimble plume
#

TF

slate swan
potent spear
#

excellent

nimble plume
slate swan
#

and there was 0 once upon a time

stiff anvil
#

๐Ÿ˜ข

#

Ash, be my friend

nimble plume
#

!ot

slate swan
unkempt canyonBOT
nimble plume
slate swan
stiff anvil
slate swan
cold sonnet
#

can't change Ash, won't change Ash

maiden fable
#

!ot thanks

unkempt canyonBOT
cold sonnet
#

same with Hunter

slate swan
maiden fable
slate swan
#

!rule 7 welcome

unkempt canyonBOT
#

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

slate swan
#

rile kek

cold sonnet
#

can't change Hunter, won't change Hunter

nimble plume
#

Goto ot tf

slate swan
maiden fable
#

Imagine ghost ping

maiden fable
nimble plume
#

Ghost ping prefix is ๐Ÿ‘ป

slate swan
nimble plume
#

๐Ÿ‘ป return Hunter if python === js

maiden fable
nimble plume
#

Ghost pinged

nimble plume
#

Not self botting*

slate swan
nimble plume
#

Get a ghost ping bot

maiden fable
slate swan
nimble plume
#

Hehe

#

@unkempt canyon maybe

slate swan
#

no

nimble plume
#

I mean thisnserver

slate swan
#

imagine self-botting

nimble plume
#

Discord check ur account?

nimble plume
slate swan
#

imagine doing it

nimble plume
#

For sending all my friends a msg

maiden fable
#

Anyways imma stop

nimble plume
#

And it worked

#

Nevermind ot

slate swan
#

I'll take my leave WTFStare

nimble plume
maiden fable
nimble plume
#

^this also discordbots

supple thorn
maiden fable
supple thorn
#

Oh

#

Was wondering why you need a better vps for that

maiden fable
#

Haha

supple thorn
#

You're the friend?

#

Good

#

Cause i was so confused why as fuck as why would they need more than that

cold sonnet
#

th

supple thorn
#

Also flex

cold sonnet
#

bro for what

supple thorn
cold sonnet
#

do you host mee6

somber sapphire
#

how good code to do??

supple thorn
cold sonnet
#

really good

slate swan
cold sonnet
slate swan
cold sonnet
#

make code work code go boom

final iron
cold sonnet
#

water you don't even dpy, you just pep8 yert

slate swan
cold sonnet
#

not a single person he helped without saying something about pep8

slate swan
cold sonnet
slate swan
#

internal error?

#

yeah?

#
{
   "code":50035,
   "errors":{
      "data":{
         "options":{
            "_errors":[
               {
                  "code":"INTERACTION_APPLICATION_COMMAND_OPTIONS_VALUE_INVALID",
                  "message":"Application command interaction option values must be of type string, integer, or boolean"
               }
            ]
         }
      }
   },
   "message":"Invalid Form Body"
}

is this the error code?

#

ic

slate swan
slate swan
#

hm ic

#

does it print ran?

#

hmph

maiden fable
#

@slate swan still the error isn't fixed?

slate swan
#

bro if youre gonna import every class atleast import the Cog class๐Ÿ˜”

slate swan
maiden fable
#

Lmao

#

Yup, read the convo there too

#

Uhhh, I have an idea... try renaming the command and passing the guild_ids kwarg

slate swan
maiden fable
#

She means from disnake.ext.commands import Cog

slate swan
#

import the Cog class pls๐Ÿ˜ญ

maiden fable
#

Lmao

maiden fable
#

Still the same error?

slate swan
maiden fable
slate swan
slate swan
maiden fable
#

Someone doesn't want oki to say anything ๐Ÿ‘€

slate swan
maiden fable
#

Who says u r smart

slate swan
#

im smortlemon_glass

maiden fable
#

!ot anyways

unkempt canyonBOT
slate swan
#

how?

maiden fable
#

How?

#

Lmao

slate swan
#

the kwarg?

maiden fable
#

Was there another cmd with the same name?

#

Or a function

#

Weird

#

Anyways what matters is that it's fixed

hot rune
#

Uhh guys should i learn the basics of python first before i actually start a discord bot???

cunning ice
#

can i create a repos in Github without dwnlding anything? i.e in browser (website)

slate swan
#

i use github desktop lemon_glass

maiden fable
#

Windows desktop lmao

final iron
#

Imagine not Linux

slate swan
slate swan
maiden fable
#

Imagine not talking about this in the ot channel ๐Ÿ˜”

slate swan
#

๐Ÿ—ฟ

cunning ice
maiden fable
#

No

slate swan
#

github desktop is git with a ui

maiden fable
#

Tho github is a hub for many gits lmao

cunning ice
#

wat oof now i had to learn the basics of this ahhh

slate swan
#

going to next class bye guys๐Ÿ˜”

maiden fable
#

Adios

slate swan
unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

slate swan
maiden fable
#

adults :D

cunning ice
cunning ice
#

i just want to host my bot 24x7

maiden fable
#

How u gonna do that with github tho

cunning ice
#

nothin els

cunning ice
#

aaaaaaaaaaa

jolly basalt
#

this shows everyone is offline even though im online

spring flax
#

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

jolly basalt
#

ive also done it in discord.dev

slow fog
#

you sus

maiden fable
#

idk are you :D

slow fog
#

what the sus

slate swan
maiden fable
#

Or a 39 y/o unemployed male ๐Ÿ‘€

#

Or a high IQ 10 y/o kid

jolly basalt
#

im just a hairy 16 y/o, who is salty cuz he cant spend a minute without being smothered by problems in his code

maiden fable
#

I'm just a depressed and lonely 16 y/o ๐Ÿฅด

jolly basalt
#

;-;

jolly basalt
maiden fable
#

?

#

Ig? ๐Ÿ‘€

jolly basalt
#

๐Ÿ‘๏ธ ๐Ÿ‘„๐Ÿ‘๏ธ

maiden fable
#

!d discord.Guild.get_member exists

unkempt canyonBOT
cunning ice
#

can you pls tell how do i host my bot 24x7 online ??
@maiden fable

spring flax
#

Does using the async iterator for audit logs have high ratelimits?

maiden fable
spring flax
#

what do you mean that?

maiden fable
#

They change with every request. The first request, it can be 4/2s and the next request, it can become 5/3s

jolly basalt
#

still the same thing, im kinda thinking of giving up

maiden fable
buoyant igloo
#

yo guys can I put my variables into one file and import that file into another file with cogs

example:

file.py
x = 6
Y= 9

g.py

โ€˜class test(commands.Cog):
def init(self, bot):
self.bot = bot

@commands.command
async def ur_mom(self, ctx):
x + y
await ctx.send(โ€œx plus yโ€)โ€™

will the variable change in file.py?

maiden fable
#

from file import x, Y

jolly basalt
spring flax
buoyant igloo
maiden fable
#

Try printing user.status

maiden fable
maiden fable
jolly basalt
buoyant igloo
#

u can import variables?

jolly basalt
maiden fable
jolly basalt
maiden fable
#

By any chance do u have two bots defined?

jolly basalt
#

nope ofc

maiden fable
#

Weird

spring flax
buoyant igloo
spring flax
#

how can I prevent that then?

maiden fable
jolly basalt
maiden fable
maiden fable
#

!d discord.AsyncIterator

unkempt canyonBOT
#

class discord.AsyncIterator```
Represents the โ€œAsyncIteratorโ€ concept. Note that no such class exists, it is purely abstract.

async for x in y Iterates over the contents of the async iterator.
spring flax
#

also how long would the ratelimit be if that were to happen?

maiden fable
#

Depends on the API

cunning ice
buoyant igloo
maiden fable
cunning ice
# maiden fable No

aww man damnit i spent too much time for learning python and make a bot for my server then i cant host it
:(

proven scarab
lament mesa
#

you will have to enter credit card details

#

some vps's like heroku dont require credit card details

hazy oxide
#

how to make async typing function in nextcord slash command? anyone know?

maiden fable
hazy oxide
#

yes

maiden fable
#

Wym

hazy oxide
#

to make the bot typing

#

like if we make google search command

#

it will take a moment for bot to search the query

#

and then it will display bot is typing...

maiden fable
#

It's the same like u do in text commands

hazy oxide
#

it says "interaction has no attribute typing"

spring flax
#

!d discord.ext.commands.Context.typing

unkempt canyonBOT
#

async with typing()```
Returns a context manager that allows you to type for an indefinite period of time.

This is useful for denoting long computations in your bot.

Note

This is both a regular context manager and an async context manager. This means that both `with` and `async with` work with this.

Example Usage...
maiden fable
#

!d discord.TextChannel.typing

unkempt canyonBOT
#

async with typing()```
Returns a context manager that allows you to type for an indefinite period of time.

This is useful for denoting long computations in your bot.

Note

This is both a regular context manager and an async context manager. This means that both `with` and `async with` work with this.

Example Usage...
maiden fable
#

Use this (:

hazy oxide
#

so i use async with typing instead of async with interaction.typing?

maiden fable
#
async with interaction.channel.typing():
    . . . 
hazy oxide
#

ooo okay thx

cunning ice
proven scarab
#

not too sure

maiden fable
#

Light Mode lemon_pensive

proven scarab
#

wtf... i love light mode...\

final iron
cunning ice
maiden fable
final iron
proven scarab
maiden fable
#

U need a cc anyways

proven scarab
#

just buy a raspberry pi they're pretty cheap and decent

cunning ice
final iron
#

No

#

Google it. Should be extremely easy to find

cunning ice
proven scarab
#

its legit like 30usd

final iron
cunning ice
#

@final iron

final iron
#

Probably

cunning ice
#

i cant find a tutorial on yt on hosting a bot in oracle i dont know anything about it oof

lament mesa
cunning ice
#

free one

lament mesa
cunning ice
#

no not paid man !!!!

cunning ice
final iron
#

No

cunning ice
#

umm so how can you tell me how to do it

lament mesa
cunning ice
proven scarab
#

alternatively you have a computer

#

just keep it on and host the bot on it

#

its free

final iron
unkempt canyonBOT
#

Hey @bleak flower!

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

placid skiff
#

check if the author has a permission?

maiden fable
spring flax
#

can anyone tell why this doesn't work

#
            if data[1] == None:
                reason = 'No reason was specified'
            else:
                reason = str(data[1])
placid skiff
#

what is "data"?

spring flax
#

the data[1] is None

spring flax
# placid skiff what is "data"?
    async with bot.db.execute("SELECT member_id, reason, time, performing_user, bot FROM bans WHERE member_id = ?", (user.id,)) as cursor:
        data = await cursor.fetchone()
#

I did print(data[1]) and it printed

proven scarab
placid skiff
#

well reason is just a variable there

#

you don't send it

spring flax
#

sorry I was going back and forth copying the revelant information and the slowmode doesn't help either

maiden fable
slate swan
spring flax
slate swan
#

or if not

slate swan
placid skiff
#

if reason is None then that block of code doesn't run

proven scarab
slate swan
slate swan
spring flax
#

oh shoot

slate swan
#

iirc columns return as a tuple

spring flax
#

i got why nevermind

proven scarab
#

i was wondering if None was a string accidentally set or something

slate swan
maiden fable
#

NoneType is a different class

silk kelp
silk kelp
#

{user.discriminator }

cold sonnet
#

I don't think that ruins anything

silk kelp
#

idk

cold sonnet
#

no

silk kelp
#

oh

spring flax
spring flax
cold sonnet
#

hm

#

can't you just data = await...

slate swan
maiden fable
#

nothing, ignore me

modest plover
#
class Config(commands.Cog):
    """Saves a config to the Deta database."""

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

    @commands.slash_command(test_guilds=938194100639895713)
    async def config(self, inter):
        """Presents the user with a config command"""
        
        welcomeConfig = disnake.Embed(
            title = "Welcome!",
            description = "Welcome to the config menu. Each of the menu option will give you 30 seconds to reply. Let's start with the welcome channel."
        ).add_field(
            name = "Welcome Channel",
            value = "Please state the welcome channel ([#welcome](/guild/267624335836053506/channel/267631170882240512/) for example)"
        )
        
        announcementsConfig = disnake.Embed(
        	title = "Announcements",
        	description = "There is a /announce command which can be used by anyone with the specified admin role (set this later)"
        	).add_field(
        		name = "Announcement Channel",
        		value = "Please state the announcement channel ([#announcements](/guild/267624335836053506/channel/354619224620138496/) for example)")
        await inter.response.send_message(embed = welcomeConfig)
        
        def channelCheck(message: disnake.Message):
        	return message.author == message.author and message.channel == message.channel
        	return len(message.channel_mentions) > 0
        	
        welcome = await self.bot.wait_for("message", timeout=30.0, check=channelCheck)
        
        await inter.channel.send(embed = announcementsConfig)
        
        await self.bot.wait_for("message", timeout = 30.0, check = channelCheck)

So I need the message to only take #channels, but it doesn't :/ any help?

maiden fable
#

I am just lurking here and there

silk kelp
modest plover
#

Lol

cold sonnet
#

return message.author == message.author and message.channel == message.channel

#

why

#

and this line
return len(message.channel_mentions) > 0
won't be reached

stray carbon
#
@client.listen()
async def on_message(message: discord.Message):
    if 'heist' in message.content.lower():
        if client.heistar == '':
            return
        else:
            client.heistar
raise CommandInvokeError(exc) from exc

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

cold sonnet
stray carbon
#

it worked in old discord.py not working after update

cold sonnet
#

do you use an other library now or just dpy 2.0?

stray carbon
#

dpy 2.0

cold sonnet
#

then no idea

stray carbon
#

:/

cold sonnet
#

but it says it was a command invoke error

#

so this can't be the code where the error occured

slate swan
cold sonnet
#

even tho
client.heistar
wouldn't do anything

stray carbon
#
client.heistar = ''

@client.command()
@discord.ext.commands.has_permissions(manage_guild=True)
async def hara(ctx, *, Content: str):
    if content == "":
        await ctx.send("Message is an argument which is missing")
    else:
        client.heistar = Content
        embed = discord.Embed(title = 'Heist Responder', description = f'**Reply**\n{Content}\n\n**Raw**\n\n`{Content}`\n')
        await ctx.send(embed = embed)
slate swan
maiden fable
modest plover
#

it was to make sure it's the person who called the slash who responds

maiden fable
#

or smth like that idk

slate swan
maiden fable
#

!e print(isinstance(None, NoneType))

unkempt canyonBOT
#

@maiden fable :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'NoneType' is not defined
cold sonnet
maiden fable
#

๐Ÿ‘

slate swan
#

lol

modest plover
cold sonnet
#

check if message.author == inter.author?

#

or inter.message.author, honestly no idea again

stray carbon
#

ok

slate swan
cold sonnet
#

you named your Content argument with a capital letter

#

then proceeded to use content

cold sonnet
#

okimii stop using bot commands

slate swan
#

i was checking what boolean None returns and i was correct False

#

so its like comparing False with a False string doesnt matter

cold sonnet
#

why you gotta check

slate swan
stray carbon
distant pendant
#

I want that my bot adds a role to a member when he joins

slate swan
#

does the gateway send an event on a guild join probably does i just dont know where in docs

distant pendant
#
async def on_member_join(member):
    role = discord.utils.get(member.guild.roles, id=948925738856374292)
    await member.add_roles(role)````Here's my code
#

discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions And thats the error i get

sick birch
#

The error says everything

distant pendant
#

But the member intents are true

sick birch
#

Your bot doesnโ€™t have the permissions to add roles

distant pendant
#

And he got admin on the server

sick birch
#

Who is the bot adding the role to?

distant pendant
#

The member who joined

sick birch
#

Which is?

distant pendant
#

My 2 acc

sick birch
#

Are they also admin?

distant pendant
#

No they are joining

sick birch
#

Right which role are you adding

#

Admin?

distant pendant
#

No, an other role

sick birch
#

Does that also have admin perms?

distant pendant
#

Nope

sick birch
#

Hmm thatโ€™s odd

nimble plume
#

Send role positions

#

Maybe the role that u are trying to give is higher then bot role

distant pendant
#

But the bot has admin with his role

nimble plume
#

Yes but try moving bot role at top

#

Then try

distant pendant
#

It worked

#

Thanks

nimble plume
#

๐Ÿ‘

slate swan
#

whats wrong with the code?

slim ibex
#

reason:None is not right

#

itโ€™s reason=None

slate swan
#

ah

#

ofc

quaint epoch
#

I'm slightly concerned

honest vessel
#

kek

potent spear
#

to use google?

junior falcon
#

Guys, i get this error when i try to use an image i stored locally:
https://paste.pythondiscord.com/kuwevutoco

This is the variable of the image:
LOGO = discord.File("img\AquariusMC_Logo.png", filename="AquariusMC_Logo.png")
how i use it in the embed

ticketchiusolog.set_footer(icon_url="attachment://AquariusMC_Logo.png", text="AquariusMC ๐ŸŒŠ")

And when i send the embed

await TICKET_CHANNEL_LOG.send(embed=ticketchiusolog, file=LOGO)   
potent spear
#

slash command check is probably what you're looking for

maiden fable
#

Indeed

bleak flower
#

i have my code here, but the on_raw_reaction_add funktion doesnt work (ig because its in a funktion)
but if i do it outside the war funktion, the variables i get from the war function arent defined anymore

how do i solve this?
https://paste.pythondiscord.com/jifowifojo

silk kelp
silk kelp
silk kelp
quaint epoch
silk kelp
#

learned that the hard way when a random user started creating channels because it just passed through @quaint epoch

bleak flower
quaint epoch
left crater
#

bad spelling my bad

bleak flower
#

thank you! <3

silk kelp
quaint epoch
#

no wait

#

don't use reaction_add

final iron
quaint epoch
#

use "raw_reaction_add"

slim ibex
#

!d discord.ext.commands.Bot.wait_for

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.9)"). 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.9)") 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.9)") 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**...
silk kelp
#

@bleak flower

def check(reaction, user):
  return user == message.author and str(reaction.emoji) == '๐Ÿ‘'
try:
  reaction, user = await client.wait_for('reaction_add',     timeout=60.0, check=check)
except asyncio.TimeoutError:
  await ctx.send('You\'ve run out of time!')
  return
else:
  await ctx.send('(ending message here when they react)')
quaint epoch
#

it works like py try: await bot.wait_for('raw_reaction_add', timeout=60, check=check_here) except asyncio.exceptions.TimeoutError: # This code runs when the the timeout ends else: '''This code runs when the the event is run and the check returns true before the timeout is over'''

silk kelp
#

or am i dumb because i got rid of mine but it still works

quaint epoch
silk kelp
# quaint epoch you can add an else after a try/except if the except isn't run
def check(reaction, user):
  return user == message.author and str(reaction.emoji) == '๐Ÿ‘'
try:
  reaction, user = await client.wait_for('reaction_add',     timeout=60.0, check=check)
except asyncio.TimeoutError:
  await ctx.send('You\'ve run out of time!')
  return
else:
  await ctx.send('(ending message here when they react)')

like this?

quaint epoch
silk kelp
#

raw didnt work for m

slow fog
#

everyones sus

quaint epoch
unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
quaint epoch
#

read the docs on how to use this payload

final iron
#

!d asyncio.TimeoutError

unkempt canyonBOT
#

exception asyncio.TimeoutError```
The operation has exceeded the given deadline.

Important

This exception is different from the builtin [`TimeoutError`](https://docs.python.org/3/library/exceptions.html#TimeoutError "TimeoutError") exception.
left crater
#

i dont think itsasyncio.exceptions.TimeoutError

silk kelp
quick gust
quaint epoch
#

and btw, check should be like py def check(payload: discord.RawReactionActionEvent): '''the payload in this case if you used raw_reaction_add would be RawReactionActionEvent'''

quaint epoch
#

because raw_reaction_add always get reactions, reaction_add only sometimes

#

!pypi discord

unkempt canyonBOT
silk kelp
quaint epoch
#

eh

silk kelp
#

lol

slate swan
#

!pypi discord-py

unkempt canyonBOT
slate swan
#

dont use the mirror lol

quaint epoch
dense swallow
#

it gets auto installed when download dpy

silk kelp
#

ive been accidentally using both

slate swan
quaint epoch
silk kelp
#

i just pulled out like 5 grams of ear wax out and now i can hear colors

cold sonnet
#

do you think a discord bot takes away much upload speed?