#discord-bots

1 messages ยท Page 52 of 1

slate swan
#

Good

#

So it works

tight dagger
slate swan
#

Cause I see 22:57

tight dagger
#

thats not the time for me rn

silk fulcrum
#

guys he's literally not using timestamps ๐Ÿ’€

#

bruh

slate swan
#

Use timestamps

silk fulcrum
#

i just typed a random number of course its not your time

tight dagger
#

i generated it from a website

slate swan
#

<t:10372912>

silk fulcrum
tight dagger
silk fulcrum
slate swan
silk fulcrum
#

you can get a timestamp integer via member.created_at.timestamp()

tight dagger
silk fulcrum
#

how is it still not the first ๐Ÿ’€

slate swan
#

Skull is below my hearts_multiple somehow

glad cradle
#

๐Ÿ™‚

slate swan
#

If you do not know python please do not speak in this channel ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ

glad cradle
#

i was playing with pygame module

slate swan
#

Real

silk fulcrum
#

btw I just randomly opened this channel and instantly this message appeared

glad cradle
slate swan
slate swan
slate swan
#

I still use turtle over pygame

slate swan
glad cradle
#

don't make a fuss it's a joke pls

silk fulcrum
slate swan
#

I only know block coding

silk fulcrum
#

bruh

glad cradle
primal token
#

did someone say blocking code?

silk fulcrum
primal token
silk fulcrum
#

gonna add some jishaku cog to my bot i guess

glad cradle
slate swan
#

Iโ€™m sorry guys I only know Fortnite creative logic

silk fulcrum
primal token
primal token
primal token
#

ok

slate swan
silk fulcrum
primal token
silk fulcrum
#

I had Optimised code with changes in 13 files

#

but that... is... burh

slate swan
primal token
#

it reminds me of

silk fulcrum
slate swan
primal token
#

what

slate swan
#

Named binary tag

silk fulcrum
primal token
#

kek

hollow badger
#

shut up [This is in answer to Master32's question, to avoid confusion]

hollow badger
#

I'll let you work out the other two letters

silk fulcrum
hollow badger
primal token
silk fulcrum
#

that's SETFU

hollow badger
#

@slate swan I also saw your message before you deleted it. I suggest you behave better.

primal token
#

!ban etzeitet being mean to others for no reasonlemon_sentimental

silk fulcrum
primal token
silk fulcrum
#

begin learning Python

slate swan
#

this channel is never on topic :p

primal token
#

theres no real role for it, but theres been a pr, that was rejected iirc

hollow badger
#

We don't have a role for that

slate swan
#

there's no such role here ig?

silk fulcrum
slate swan
silk fulcrum
#

ofc

slate swan
tight dagger
silk fulcrum
#

Imagine being Master and saying you don't know Python

tight dagger
#
embed.add_field(name="Created Account On:", value=member.created_at.timestamp()
embed.add_field(name="Joined Server On:", value=member.joined_at.timestamp()
#

is this wrong?

tight dagger
primal token
#

its ironic how harvs said

If you do not know python please do not speak in this channel ๐Ÿ˜ญ๐Ÿ˜ญ๐Ÿ˜ญ
but continues talkingducky_drawing

tight dagger
#

that edit

slate swan
#

you're missing closing brackets

silk fulcrum
silk fulcrum
tight dagger
slate swan
silk fulcrum
#

yep

glad cradle
slate swan
#

!d discord.utils.format_dt suggested instead of manually creating the timestamp

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
silk fulcrum
glad cradle
#

not sure

tight dagger
#

now?

silk fulcrum
slate swan
silk fulcrum
slate swan
#

Report!!

tight dagger
slate swan
silk fulcrum
#

i just want a wallpaper

rotund vortex
#
await interaction.channel.send(embed=reply.pages[0])
await interaction.response.send_message(embed=reply.pages[0])
await reply.respond(interaction)
``` any idea why bot is not able to respond?

Here, line 1 works but 2 and 3 cause Unknown Interaction.
reply is a paginator
silk fulcrum
#

masters attack

tight dagger
torn sail
slate swan
#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

rotund vortex
#
Traceback (most recent call last):
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\ui\view.py", line 375, in _scheduled_task
    await item.callback(interaction)
  File "C:\Projects\YourAnimeBot\views\select_view.py", line 31, in main_callback
    await interaction.response.send_message(embed=reply.pages[0])
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\interactions.py", line 695, in send_message
    await self._locked_response(
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\interactions.py", line 942, in _locked_response
    await coro
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\webhook\async_.py", line 211, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction```
torn sail
#

is it taking 3+ seconds to reach that code?

slate swan
#

๐Ÿ’€

rotund vortex
#

if i do interaction.channel.send(embed=pages[0])

silk fulcrum
rotund vortex
#

it works

rotund vortex
silk fulcrum
#

pycord is..... not the best library

rotund vortex
#

well, i am pretty sure this is a problem from my side

slate swan
#

Just use dpy 2.0

torn sail
brazen raft
slate swan
#

Sure other forks make it easier but then you are not learning

silk fulcrum
novel apexBOT
#

This is not a Modmail thread.

silk fulcrum
#

oof

tight dagger
#
    embed.add_field(name="Joined Server On:", value=(f'<t:{member.created_at.timestamp()}>'))
rotund vortex
#

If i do
await interaction.channel.send(embed=reply.pages[0]) it works
But if i do
await interaction.response.send_message(embed=reply.pages[0])It doens't work.

Both are basically the same thing, one is just sending other is responding so time taken should be same

silk fulcrum
#

decided not to caps

torn sail
silk fulcrum
#

oh me spupid

#

sorry

torn sail
#

<t:{member.created_at.timestamp():R>

#

something like that

wicked atlas
#

You should be able to do it without that tho

silk fulcrum
#

and btw remove ()

#

that's prolly making it a tuple

tight dagger
torn sail
wicked atlas
tight dagger
#

like this?

tight dagger
torn sail
#

just a normal part of the string

torn sail
unkempt canyonBOT
#

@torn sail :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | <class 'int'>
002 | <class 'tuple'>
silk fulcrum
#
await interaction.response.defer()``` at the start of button or whatever you are making
slate swan
silk fulcrum
unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 timeit job has completed with return code 0.

500000 loops, best of 5: 567 nsec per loop
tight dagger
#

Joined Server On:
<t:1621163826.883:R>

brazen raft
silk fulcrum
#

what

torn sail
#

it will remove the decimals which discord doesnt want

silk fulcrum
#

int()

brazen raft
torn sail
tight dagger
#

perfect it works now

torn sail
#

๐Ÿ‘

rotund vortex
# silk fulcrum try deferring it anyways
Traceback (most recent call last):
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\ui\view.py", line 375, in _scheduled_task
    await item.callback(interaction)
  File "C:\Projects\YourAnimeBot\views\select_view.py", line 27, in main_callback
    await interaction.response.defer()
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\interactions.py", line 542, in defer
    await self._locked_response(
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\interactions.py", line 942, in _locked_response
    await coro
  File "C:\Projects\YourAnimeBot\.venv\lib\site-packages\discord\webhook\async_.py", line 211, in request
    raise NotFound(response, data)
discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction```
#

looks like something is wrong with interaction itself.

silk fulcrum
#

your interaction most likely doesnt exist

#

idk how

rotund vortex
#

one sec

#

it does though

#

cz interaction.channel.send() works

torn sail
#

it just sends a normal message in the channel

rotund vortex
#

kbut that means interaction is not none atleast

brazen raft
#

Doesn't Discord invalidate your interaction when you handle it by sending a message

rotund vortex
#

yeah, so respond should work right?

#

await interaction.response.send_message(embed=Embed(title="Hello"))

#

even this is giving Unknown interaction

brazen raft
#

But have you not already sent a message through the interaction by then

tight dagger
#

also does anyone know how to display key perms

rotund vortex
silk fulcrum
#

@torn sail int() seems to be faster

torn sail
#

at least i heard round() is bad

silk fulcrum
#

it is

torn sail
#

!timeit

f'{int(12345.67)}'
slate swan
#

This is not your button to click!

torn sail
#

!timeit

f'{12345.67:.0f}'
#

yeah ur right

brazen raft
#

Weird

#

I would expect the opposite results

torn sail
#

oops

#

click delete

torn sail
silk fulcrum
#

weird is that round is also pretty fast

brazen raft
#

Because :.0f only loads a constant, and calling int loads this name and calls it

#

Besides the other parts of the expression, obviously

silk fulcrum
#

!timeit py f'{round(12345.67)}'

unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 timeit job has completed with return code 0.

1000000 loops, best of 5: 205 nsec per loop
silk fulcrum
#

WHAT

brazen raft
#

It should be as fast as doing :.0f because they do the same thing

torn sail
#

well in c you can do (int) 2.5 or something so maybe that used that directly in python which would make sense why its faster

slate swan
brazen raft
torn sail
#

yeah idk what i meant

brazen raft
#

Calling int on a float rounds towards 0 (when float.is_integer() == False)

silk fulcrum
#

that's why so fast

#

well int is still faster

#

but round seems to be faster than 0f ๐Ÿ˜ณ

torn sail
rotund vortex
#

ok i am writing a complete explanation of my problem..

brazen raft
#

The point of rounding is to not have that many digits

#

I don't think it ever outputs irrational float values

silk fulcrum
#

complete explanator

slate swan
#

What are we even talking about clueless

brazen raft
#

The performances of turning a float into an int

silk fulcrum
brazen raft
#

Yikes

torn sail
#

where in the cpython repo is the source for builtin types?

wicked atlas
silk fulcrum
#

ofc

slate swan
rotund vortex
#

SO i have a custom paginator based on original paginator which is like this.

class SelectPaginator(pages.Paginator):

    def __init__(self, pages: list, reply_callable: callable, timeout: int = 30):

        prev_btn: PaginatorButton = PaginatorButton(
            "prev", None, PREV_EMOTE, ButtonStyle.blurple)
        next_btn: PaginatorButton = PaginatorButton(
            "next", None, NEXT_EMOTE, ButtonStyle.blurple)

        buttons = []
        buttons.append(prev_btn)
        buttons.append(next_btn)

        super().__init__(pages, loop_pages=True, show_indicator=False, use_default_buttons=False, show_disabled=False,
                         disable_on_timeout=True, custom_buttons=buttons, custom_view=SelectView(reply_callable), timeout=timeout)
```It adds a custom view which is like this : 
```py
class SelectView(View):

    reply_callback: callable = None

    def __init__(self, reply_callable: callable, timeout: int = 30):
        super().__init__(timeout=timeout)

        self.reply_callback = reply_callable

        select_button: Button = Button(label="SELECT", style=ButtonStyle.green)
        self.add_item(select_button)

        select_button.callback = self.main_callback

    async def main_callback(self, interaction: Interaction):

        reply = await self.reply_callback()

        await interaction.response.send_message(embed=Embed(title="Hello"))

        await interaction.response.defer()

        if isinstance(reply, Embed):
            await interaction.response.send_message(embed=reply)
        elif isinstance(reply, pages.Paginator):
            await interaction.channel.send(embed=reply.pages[0])
            await interaction.followup.send(embed=reply.pages[0])
            await reply.respond(interaction)
#

Main purpose is when someone clicks on Select Button, a function is called as a callback

#

and that callback function returns either a select paginator or embed

silk fulcrum
#

dude made his own paginator based on pages.Paginator

rotund vortex
#

which is to be sent

silk fulcrum
#

๐Ÿ‘

rotund vortex
#

cz normal paginator dont have buttons to select stuff

#

and it works

#

90% of the time

#

there is just one case where it is not working and giving Unknown Interaction

silk fulcrum
#

I just copied RDanny's paginator style

#

and can't think of anything else than it

#

oh that's pycord I shouldn't forget

slate swan
#

Ew pycord

#

๐Ÿ˜ณ i made my own

primal token
#

i hate making paginators

rotund vortex
#

why are you guys ewing on pycord when its clearly an external problem

slate swan
#

What the fuck is a paginator

primal token
#

kek

silk fulcrum
wicked atlas
slate swan
#

Doesnโ€™t sound hard why are yโ€™all crying

primal token
silk fulcrum
#

Etzeitet went offline

silk fulcrum
#

or did he?

slate swan
primal token
slate swan
#

I donโ€™t wanna get banned for the third time

silk fulcrum
#

bruh, what a guy

rotund vortex
#

is anyone willling to follow along i can explain what i am doing

silk fulcrum
#

i got banned from dpy server(

#

forever

slate swan
#

Python discord bans are so harsh

silk fulcrum
#

just because of spamming mentions

slate swan
slate swan
silk fulcrum
#

I didn't know I would've get banned for spamming mentions in thread called "Spam" or smth like that

slate swan
#

Mods when you spam in spam ๐Ÿ˜ญ๐Ÿ˜ญ

silk fulcrum
#

and iirc I was spamming mentions of myself or my alt account

slate swan
slate swan
#

``def runGiveTokens(amount: int):
if amount % 1 != 0:
amount += 1

tokens = get_all_tokens("tokens.txt")
all_data = []
tokens_checked = 0
actually_valid = 0
give_token = 0
for token in tokens:
    s, headers = get_headers(token)
    profile = validate_token(s, headers)
    tokens_checked += 1

    if profile != False:
        actually_valid += 1
        data_piece = [s, token, headers, profile]
        all_data.append(data_piece)
        print(f"{Fore.GREEN} > {Fore.WHITE}{profile}")
    else:
        pass
for data in all_data:
    lines = 0
    s, token, headers, profile = get_items(data)
    if give_token >= amount:
        with open('tokens.txt') as f:
            for line in f:
                lines += 1
                contents = f.readlines(amount)
                removeToken(token)
                makeUsed(token)

@bot.slash_command(guild_ids=[settings["guildID"]], name="givetoken",
description="Allows you to give tokens to an buyer.")
async def token(ctx: discord.ApplicationContext,
amount: discord.Option(int, "Number of tokens to give.", required=True)):
if not isAdmin(ctx):
return await ctx.respond("Only Bot Admins can use this command.")
if isAdmin(ctx):
await ctx.respond("Started, this could take a while.")
runGiveToken(amount)
return await ctx.edit(f"{contents}")``

#

miru is like discord.ui.Views in hikari

silk fulcrum
#

hikari, lightbulb, miru

#

is this an anime?

slate swan
#

Can someone help
I want to send tokens with /givetoken (Amount)

silk fulcrum
slate swan
#

From an file

shrewd apex
#

hikari was coded by an otaku or anime weeb ig

silk fulcrum
#

!rule 5

slate swan
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

slate swan
#

Lol tokens is an discord thing

slate swan
#

whats really the term "token" used for here?

silk fulcrum
#

spoiler: it is

shrewd apex
primal token
slate swan
shrewd apex
slate swan
#

I'm making accounts an use the account to give

slate swan
slate swan
silk fulcrum
#

these tokens are tokens of users those will join servers to boost them when command executed

slate swan
slate swan
#

You are generating tokens

slate swan
silk fulcrum
#

it is

slate swan
#

Its hand maked

slate swan
#

Lol u guys gay

slate swan
slate swan
#

I said, making not generating

slate swan
slate swan
#

Stupid fk guy

silk fulcrum
slate swan
primal token
#

yeah this is my time to leave now

slate swan
#

Like tomato factoryโ€™s make tomato, not manually

shrewd apex
#

yaoi gang ๐Ÿ‘€

silk fulcrum
slate swan
slate swan
silk fulcrum
#

oh there is Asher and sarth then ok bye leave

slate swan
#

Asher and Sarth slander

shrewd apex
slate swan
#

I pretend to know python so I can call other people code bad

silk fulcrum
primal token
# slate swan I pretend to know python so I can call other people code bad

whats bad here?

from typing import Any, Iterator


class GeneralCache:
    def __init__(self) -> None:
        self.hashmap_cache: dict[Any, Any] = {}
        self.hashmapless_cache: list[Any] = []

    def __iter__(self) -> Iterator[tuple[Any, Any]]:
        for a, b in zip(self.hashmap_cache, self.hashmapless_cache):
            yield a, b

    def __class_getitem__(cls, item) -> str:
        return f"{cls.__name__}[{item.__name__}]"

    def __contains__(self, val: Any) -> bool:
        return (
            val in self.hasmap_cache.values()
            or val in self.hashmapless_cache
        )
#

i need feedback especially with my namespaces

primal token
#

what

vocal snow
#

hashmapless cache wtf !

slate swan
primal token
#

zeffo give me advice

tidal hawk
#

Has anyone done a Discord bot which plays certain radios?

vocal snow
#

Forget the name it is O(n) cache !

primal token
shrewd apex
#

can a dunder method be decorated?

vocal snow
#

Yes

primal token
#

its a method obj so ofc

slate swan
shrewd apex
#

ic i never tried so was just curious

shrewd apex
#

discord bot catching radio waves

primal token
silk fulcrum
#

hm... looks weird

tidal hawk
vocal snow
tidal hawk
#

not sure where they get the audio

silk fulcrum
torn sail
#

!timeit

12345.67.__trunc__()
unkempt canyonBOT
#

@torn sail :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000000 loops, best of 5: 43.3 nsec per loop
torn sail
#

!timeit

int(12345.67)
unkempt canyonBOT
#

@torn sail :white_check_mark: Your 3.11 timeit job has completed with return code 0.

2000000 loops, best of 5: 123 nsec per loop
torn sail
#

much faster way

vocal snow
#

wrong channel ?

silk fulcrum
#

imagine using __trunc__()

slate swan
#

Imagine knowing what the fuck that means

silk fulcrum
#

how would that look in code of the bot

silk fulcrum
slate swan
silk fulcrum
shrewd apex
#

and we saved a few nano seconds yay

silk fulcrum
#

magik

torn sail
#

apparent int(12345.67) calls float.__int__ which doesnt eixst then float.__index__ which doesnt exist and then finally float.__trunc__

silk fulcrum
vocal snow
#

It is like using fstring instead of str(), faster but will cause Guido to visit u at 3 am with machete ๐Ÿ˜ฉ

primal token
#

๐Ÿ˜”

shrewd apex
#

!e

print(dir(float))
unkempt canyonBOT
#

@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.

['__abs__', '__add__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getformat__', '__getnewargs__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__round__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', 'as_integer_ratio', 'conjugate', 'fromhex', 'hex', 'imag', 'is_integer', 'real']
slate swan
#

โ€˜realโ€™

#

!!!

shrewd apex
#

complex number's stuff

slate swan
#

I wanna see abs

pliant gulch
unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your 3.11 timeit job has completed with return code 0.

2000000 loops, best of 5: 168 nsec per loop
primal token
unkempt canyonBOT
#

@primal token :white_check_mark: Your 3.11 eval job has completed with return code 0.

ratio
primal token
pliant gulch
vocal snow
slate swan
junior verge
#

Does anyone have any idea how this happens? My bot works perfectly fine but randomly after like 2-4 hours it just goes offline?

#

And the terminal gets killed on my vps

slate swan
#

Damn everything killin yo vps

#

Handle errors

distant nest
#

Is it true that Discord removed Selects from modals?

junior verge
#

I am?

slate swan
junior verge
slate swan
#

why does it print "killed"

torn sail
#

it was never supposed to be there in the first place

slate swan
#

you for sure have something like that in your code

junior verge
#

It used to work fine when I had it on heroku but since I switched to a vps it does this and is really annoying, if I am asleep and it goes down its down for a long time :( ๐Ÿ™„

#

But an error or multiple shouldn't be killing it

distant nest
torn sail
junior verge
#

Anyone got idea on how I could maybe fix my issue?

slate swan
#

why would they remove it if it was to get back

#

Why did they remove it ๐Ÿ˜ญ๐Ÿ˜ญ

pliant gulch
torn sail
#

oh theyre coming back?

pliant gulch
#

That's what I got from the official discord API server

distant nest
#

I would like all sorts of stuff for modals, like checkboxes and whatnot

torn sail
#

they have a lot of potential

junior verge
slate swan
#

dunno then, check your Ubuntu server configs then

#

Start

silk fulcrum
#

hpop

junior verge
silk fulcrum
#

!timeit py 12345.67.__int__

#

40 seconds more

primal token
#

what are you even doing lmao

maiden fable
#

91.6 in 3.11 what about 3.10 ๐Ÿ‘€

silk fulcrum
#

burh

unkempt canyonBOT
#

@silk fulcrum :warning: Your 3.10 timeit job has completed with return code 0.

[No output]
torn sail
maiden fable
#

!timeit
12345.67.int

unkempt canyonBOT
#

@maiden fable :warning: Your 3.10 timeit job has completed with return code 0.

[No output]
silk fulcrum
#

uhhuh

sick birch
#

what are yโ€™all doin

maiden fable
#

Tryna run a timeit job on 3.10

torn sail
brazen raft
maiden fable
#

But I ain't got 3.11

sick birch
#

how do we manage to talk about everything except discord bots here consistently

maiden fable
#

The most active topical channel

silk fulcrum
#

ot3 off the edge

brazen raft
#

I firmly believe some of the questions being asked here are also unrelated to the topic

sick birch
torn sail
maiden fable
#

LMAO

tawdry perch
sick birch
#

Iโ€™ll let it slide ๐Ÿคซ if we keep this from the mods

torn sail
#

then we wondered why caling int() is faster than :.0f in f strings

slate swan
unkempt canyonBOT
#

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

001 | Traceback (most recent call last):
002 |   File "<frozen runpy>", line 198, in _run_module_as_main
003 |   File "<frozen runpy>", line 88, in _run_code
004 |   File "/usr/local/lib/python3.11/timeit.py", line 376, in <module>
005 |     sys.exit(main())
006 |              ^^^^^^
007 |   File "/usr/local/lib/python3.11/timeit.py", line 315, in main
008 |     t = Timer(stmt, setup, timer)
009 |         ^^^^^^^^^^^^^^^^^^^^^^^^^
010 |   File "/usr/local/lib/python3.11/timeit.py", line 123, in __init__
011 |     compile(stmtprefix + stmt, dummy_src_name, "exec")
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/uzavawileb.txt?noredirect

silk fulcrum
#

will I get a role for participating in PyWeeK?

pliant gulch
unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your 3.11 timeit job has completed with return code 0.

20000000 loops, best of 5: 12.7 nsec per loop
brazen raft
silk fulcrum
#

b-b-b-b-bruh

#

20 000 000 loops

slate swan
silk fulcrum
#

\u200b

pliant gulch
#

It'll zero it

silk fulcrum
#

iirc

slate swan
#

ow

brazen raft
#

It does floor division, it just doesn't get rid of the decimal point for float types

#

When either the divisor or the dividend are floats, arithmetic operators return floats

silk fulcrum
#

huh

shrewd apex
#

there will be .00 after decimal point

pliant gulch
#

Okay easy fix is to omit the floordiv operator and use the dunder method directly then

#

!timeit ```py
12345.67.floor()

unkempt canyonBOT
#

@pliant gulch :white_check_mark: Your 3.11 timeit job has completed with return code 0.

5000000 loops, best of 5: 46.4 nsec per loop
silk fulcrum
#

gonna update something in my bot ๐Ÿ”ช

torn sail
sick birch
unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
silk fulcrum
brazen raft
#

Except it wouldn't if the timestamps are negative

#

If ever...

silk fulcrum
#

<t:-45678>

#

what

torn sail
silk fulcrum
#

<t:-0>

sick birch
#

my favorite time

silk fulcrum
#

oh yeah

#

forgot about it

torn sail
#

was that the moon landing?

silk fulcrum
sick birch
#

no

pliant gulch
brazen raft
#

About 62 and a half milliseconds on my machine

>>> from timeit import timeit
>>> timeit("12345.67.__floor__()") * 1e3
62.45430000126362
>>> 
sick birch
#

that was the Unix epoch

torn sail
sick birch
#

if only they were

primal token
#

whats the f string format to convert base10 into base 2 i forgor

brazen raft
#

b

silk fulcrum
#

int(34567, base=2)

pliant gulch
brazen raft
#

b for binary, o for octal, x for hexadecimal

primal token
brazen raft
#

before those shows the prefix

primal token
#

something like 0bbut i forgot how its placed

silk fulcrum
#

!e print(b"45678")

unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.

b'45678'
brazen raft
#

08b shows a zero padded 8 digits long binary number

silk fulcrum
#

shit im dumb

brazen raft
#

Well, at least 8 digits long

#

!e

print(f"{19:08b}")
unkempt canyonBOT
#

@brazen raft :white_check_mark: Your 3.11 eval job has completed with return code 0.

00010011
primal token
brazen raft
#

Unless it's longer than 8 binary digits

primal token
#

yeah

#

alright thanks for the reminder lol

slate swan
#

I got the greggs hoodie

sick birch
#

fire

white rain
#

Can someone explain why this script prints the guild name but 2 times.

```    for guild in self.bot.guilds:
        print(guild)```
slate swan
slate swan
white rain
sick birch
#

Can we see the output?

slate swan
white rain
#

<discord.utils.SequenceProxy object at 0x0000025424B33790>

slate swan
white rain
#

but 2 times

#

[<Guild id=915637697073254471 name='Le Trou Glorieux' shard_id=0 chunked=True member_count=28>]

If i put that in a list

slate swan
#

Ok thatโ€™s one guild

white rain
#

yes but it prints that 2 times

#

but with the same name of guild

slate swan
white rain
#
            print(list(self.bot.guilds))```
sick birch
#

Oh yeah

#

Youโ€™re printing all of your guilds each time

#

just print guild

white rain
#

of my guild ? or the guilds where my bot is

slate swan
#

He did that in the first time

sick birch
#

Ah

#

Maybe it wasnโ€™t saved?

white rain
#

no it is

brazen raft
#

Maybe you forgot to close a session

#

An old running instance of the bot

slate swan
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swan
#

!traceback

unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

silk fulcrum
#

mysql has pools? ๐Ÿ˜ณ

slate swan
#

yes

brazen raft
#

You should the initialization stuff in setup_hook, not on_ready

slate swan
#

don't do connection stuff in on_ready, use setup hook instead

#

on_ready isn't always the first event that gets triggered ( in discord.py & forks)

rotund vortex
#

any idea why

await interaction.response.defer(ephemeral=True)

await interaction.followup.send("Hello")
``` this is causing Unknown Interaction?
slate swan
#

yes

brazen raft
#

I should mention it's not an event nor anything, you override bot.setup_hook with that coroutine function

slate swan
#

^

silk fulcrum
#

bruh

brazen raft
#

It's simply a coroutine function

primal token
silk fulcrum
#

literally just being told that its not an event

brazen raft
#

No decorator

slate swan
#
@bot.event
async def setup_hook(): ...
``` is an equivalent of `bot.setup_hook = setup_hook`
primal token
#

yeah

torn sail
#

discord.Client.event just uses setattr so yep

brazen raft
#

Bruh

silk fulcrum
#

looks vierd

slate swan
#

thats why listeners over events ( if you use Bot ofc)

silk fulcrum
#

BUM combine them!

#

of course!

#

no one asked for that

#

but why not

slate swan
#

setup_hook is outside the scope of the first line

torn sail
#

imagine

@bot.event
async def start(token):
    await commands.Bot.start(bot, token)
silk fulcrum
#

you would need self=bot

#

or you wouldn't?

torn sail
slate swan
torn sail
#

Keyword and position work

silk fulcrum
#

of course! do not understand my sarcasm and try to combine it even more! that's what you need to do!

torn sail
#

Setup hook is in this gist

silk fulcrum
#

yessss, combine it.... this already gets too far

slate swan
#

man just replace the on_ready with setup_hook in your code

#

!d discord.Client.setup_hook if you wanna know how that works

unkempt canyonBOT
#

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

A coroutine to be called to setup the bot, by default this is blank.

To perform asynchronous setup after the bot is logged in but before it has connected to the Websocket, overwrite this coroutine.

This is only called once, in [`login()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.login "discord.Client.login"), and will be called before any events are dispatched, making it a better solution than doing such setup in the [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready") event.

Warning

Since this is called *before* the websocket connection is made therefore anything that waits for the websocket will deadlock, this includes things like [`wait_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_for "discord.Client.wait_for") and [`wait_until_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_until_ready "discord.Client.wait_until_ready")...
slate swan
#

yes that will work

#

and after that you will face yet another MySQL related issue

sick mulch
#

How to bump auto bot disbord with python ?

slate swan
tidal hawk
#

has anyone created a bot which plays music from audio/mpeg url (not youtube)

torn sail
silk fulcrum
#

oh

torn sail
#

Yeah that explains it

silk fulcrum
#

gosh

torn sail
#

You could sublclass bot then override start and add it in there

vocal snow
white rain
brazen raft
#

If that is the case, you have an open terminal window where it is running

tight dagger
#

hey guys

#

is there any way we can make the bot list the users with that specific role?

primal token
#

!d discord.Role.members

unkempt canyonBOT
tight dagger
indigo skiff
#

Hello people. I am new to making discord bots and started making my first one today. But for some reason it will not reply to me. There is no error and the bot has started up but no reply is received.

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

sick birch
#

You need message_content

indigo skiff
# sick birch You need message_content

Ohh, I see. The thing is, in the tutorial I am watching there is no mention of intents. I added it after some googling and dont understand this intent things very well. Can I know where I can read up on it? Something a beginner can understand?

sick birch
indigo skiff
potent spear
#

equally as bad

indigo skiff
#

damn

potent spear
#

this is a fast changing lib, no video tutorial will do

#

you'll have to watch docs and their examples to get correct implementations

indigo skiff
#

Ohh, is that so? Ill search for something

zealous jay
#

Are Lucas tutorial's bad?

sick birch
#

Yeah the tutorials are, crudely put, smoking hot garbage

sick birch
zealous jay
#

I mean I know youtube tutorials are not recommendable

#

I remember I got banned from his discord ๐Ÿ›Œ

slate swan
#

No Lucas slander spongey_sad

zealous jay
#

me too and now I call bot client ๐Ÿ˜ข

#

anyways I have been testing with getting audit_logs but every time it stops at a different number

#
        for guild in self.client.guilds:
            try:
                async for logs in guild.audit_logs(limit=30000, action=discord.AuditLogAction.ban):
                    index += 1
                    print(f'Inserted {index} bans. | {logs.target}')
            except:
                print('Skipping')
#

At the moment Im just printing things

#

It stopped at 588

slate swan
#

Skill issue

potent spear
#

well, could it be you only banned 588 people?

zealous jay
#

Its not my server only

#

And I remember having more records

slate swan
#

Throughout all servers, you have banned 588 people nerd2

zealous jay
#

Let me check the old database

slate swan
#

Maybe people got unbanned

potent spear
potent spear
zealous jay
#

ah yes

#

4k people unbanned

zealous jay
#

Well now it got to 588 again

lapis lintel
#

Any good hosting services for a low price?

slate swan
#

Maybe you are getting an error that you canโ€™t see because you are handling it

slate swan
zealous jay
lapis lintel
slate swan
lapis lintel
#

which ones

zealous jay
#

Here

indigo skiff
#

btw if I do
intents = discord.Intents().all()
instead of
intents = discord.Intents.default()

lapis lintel
#

5$ a month its a little expensive for me, i dont have that much money to start with

#

I saw a hosting option with 512 RAM, for 1$, what do you guys think

indigo skiff
#

Fuckin finally

#

why is this intend crap so confusing

#

There are no clear explanations on the web either

zealous jay
#

I got some missing permission errors but I already knew about that

#

@lapis lintel if you are a student you could try to get the github student developer pack and get some hosting for free

#

anyways if someone knows why this happens please mention me

#

using guild.bans() seems to work better

#

but I would like to use audit logs as it gives more information

heady citrus
#

Iโ€™ve tried removing the first two but if i do the whole help menu stops working

sick jackal
#

Hi all! Is there any way to understand this library? because nothing is clear

zealous jay
#

the docs?

slate swan
#

Skull ๐Ÿ’€

lone lichen
dry marsh
#

Hi

#

I want more than one function to work at different time. Ex: first function at 6Pm second function will work at 9Am and so on. I have been try asyncio and sleep but it doesn't work. I saw some solutions on stack overflow but it doesn't work with me. Please can someone help me

spark wigeon
#

using the on_member_join bot event, how can i get the server id from the server in which the member joined?

spark wigeon
winged coral
#

or ext.tasks

dry marsh
primal token
zealous jay
#

Why does this sometimes returns an error? Like the owner is not found

            owner = member.guild.owner
            em = discord.Embed(title="Alert, actions needed.", description=f"A new user has joined your server but there's no configured alerts channel, please set an alerts channel using **/config_set_channel** on your server ({member.guild}).", colour=0xe74c3c)
            em.set_thumbnail(url=member.guild.icon.url)
            await owner.send(embed = em)
#

I guess discord for some reason sometimes returns None as the owner?

#

await owner.send(embed = em) AttributeError: 'NoneType' object has no attribute 'send'

scarlet snow
#

๐Ÿฅด

#

i dont think so

#

anti nuke tho..

sick birch
limber bison
#

Is Buttons have exception TimeoutError ?

sick birch
#

And how is this different from using discord.Member.ban?

pulsar bay
#

idk , just ideas

sick birch
#

So it does the same thing you're doing here

#

Using a proxy will slow it down further

pulsar bay
#

itโ€™s just ideas bro

pulsar bay
sick birch
#

The network speed is the bottleneck

#

Compared to the network request time, the overhead is fractional, if not negligible

robust fulcrum
sick birch
kindred epoch
#

Code it

robust fulcrum
sick birch
#

You have a development time limit? Sorry I'm not understanding what you're asking

robust fulcrum
dry kelp
#

@sick birch I tried changing the file tree of my bot

#

changed the paths nd shit, but this still seems to error

slate swan
#

it cant find connections

dry kelp
#

i know. I'm wondering why lol

slate swan
sick birch
# dry kelp

Doesn't seem related to discord bots, maybe try claiming a help channel?

robust fulcrum
sick birch
#

Not asyncio.sleep, no

#

It's non-blocking, so it yields back to the event loop

slate swan
sick birch
slate swan
#

i know

robust fulcrum
robust fulcrum
#

Ok

kindred epoch
robust fulcrum
slate swan
#

look in settings.database

#

if settings.database.connections:
print("true")
else:
print('false')

#

look if it find the connections

#

if it dont just look in other modules

dry kelp
#

@sick birch it is discord bots related tho

#

it's not an tortoise orm error or any type of db error

#

its an atr error that used to work before i changed the file tree lol

sick birch
sonic flax
#

24.08 01:58:01 [Bot] [2022-08-24 02:58:01] [INFO ] discord.client: logging in using static token
24.08 01:58:01 [Bot] [2022-08-24 02:58:01] [INFO ] discord.client: logging in using static token
24.08 01:58:01 [Bot] Traceback (most recent call last):
24.08 01:58:01 [Bot] File "/./Bot2/main.py", line 161, in <module>
24.08 01:58:01 [Bot] bot.run(token)
24.08 01:58:01 [Bot] File "/.local/lib/python3.9/site-packages/discord/client.py", line 828, in run
24.08 01:58:01 [Bot] asyncio.run(runner())
24.08 01:58:01 [Bot] File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
24.08 01:58:01 [Bot] return loop.run_until_complete(main)
24.08 01:58:01 [Bot] File "/usr/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
24.08 01:58:01 [Bot] return future.result()
24.08 01:58:01 [Bot] File "/.local/lib/python3.9/site-packages/discord/client.py", line 817, in runner
24.08 01:58:01 [Bot] await self.start(token, reconnect=reconnect)
24.08 01:58:01 [Bot] File "/.local/lib/python3.9/site-packages/discord/client.py", line 745, in start
24.08 01:58:01 [Bot] await self.login(token)
24.08 01:58:01 [Bot] File "/.local/lib/python3.9/site-packages/discord/client.py", line 577, in login
24.08 01:58:01 [Bot] raise TypeError(f'expected token to be a str, received {token.class!r} instead')
24.08 01:58:01 [Bot] TypeError: expected token to be a str, received <class 'NoneType'> instead

#

what does this mena ?

drowsy prairie
#

How do I modify the contents of an existing embed?

pulsar bridge
#

All mighty Robin
Or whoever decides to answer
I require thy infinite knowledge
How do I remove or overwrite the existing !help command?

#

Is it possible?

slate swan
#

how do you downgrade the discord version in shell on replit

limber bison
#

What event and callback ? And what's a commands.command is ?

potent spear
slate swan
#

i looked and got no answers

slate swan
#

so i came here

potent spear
slate swan
potent spear
#

not the correct google keywords

#

you would be looking for "install specific python package version"

slate swan
#

oh there

#

thanks, sorry lol

primal token
unkempt canyonBOT
primal token
#

just set it to None

#

im not Robin unfortunately im betterducky_beer

slate swan
serene wolf
#

how to create bot music on discord :)))

slate swan
#

!ytdl get ytdl-ed

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโ€™s robots.txt file; (b) with YouTubeโ€™s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
slate swan
#

you can use SoundCloud and download songs in cache to play them though

#

@slate swan Did you hear the bad news?

lapis nymph
#

if im trying to store different values for each user, could i store a dictionary in a file and append the user and their individual "value"?

#

or does the discord API have an easier solution

slate swan
#

you can save your stuff with respect to user's ID in a dictionary

lapis nymph
#

its a casino type thing, so i want to store the user id and the amount of "chips" they have

slate swan
#

yes ```py
chips = {}

for saving

chips[user.id] = amount

for getting

amount = chips.get(user.id)

lapis nymph
slate swan
pulsar bridge
primal token
primal token
#

im joking btw so robin dont take it serious, kek

primal token
#

You dont have such power because youre too weak to manage it, thats why you dont use python and use a language like JSducky_beer

#

my english skills are weak as well, anyways i think we should stop joking around lol

silk fulcrum
#

@primal token that's my work to be here almost 24/7 dont steal it

primal token
#

my mental health is slowly degrading to a point where i wont take it anymore, so go ahead be my guess

primal token
#

connections that he cannot control, connections that get closed and return an HTTP code of 69420ducky_beer

sick birch
#

Me?! i have none :(

primal token
#

Ill rather be broke then have fraudulent money๐Ÿ˜•

slate swan
#

Hi Ryuga

paper sluice
#

hi

slate swan
#

Does anyone know how to send a slash command? I normally just use post requests for sending messages from my account, but I need to know how to do slash commands.

slate swan
silk fulcrum
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

torn sail
#

No self botting here

slate swan
#

oh, i didnt know that sry

#

but does anyone know where i can get this information if not from here?

silk fulcrum
torn sail
#

Probably you cannot find it

slate swan
#

I don't think it's possible

#

rip

pulsar bridge
primal token
#

its a kwarg thats passed into the intialiazer of an instance of the Bot class kek

pulsar bridge
#

So, uh

#

If I understand correctly

#

I put it in here

primal token
#

that is correct.

vocal snow
pulsar bridge
#

, help_command = None?

primal token
pulsar bridge
#

;3

#

Dislike the coloring?

primal token
#

no, you passed a semi colon uppon creation of a pointer/variable

#

literally not needed at all๐Ÿ—ฟ

pulsar bridge
#

OH THAT

#

Yea, habit from other languages

primal token
#

smh

pulsar bridge
#

shhhhh~

primal token
#

python is too high level for thatducky_beer

pulsar bridge
#

New to python, not new to coding

primal token
#

jk btw

pulsar bridge
vocal snow
pulsar bridge
primal token
primal token
#

๐Ÿ˜ณ

pulsar bridge
primal token
pulsar bridge
#

Excellent

#

I shall return when my brain juice runs dry

silk fulcrum
#

```pyjs
console.log('yes')
```

primal token
pulsar bridge
#

OH YEA, BEFORE I GO

primal token
pulsar bridge
#

@primal token

primal token
#

you dont deserve hell

silk fulcrum
primal token
#

you deserve to be put where java is

primal token
primal token
#

Now join the esoteric sideducky_maul

slate swan
#

no autocompletes ๐Ÿ˜”

inner epoch
#

What is the way to have user input button name for persistent views?

Is this possible?

slate swan
# pulsar bridge <@981079408850903111>

๐Ÿ’€```py
import os
import random
import time

import discord
from discord.ext import commands

utils.get

discord.utils.get()

asyncio

discord.client.asyncio

vocal snow
#

wtah

slate swan
#

discord.py has asyncio impoted in bot.py lol, not the best way, but no problems with using it

inner epoch
#

. . . .

#

Am I in the right server lol

pulsar bridge
#

@primal token , I SUMMON THEEE
Whatโ€™s the best way to parse Args through an on_message event?

pulsar bridge
inner epoch
pulsar bridge
#

Wait, could I just split the message into multiple strings and then use those strings as the Args?

#

I think I solved it, thanks @vocal snow for being such a good listener
PI_2cool

#

I shall return when I fail

deep osprey
#

Guys I have an issue, I got 3 json files, each file contains information for some stuff like banned ppl, allowed channels, etc.., How to mix them in one file and when I need to get some info about one thing like banned ppl?

vocal snow
#

Database

deep osprey
#

paid db?

vocal snow
#

Why paid

#

Just use a free one

deep osprey
#

are there free dbs?

vocal snow
#

Sqlite is easy to start with

rugged shadow
#

who did this to you, karim

deep osprey
rugged shadow
#

json is not a database

#

and you shouldn't be using json to store user data

deep osprey
#

even small amount of data?

vocal snow
#

Forget the amount of data. You're storing complex, relational data which belongs in a relational database

deep osprey
#

ok is there any tutorial for sqlite?

slate swan
drowsy prairie
#

how to clear messages from users on a particular channel

pulsar bridge
junior verge
vocal snow
tawdry tendon
#

I have this code

#

And when I run this code for the dropdown I get this

#

But then when I tap one of the options I get this

#

Anyone can help?

silk fulcrum
#

@tawdry tendon In your callback you are doing self.label[0], self here represents your View class, so you are trying to get view.label[0], and by the way even Select class doesn't have label, you probably meant select.values[0]

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

silk fulcrum
#

your images don't even load properly (at least for me)

#

you cannot delete an interaction, what do you want to do?

#

!d discord.Interaction.delete_original_response I think this is what you want

unkempt canyonBOT
#

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

Deletes the original interaction response message.

This is a lower level interface to [`InteractionMessage.delete()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.delete "discord.InteractionMessage.delete") in case you do not want to fetch the message and save an HTTP request.
silk fulcrum
#

hm?

#

ohhhh

#

bruh

vale wing
#

Is phone replit programming a cult now or smth

silk fulcrum
#

it's message

#

delete_original_message()

silk fulcrum
lone lichen
vale wing
#

๐Ÿคฎ

tawdry tendon
#

It still has the error

silk fulcrum
tawdry tendon
tawdry tendon
tawdry tendon
#

Is that Remote Desktop protocol?

#

@maiden fable

maiden fable
#

Yup

swift pumice
#

what was it called to get a channel?

#

i remember it was something like bot.get.channel

silk fulcrum
#

get_channel?

swift pumice
#

nvm

#

i found it ty

#

how can i make events only work in a specific channel?

silk fulcrum
swift pumice
#

thanks

silk fulcrum
#

if something.channel.id != my_channel_id: return

vocal snow
#

Ssh

swift pumice
#

that is send in that channel

silk fulcrum
#

isnt that obvious...

swift pumice
#

thanks

robust fulcrum
#

Guys how can I make a button that can be only used by the comamnd user not by others ?

slate swan
#

you could save the id of the user who requested the command and when someone clicked on the button, you would check if it is the same id of the person who requested the command

slate swan
silk fulcrum
#

!d discord.ui.View.interaction_check

unkempt canyonBOT
#

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

A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.

This is useful to override if, for example, you want to ensure that the interaction author is a given user.

The default implementation of this returns `True`.

Note

If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
slate swan
#

thx

silk fulcrum
#
class MyCoolView(View):
    async def interaction_check(self, interaction: Interaction):
        return interaction.user.id == my_cool_user_id:```
#

@slate swan example this

robust fulcrum
slate swan
#

nice

robust fulcrum
#

And send to the button class

silk fulcrum
# robust fulcrum Bro i mean that how would I store the id?

you can take a ctx argument when creating a view:

class MyCoolView(View):
    def __init__(self, ctx: Context):
        super().__init__()
        
        self.ctx = ctx

    async def interaction_check(self, interaction: Interaction):
        return interaction.user.id == self.ctx.author.id```
#

and thenpy view = MyCoolView(ctx) await ctx.send("My Cool Message", view=view)

#

in a command

swift pumice
#

is it possible to make a message that is send in a channel to send that to another channel, like that my message gets send to #data-science-and-ml

#

?

silk fulcrum
swift pumice
#

i meant channel sry

robust fulcrum
silk fulcrum
silk fulcrum
silk fulcrum
swift pumice
#

ok sorry

weak quail
#

are text commands getting discontinued permanently? ๐Ÿ˜ฎ

silk fulcrum
# weak quail are text commands getting discontinued permanently? ๐Ÿ˜ฎ

message commands need Message Content intent which is becoming privileged since August 31st, that means that you can still use message commands in your private bots but verified bots will need to get a permission to use it, so that's why everyone switched to slash commands. (Message Content intent not only allows you to use message commands, it is used to see the content of usual messages at all, so without it you can only see contents of messages that contain ping of the bot)

robust fulcrum
#
Extension 'cogs.utilis' raised an error: ImportError: cannot import name 'yesno' from 'views' (/home/runner/Bot1/views.py)

Guys why i am getting this error?

silk fulcrum
#

you are importing yesno from views

#

which does not exist

robust fulcrum
silk fulcrum
#

show the code

robust fulcrum
silk fulcrum
#

lowercase class name :blobpain:

#

how do you import it?

robust fulcrum
silk fulcrum
#

in what file

lone lichen
#

What is this replit mobile stuff ๐Ÿ˜‚

silk fulcrum
lone lichen
#

Now u got em doing it on mobile

robust fulcrum
silk fulcrum
#

using replit is not exactly bad, it's bad as a VPS, well... bad as code editor tooo...

lone lichen
silk fulcrum
#

well.... at least it can run the bot...

#

that's... already... pretty cool... right?..

lone lichen
#

Ur computer can too

silk fulcrum
#

well... it has a syntax highliting