#discord-bots

1 messages · Page 578 of 1

slate swan
#

Do you just ask a friend to gift you nitro with your money or sm?

dusk pumice
#

I think older name is better

boreal ravine
#

preference

visual island
#

now everyone knows my old name 😕

slate swan
#

revealed

boreal ravine
#

ok

dusk pumice
slate swan
visual island
slate swan
#

Now you cant work in the men in black

dusk pumice
visual island
#

I'm new icy now 😎

visual island
dusk pumice
dusk pumice
visual island
dusk pumice
dapper cobalt
#

!ot

unkempt canyonBOT
slate swan
dusk pumice
dapper cobalt
#

Seriously. This is going so off-topic.

dusk pumice
#

umm

#

okay

visual island
#

I dont start it

#

sure

valid galleon
#

how do i make the embed thumbnail like this?(im referring to the image)

dusk pumice
#

It's seting author

valid galleon
#

?

dusk pumice
quasi pawn
#

how do I display all the commands that are in cd and it's remaining cd

valid galleon
#

alright thanks

dusk pumice
# valid galleon ?

embed.set_author(name="test", url="https://url.com", icon_url="https://image_pic.com")

change the links

dapper cobalt
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.
quasi pawn
slate swan
#

they are in cooldown for a person?

#

Hi evreone How can I learn 0 to 100 discord robotics with Python?

quasi pawn
#

all the commands that are in cooldown of a person

dapper cobalt
#

That might be a little complicated.

You'll have to first check if the command is on a cool down using the is_on_cooldown method, and if it returns True, then get the command's cool down time using the get_try_after method.

#

!d discord.ext.commands.Command.is_on_cooldown

slate swan
#

lmao

dapper cobalt
#

@slate swan smart.

#

!d discord.ext.commands.Command.is_on_cooldown

unkempt canyonBOT
slate swan
#

okay nice

#

and that... returns it for ctx.author?

#

lemme check on github lol

dapper cobalt
#

!d discord.ext.commands.Command.get_cooldown_retry_after

unkempt canyonBOT
dapper cobalt
slate swan
#

mhm

dapper cobalt
#

Whether it's ctx.guild cooldown, or ctx.channel, or ctx.author.

slate swan
#

in discord.ext.commands

#

oh it's in core

visual island
#

yeah

dusk pumice
slate swan
#
        if not self._buckets.valid:
            return False

        bucket = self._buckets.get_bucket(ctx.message)
        dt = ctx.message.edited_at or ctx.message.created_at
        current = dt.replace(tzinfo=datetime.timezone.utc).timestamp()
        return bucket.get_tokens(current) == 0

``` thanks for nothing Danny ![yert](https://cdn.discordapp.com/emojis/832277526809149461.webp?size=128 "yert")
slate swan
#

anywhere except YT

vocal plover
slate swan
#

the docs, here, and what Ale sent

waxen granite
#

how do i paginate my message content?

vocal plover
#

i see you're lurking like me jake lmao

slate swan
pallid meadow
boreal ravine
slate swan
#

stalkers

pallid meadow
#

I always lurk here

#

kek alec get exposed

vocal plover
#

holy crap

undone wyvern
#

Not being shamed for recommending a good tutorial 🥴

pallid meadow
vocal plover
#

hey at least 1000 of them arent me Kek

boreal ravine
#

your 10% of them

vocal plover
#

I have the advantage of knowing the url of each part/tip, so i can recommend it in more specialised situations Kek

slate swan
waxen granite
slate swan
slate swan
#

the 1132nd time

#

Youve been sent like 2 already

#

What else do you want

dusk pumice
tough mirage
#
@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))
    print(f'Coded by Bill Flow (NOT lowkey#0669)')``` how do I make it also print the bot ID?
sage otter
#

user.id

dusk pumice
#
@client.event
async def on_ready():
    print('We have logged in as {0.user}, ID: {0.user.id}'.format(client, client))
    print(f'Coded by Bill Flow (NOT lowkey#0669)')
#

I guess(Didn't tested it)

slate swan
#

client.usr

dusk pumice
#

I did wrong typing

slate swan
#

and why does everybody use the format function there

dusk pumice
#

I don't know

#

there is f-string

slate swan
#

print(f'We have logged in as {client.user}, ID: {client.user.id}')

#

everybody uses the same youtube tutorial

dusk pumice
#

😐

#

That's bad

#

Copy is bad

steady flume
#

Guys, how to make it so that if no one interacted with the buttons for 15 seconds, then they will become disabled

#

It’s 2.0

dusk pumice
#

I wonder how to upgrade dpy to 2.0 in repl.it

#

😐

slate swan
#

u don't

dusk pumice
#

?

slate swan
#

that's the point

steady flume
slate swan
#

repl.it is the worst possible bot hosting option

steady flume
#

Yes

#

how to make it so that if no one interacted with the buttons for 15 seconds, then they will become disabled

#

Do you know ?

slate swan
#

noidea

dusk pumice
steady flume
#

I made timeout - 15 sec

dusk pumice
slate swan
#

show how you did it

dusk pumice
#
for row in components:
  row.disable_components()

Maybe

slate swan
#

You should not use Repl.it to host your bot.

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

  • The machines are super underpowered.

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

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

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

Please avoid using repl.it to host your bot. It's not worth the trouble.
See ?tag vps in testing if you want a list of decent hosts (there are no free hosts).

https://intuitiveexplanations.com/tech/replit/

dusk pumice
slate swan
dusk pumice
# slate swan You should not use Repl.it to host your bot. While this may seem like a nice an...

But i am useing it

Replit: Updating package configuration

 Installing dependencies from lock file

Package operations: 34 installs, 14 updates, 0 removals

  • Updating cffi (1.14.6 -> 1.15.0)
  • Installing hpack (3.0.0)
  • Installing hyperframe (5.2.0)
  • Updating idna (3.2 -> 2.10)
  • Updating multidict (5.1.0 -> 5.2.0)
  • Installing async-generator (1.10)
  • Updating chardet (4.0.0 -> 3.0.4)
  • Updating cryptography (3.4.8 -> 35.0.0)
  • Installing h11 (0.9.0)
  • Installing h2 (3.2.0)
  • Installing outcome (1.1.0)
  • Installing sniffio (1.2.0)
  • Installing sortedcontainers (2.4.0)
  • Updating typing-extensions (3.7.4.3 -> 3.10.0.2)
  • Updating yarl (1.6.3 -> 1.7.0)
  • Updating certifi (2021.5.30 -> 2021.10.8)
  • Updating charset-normalizer (2.0.4 -> 2.0.7)
  • Installing hstspreload (2021.10.1)
  • Installing httpcore (0.9.1)
  • Installing pyopenssl (21.0.0)
  • Installing rfc3986 (1.5.0)
  • Installing soupsieve (2.2.1)
  • Installing trio (0.19.0)
  • Updating urllib3 (1.26.6 -> 1.26.7)
  • Installing wsproto (1.0.0)
  • Installing beautifulsoup4 (4.10.0)
  • Updating click (8.0.1 -> 8.0.3)
  • Installing discord.py (1.7.3)
  • Installing httpx (0.13.3)
  • Updating jinja2 (3.0.1 -> 3.0.2)
  • Installing trio-websocket (0.9.2)
  • Updating werkzeug (2.0.1 -> 2.0.2)
  • Installing bs4 (0.0.1)
  • Installing buttonpaginator (0.0.2)
  • Installing colorama (0.4.4)
  • Installing discord (1.7.3)
  • Installing discord-components (2.1.2)
  • Installing discord-py-interactions (3.0.2)
  • Installing discordpy-slash (11.0.0)
  • Installing dload (0.6)

STUCK HERE
||DAMN||

cloud dawn
#

For a private bot it suffices..

slate swan
#

Dang

cloud dawn
#

Then only 2 factors are at play, the ip sharing and guild size.

dusk pumice
#

repl it updating for 1 hour

#

can't do coding

dusk pumice
steady flume
#

Guys, how to make it so that if no one interacted with the buttons for 15 seconds, then they will become disabled

cloud dawn
#

I know, it's that we help with discord-python related issues here and not repl.it issues. I suggest contacting them.

worn flint
#

hey

steady flume
worn flint
#

i am new here

steady flume
#

2.0

cloud dawn
slate swan
worn flint
#

i am ksgaming

cloud dawn
worn flint
dusk pumice
cloud dawn
slate swan
slate swan
worn flint
dusk pumice
slate swan
#

If you know the basics go for it

worn flint
#

i want to learn on discord module

cloud dawn
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**...
dusk pumice
#

DOCS will help ya

worn flint
#

i know abit coding 1min

slate swan
worn flint
#

ohh

dusk pumice
#

XD

dusk pumice
#

Still... You can fork dpy..

cloud dawn
steady flume
worn flint
#

@dusk pumice do u know how to make a bot?

cloud dawn
slate swan
slate swan
#

Mostly everybody here has one

dusk pumice
#

why?

worn flint
#

can u teach me error handling, embed and other basics plz

dusk pumice
cloud dawn
#

I got 2 tokens 😎

slate swan
dusk pumice
worn flint
#

🙂

#

Kk

dusk pumice
#

I will do as best I can

visual island
unkempt canyonBOT
#

Timeout from last interaction with the UI before no longer accepting input. If None then there is no timeout.

shrewd pasture
#

@worn flint I can help you as well

cloud dawn
#

embed, error handling that will take a non experienced coder like 2 months to learn.

dusk pumice
slate swan
shrewd pasture
#

Progremer Lol

cloud dawn
shrewd pasture
#

It took me a day to learn how to make embeds and error handlers

cloud dawn
#

ctrl+c, ctrl+v isn't learning.

shrewd pasture
slate swan
cloud dawn
shrewd pasture
#

I just look up how to do it or ask my friends who I learnt from

#

You said it would take 2 months to learn embeds and error handling

slate swan
#

Really depends on effort 🤷‍♂️

cloud dawn
cloud dawn
shrewd pasture
#

True

shrewd pasture
#

Error handling and embeds are the easiest things ever

#

Some dude keeps dming me skid ripped code he finds

cloud dawn
#

A proper error handler is rare these days so apparently it isn't.

shrewd pasture
#

Really?

#

I just have an error handler for every single error

boreal ravine
slate swan
cloud dawn
tough wagon
#

OOP, subclassing and NOT copy pasting are hardest things in dpy

boreal ravine
slate swan
shrewd pasture
#

It’s really obvious too

cloud dawn
shrewd pasture
#

It’s super neat with fields in an embed and then the code makes no sense

tough wagon
cloud dawn
#

Though many inter context don't yet support subclassing so you'd need a custom subclass for that.

slate swan
#

Bro i know all the commands of dpy and other stuff but i keep forgetting how to use json

boreal ravine
cloud dawn
#
str
``` done
boreal ravine
tough wagon
cloud dawn
slate swan
slate swan
#

I know a bit of sql lite thats all

cloud dawn
tough wagon
#

just imagine use of JSON in bot with about 1 mil servers k_weirdxd

slate swan
cloud dawn
cloud dawn
#

lol i don't really use insert into

tough wagon
#

how then u insert the data

cloud dawn
#

i import the json file

#

😂

tough wagon
#

what blushed

cloud dawn
#

jkjk

tough wagon
boreal ravine
#

how does it print a string after 2 hours

tough wagon
boreal ravine
#

ah

#

you cant

#

not to my knowledge

slate swan
#

You can prob add a command error statement

#

I’ve seen it done before I just don’t know how

#

use on_command_error events and on CommandNotFound exception type , add pass statment

tough wagon
#

error handler

#

!d discord.on_error

unkempt canyonBOT
#

discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is printed to stderr and the exception is ignored. If you want to change this behaviour and handle the exception for whatever reason yourself, this event can be overridden. Which, when done, will suppress the default action of printing the traceback.

The information of the exception raised and the exception itself can be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.9)").

If you want exception to propagate out of the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") class you can define an `on_error` handler consisting of a single empty [raise statement](https://docs.python.org/3/reference/simple_stmts.html#raise "(in Python v3.9)"). Exceptions raised by `on_error` will not be handled in any way by [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
tough wagon
#

or on_command_error

steady flume
#
class Pages(discord.ui.View):
    def __init__(self, author: int, embeds: list):
        super().__init__(timeout=15)
        self.embeds = embeds
        self.author = author
        self.embed_count = 0

    def on_timeout(self):
        self.children[0].disabled = True

        self.children[1].disabled = True

how disable buttons on_timeout ? my method doesnt work

indigo forum
#

wait

#

what buttons are you talking about

boreal ravine
#

views

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
slate swan
#

Thx

#

where’s the thing for set author

#

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

I fucking love you

indigo forum
#

i ned halp pls dm me

slate swan
#

unsure if someone here helps in dms

sullen shoal
steady flume
#

but i tried this

boreal ravine
#

self is none

slate swan
steady flume
#

ik

slate swan
#

as in your code self.response= None

steady flume
#

ik

#

understtod that

#

but how i can solve that

sullen shoal
#

image isn't loading for me, slow Internet it is
oof.

steady flume
slate swan
#

never did anything with discord.py's components so no idea

steady flume
#
class Pages(discord.ui.View):
    def __init__(self, author: int, embeds: list):
        super().__init__(timeout=15)
        self.embeds = embeds
        self.author = author
        self.embed_count = 0
        self.response = None

    async def on_timeout(self):
        for child in self.children:
            child.disabled = True
        await self.response.edit(view=self)
slate swan
#

I no longer use it :0

sullen shoal
#

also is there even an attr like that because i dont remember seeing any

steady flume
#

i cant understand this buttons

sullen shoal
#

if you want to send the message, you need to pass the Context to it.

steady flume
#
out = await ctx.send(embed=page1, view=view)
        view.response = out
#

where i made cmd

#

YE BRO

#

WORKS

#

they are disabled

sullen shoal
#

good to know

steady flume
#

ye bro

sullen shoal
#

out there is the discord.Message you sent

steady flume
#

all good, now ik how disable buttons

#

Myxi

#

can i ask u last thing ?

sullen shoal
#

ask

steady flume
#

hold on a sec

#

i tried to make pagination

sullen shoal
#

okay

steady flume
#
class Pages(discord.ui.View):
    def __init__(self, author: int, embeds: list):
        super().__init__(timeout=15)
        self.embeds = embeds
        self.author = author
        self.embed_count = 0
        self.response = None

    async def on_timeout(self):
        for child in self.children:
            child.disabled = True
        await self.response.edit(view=self)

    @discord.ui.button(label='left',
                       custom_id='1',
                       style=discord.ButtonStyle.blurple, disabled=True)
    async def back_page(self, button: discord.ui.Button, interaction: discord.Interaction):
        if self.author == interaction.user.id:
            self.embed_count -= 1

            embed = self.embeds[self.embed_count]

            if self.embed_count == 0:
                self.children[0].disabled = True

                self.children[1].disabled = False

                embed.set_footer(text=f"Page {self.embed_count + 1} of {len(self.embeds)}")

                await interaction.response.edit_message(embed=embed, view=self)
        else:
            await interaction.response.send_message(f"This menu is not for you", ephemeral=True)

    @discord.ui.button(label='right',
                       custom_id='2',
                       style=discord.ButtonStyle.blurple, disabled=False)
    async def last_page(self, button: discord.ui.Button, interaction: discord.Interaction):
        if self.author == interaction.user.id:
            self.embed_count += 1

            embed = self.embeds[self.embed_count]

            self.children[0].disabled = False

            if self.embed_count == (len(self.embeds) - 1):
                self.children[1].disabled = True

                embed.set_footer(text=f"Page {self.embed_count + 1} of {len(self.embeds)}")

                await interaction.response.edit_message(embed=embed, view=self)
#

bot doesnt see all embeds

#

wait

#

which i made here

@commands.command(
        name="test"
    )
    async def test_cmd(self, ctx):
        page1 = discord.Embed(title="Bot Help 1", description="Page 1", colour=discord.Colour.orange())
        page2 = discord.Embed(title="Bot Help 2", description="Page 2", colour=discord.Colour.orange())
        page3 = discord.Embed(title="Bot Help 3", description="Page 3", colour=discord.Colour.orange())

        view = Pages(author=ctx.author.id, embeds=[page1, page2, page3])
        out = await ctx.send(embed=page1, view=view)
        view.response = out
slate swan
#

Yo someone know how to embed a link into a text

steady flume
#

bot seems to see it, but when i click on the button that switches to the next page, nothing happens at all, and if i press it again, bot already shows page 3, and does not see page 2

sullen shoal
#

i didn't like the structure of your paginator

steady flume
#

ohhh

sullen shoal
#

i've a paginator in my bot's source code. you may check it out

steady flume
#

yes, ik that i have mistake

slate swan
sullen shoal
#

this should give you an idea, how to do it

steady flume
#

disnake paginator

#

why disnake ?

sullen shoal
#

dont worry that part will work fine

#

i wont advertise it here

steady flume
#

bro

#

its empji pag

#

but i want make button pag

sullen shoal
#

those are buttons

steady flume
#

but np bro, ty

steady flume
#

I didn't notice the class view

sullen shoal
#

a tip is, always plan before coding something like it helps to code faster

flint isle
#

How can I implement the 2.0 version of discord.py so I can use the button feature

sullen shoal
#

that entire paginator took me around 80 minutes (includes reading the docs. it was my first time with application commands.,)

sullen shoal
#

you can check them out

flint isle
#

I mean how can I install it via pip

#

Sorry typed wrong word lol

sullen shoal
#

i forgot sorry

sage otter
#

Pretty sure it’s
pip install git+https://github.com/Rapptz/discord.py

maiden fable
#

Yup

slate swan
#

                elif roletype[0] == 'Admin ✨':
                    if questions[0] == "**Write your roleplay request** (1000 char max):"
                        if len(userReply.content) > 1000:
                                await ctx.author.send("Your message is over the 1000 characters maximum per part! Please split it into two.")
                                pass
                        else:
                            next_step = True
                            print(f"{member} replied")
                            return userReply.content
                    elif questions[0] == "**Write your roleplay request | Part 2** (1000 char per part):"
                        if len(userReply.content) > 250:
                                await ctx.author.send("Your message is over the 250 characters maximum per part! Please split it into two.")
                                pass
                        else:
                            next_step = True
                            print(f"{member} replied")
                            return userReply.content
                    elif questions[0] == "**Write any relevant tags, e.g Starwars Marvel Criminal**:"
                        if len(userReply.content) > 210:
                                await ctx.author.send("Your message is over the 210 characters maximum per part! Please split it into two.")
                                pass
                        else:
                            next_step = True
                            print(f"{member} replied")
                            return userReply.content

#

how can i check what question a user is currently on and then if it's question X set the character limit to 250? it currently says Extension 'cogs.Commands' raised an error: SyntaxError: invalid syntax (Commands.py, line 98) which is if questions[0] == "**Write your roleplay request** (1000 char max):"

#

            questions = [
                "**Write your roleplay request | Part 1** (1000 char per part):",
                "**Write your roleplay request | Part 2** (1000 char per part):",
                "**Write any relevant tags, e.g Starwars Marvel Criminal**:"
            ]

``` is how questions are defined
fossil phoenix
#

does anyone have experience with replit?

#

I was wondering how i could get ffmpeg onto my replit thing

#

for music ofc

boreal ravine
#

Just install it

fossil phoenix
#

just like that?

#

ohk

slate swan
#

it works now but no matter the question it defaults to the bottom one (210 characters)


                elif roletype[0] == 'Admin ✨':
                    if questions[0] == "**Write your roleplay request** (1000 char max):":
                        if len(userReply.content) > 1000:
                                await ctx.author.send("Your message is over the 1000 characters maximum per part! Please split it into two.")
                                pass
                        else:
                            next_step = True
                            print(f"{member} replied")
                            return userReply.content
                    elif questions[1] == "**Write your roleplay request | Part 2** (250 char per part):":
                        if len(userReply.content) > 250:
                                await ctx.author.send("Your message is over the 250 characters maximum per part! Please split it into two.")
                                pass
                        else:
                            next_step = True
                            print(f"{member} replied")
                            return userReply.content
                    elif questions[2] == "**Write any relevant tags, e.g Starwars Marvel Criminal**:":
                        if len(userReply.content) > 210:
                                await ctx.author.send("Your message is over the 210 characters maximum per part! Please split it into two.")
                                pass
                        else:
                            next_step = True
                            print(f"{member} replied")
                            return userReply.content
#

any thoughts?

#

Well you should probably give the entire code of that command because it's not really easy to understand what you're trying to do

#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

slate swan
#

so if they have the admin role, i want it to check which question they're currently answering

and if it's question 1, set the character limit to 1000
question 2, 250
question 3, 210

sullen shoal
#

what's the issue then

slate swan
#

it's always setting the character limit as 210 and sending this Your message is over the 210 characters maximum per part! Please split it into two.

#

no matter what question i'm on

ornate lichen
#

how do i host my vs code bot 24/7

#

i want it so that if i make changes in the code the bot also updates

sullen shoal
#

and for that, you need to keep your machine on 24/7

#

and keep running the file.

#

otherwise you can go for vps

slate swan
#

^

ornate lichen
#

web hosting services

#

?

sullen shoal
#

depends on what service you consider as web hosting

spring citrus
#
@client.event
async def on_ready():
    client.loop.create_task((status_task()))
    await client.change_presence(status=discord.Status.online)
    print('Bot is ready!')
#

how do i fix

sullen shoal
#

seems like you forgot to put () somewhere

maiden fable
#

Tf u doing

#

@spring citrus

#

Just use tasks

#

!d discord.ext.tasks.Loop

unkempt canyonBOT
#

class discord.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.

The main interface to create this is through [`loop()`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.loop "discord.ext.tasks.loop").
steady flume
#
class Pages(discord.ui.View):
    def __init__(self, author: int, embeds: list):
        super().__init__(timeout=15)
        self.embeds = embeds
        self.author = author
        self.embed_count = 0
        self.response = None

    async def on_timeout(self):
        for child in self.children:
            child.disabled = True
        await self.response.edit(view=self)

    @discord.ui.button(label='left',
                       custom_id='1',
                       style=discord.ButtonStyle.blurple, disabled=True)
    async def back_page(self, button: discord.ui.Button, interaction: discord.Interaction):
        if self.author == interaction.user.id:
            self.embed_count -= 1

            embed = self.embeds[self.embed_count]

            if self.embed_count == 0:
                self.children[0].disabled = True

                self.children[1].disabled = False

                embed.set_footer(text=f"Page {self.embed_count + 1} of {len(self.embeds)}")

                await interaction.response.edit_message(embed=embed, view=self)

    @discord.ui.button(label='right',
                       custom_id='2',
                       style=discord.ButtonStyle.blurple, disabled=False)
    async def last_page(self, button: discord.ui.Button, interaction: discord.Interaction):
        if self.author == interaction.user.id:
            self.embed_count += 1

            embed = self.embeds[self.embed_count]

            self.children[0].disabled = False

            if self.embed_count == (len(self.embeds) - 1):
                self.children[1].disabled = True

                embed.set_footer(text=f"Page {self.embed_count + 1} of {len(self.embeds)}")

                await interaction.response.edit_message(embed=embed, view=self)

guys, help, imma explain

#

bot doesnr see all embeds

#

bot seems to see it, but when i click on the button that switches to the next page, nothing happens at all, and if i press it again, bot already shows page 3, and does not see page 2

#
@commands.command(
        name="test"
    )
    async def test_cmd(self, ctx):
        page1 = discord.Embed(title="Bot Help 1", description="Page 1", colour=discord.Colour.orange())
        page2 = discord.Embed(title="Bot Help 2", description="Page 2", colour=discord.Colour.orange())
        page3 = discord.Embed(title="Bot Help 3", description="Page 3", colour=discord.Colour.orange())

        view = Pages(author=ctx.author.id, embeds=[page1, page2, page3])
        out = await ctx.send(embed=page1, view=view)
        view.response = out

here i made all embeds

maiden fable
#

😐

#

Wait, u got that from R. Danny?

steady flume
steady flume
maiden fable
#

Eh, thats not the case, but the code is sorta same haha. Anyways, u wanna make a paginator?

steady flume
#

yes

#

i wanna make paginator with buttons

sage otter
#

No, if you did have his shit you’d still come here anyway because you’d get called out by him for having his code.

maiden fable
#

Ah should I tell u how I made mine? It is the easiest ever

maiden fable
#

wait nvm

steady flume
#

nort d-componets

steady flume
#

not*

maiden fable
steady flume
#

ya, i saw code

#

but i prefer make with dpy

maiden fable
#

No, that is not what I was talking about... Nvm anyways

steady flume
#

but i cant undersatnd

maiden fable
#

!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/master/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
sage otter
# maiden fable ???

twas just a joke. just saying even if he did R. Danny’s code he still of went here instead of going to Danny since he said he wouldn’t of went here if he did have it.

spring obsidian
steady flume
#

ig it wont help

maiden fable
spring obsidian
maiden fable
sage otter
maiden fable
spring obsidian
# spring obsidian I want the only output the translated text

code it this

 @slash_command(name="quote", description="Returns a quote", guild_ids=[GUILD_ID])
  async def quote(self, ctx:commands.Context):
    quote = get_quote()
    translator = googletrans.Translator()
    translated_text=translator.translate(text=quote, dest='bn', src='auto')
    print(translated_text)
    await ctx.respond(translated_text)
#

pls need help

steady flume
#

cos im dumb

spring obsidian
#

somebody please

maiden fable
unkempt canyonBOT
maiden fable
onyx skiff
#

I have a welcoming command to the new members who join my guild but isn't work

maiden fable
#

code...

onyx skiff
maiden fable
#

it only accepts one arg which is member

onyx skiff
#

the problem is that my bot doesn't send message in the tchat

maiden fable
#

Since it doesn't know in which channel to send the message haha

mellow dew
#

Please could someone tell me how I could make a bot

maiden fable
steady flume
#

@maiden fable

    async def interaction_check(self, interaction: discord.Interaction):
        if self.author == interaction.user.id:
            return True
        else:
            await interaction.response.send_message(f"This menu is not for you", ephemeral=True)
#

good?

onyx skiff
#

I try that @maiden fable

spring obsidian
#

@maiden fable thnx it worked

maiden fable
#

also u gotta return False in the else statement

maiden fable
unkempt canyonBOT
steady flume
#

Hunter, ir didnt help mine main problem

#

it8

slate swan
#

why is there a / in it??

maiden fable
#

As I said, u should add print statements to print self.embed_count bro whenever there is a clic

maiden fable
slate swan
boreal ravine
maiden fable
#

!e

def hey(a, /):
    print(a)
hey(1)
hey(a=1)
unkempt canyonBOT
#

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

001 | 1
002 | Traceback (most recent call last):
003 |   File "<string>", line 4, in <module>
004 | TypeError: hey() got some positional-only arguments passed as keyword arguments: 'a'
lament mesa
maiden fable
#

See

#

Now u cannot do id= stuff in the method

slate swan
#

is it gonna work?? (just thinking)

async def test(ctx, *, name, *, cat)```
maiden fable
#

Nope

slate swan
#

👍 👍

maiden fable
onyx skiff
#

isn't work 😫

maiden fable
#

It is an instance method

lament mesa
maiden fable
#

you gotta do

channel = client.get_channel(...)
await channel.send(...)
slate swan
#

!epy print("Hello")

onyx skiff
#

I must do that @maiden fable ?

steady flume
#

@maiden fable i have 3 emebd for pagination, when i cliced first - nothng happened, when i click 2ndly - it showed 2

dapper cobalt
tough mirage
#
    @tasks.loop()
    async def live_status(seconds=75):
        pcount = pc()
        Dis = self.client.get_guild(876471014043815966) #Int

        activity = discord.Activity(type=discord.ActivityType.watching, name=f'🐌 {pcount}')
        await self.client.change_presence(activity=activity)
        await asyncio.sleep(15)

        activity = discord.Activity(type=discord.ActivityType.watching, name=f'👥 {Dis.member_count}')
        await self.client.change_presence(activity=activity)
        await asyncio.sleep(15)

        activity = discord.Activity(type=discord.ActivityType.watching, name=f'NOT lowkey#0669')
        await self.client.change_presence(activity=activity)
        await asyncio.sleep(15)

        activity = discord.Activity(type=discord.ActivityType.watching, name=f'City of lights')
        await self.client.change_presence(activity=activity)
        await asyncio.sleep(15)

        activity = discord.Activity(type=discord.ActivityType.watching, name=f'DISCORD ')
        await self.client.change_presence(activity=activity)
        await asyncio.sleep(15)``` how would i make this work with cogs?
lament mesa
#

it should be @tasks.loop(seconds=75)

tough mirage
#

thanks

lament mesa
#

and changing the activity every 15 seconds seems a bit too fast

devout iris
#

How can i take datas from json file?

sick birch
#

If you’re thinking about using it as a db, don’t

devout iris
#

No, i want to do the json file like that:

Guild_id =
owner =
channel_id =
#

And i want to take them

sick birch
#

Yeah that’s good

#

Use the json library

#

It’ll desearilize it into a dict

devout iris
#

Alr then i'll search how can i use it a bit more

#

i.e. command

steady flume
#

@sick birch can i ask smth ? sorry for ping

dapper cobalt
steady flume
austere tulip
#

should I still use it?

random sleet
#

does somebody have a level system?
If you have it and want to share it, my DM is open 🙂

slim whale
#

what do i need to put to make a command only bot owner can make?

fallen mica
slim whale
#

yes

lament mesa
#

You have leaked your bots token

#

You should re generate it now

slate swan
#

its not mine

#

but its a discord bot of mine

#

@lament mesa if its a discord bots token should i change it

fallen mica
# slim whale yes
@client.command()
async def main(messsage):
   if message.author.id == "Bot Owner ID":
       # Your code
   else:
       await message.channel.send("You cannot use this command!")
slim whale
#

tnxxxx

fallen mica
#

No problemo!

slate swan
slate swan
fallen mica
slate swan
fallen mica
#

What is the error which you are getting?

slate swan
#

Fix the indentation

#

!indents

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

slate swan
#

how can I do this after entering the command, the bot requested information?

slate swan
slate swan
#

wait

#

i did do indents

#

No

#

All the purple is not indented correctly

#

Should be indented under the def, so one level to the right

fallen mica
#

all your if functions are suppose to be in the on_message event

slate swan
#

oh thats the bit with all the errors in it

#

Should be aligned at this level

#

As this part of code belongs to your function

#

so all the yellow writing should be alinged

dense swallow
#

Just indent all those highlighted code once

slate swan
slate swan
slate swan
fallen mica
slate swan
#

pycharm

#

Some IDEs delete the entire code if you do that KEKL

dense swallow
#

Pressing tabs?

slate swan
#

But pycharm you can select everything and press tab

#

Bro i just got asked how to so a gui when i have 0 knowledge about it😭

#

guys, how can I do this after entering the command, the bot requested information?

slate swan
#

GUIs in python is just meh

slate swan
slate swan
slate swan
slate swan
slate swan
fallen mica
slate swan
slate swan
dense swallow
fallen mica
slate swan
fallen mica
# slate swan I see

Visual studio code has handy tools for creating UI-type projects if you are interested

fallen mica
slate swan
#

I'm making a network recon tool as console application but also implementing an optional web interface, which can be considered as a gui I guess

slate swan
slate swan
#

hey umm i press regenerate and its displays the same token

slate swan
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**...
slate swan
#

There are two examples there - One with message, one with reaction

fallen mica
fallen mica
#

xd ¯_(ツ)_/¯

slate swan
#

Ctrl+Alt+L is just the only shortcut you need to remember in JetBrain's IDEs

slate swan
slate swan
fallen mica
slate swan
#

Sometimes a few letters only change

#

It's fun because I got accepted to a job where all my knowledge is self taught and school was not even worth it KEKL

dense swallow
#

Nowadays u don't even need a degree to get a job ||(at least that's what I heard)||

slate swan
#

Security conferences were useful omegakeklmao

slate swan
#

Well everyone starts somewhere

dense swallow
#

True

slate swan
#

Some people take more time than others

fallen mica
#

all depending in what you are intressted

slate swan
dense swallow
slate swan
#

I mean, I don't have a degree yet got accepted to a cyber security job

slate swan
dense swallow
#

Yeah

#

While making stuffs, u should know the basics..

fallen mica
slate swan
slate swan
#

Going to conferences like Blackhat, DEF CON and CCC showed that I also really like to learn new things and love it, gave me a boost when applying

fallen mica
slate swan
#

Maybe ruby

slate swan
fallen mica
dense swallow
#

Twitter is made using ruby

fallen mica
#

I forgot the language name

slate swan
#

Then eventually learn more in depth the language they actually use

fallen mica
#

No, no lmao

fallen mica
#

It is some olddddd language

slate swan
#

Most of colleges learn Java

dense swallow
#

They can be useful to make games n stuff

dense swallow
slate swan
#

Eventually start with C and then move to Java

fallen mica
dense swallow
#

I'm not interested in Java, it's complicated

slate swan
#

After you learn that forbidden language they will probably give you a dead not in service api or sm idk

slate swan
#

how do I get the bot to copy the author's message?

slate swan
slate swan
dense swallow
slate swan
#

ctx.message.content

#

thank you

slate swan
dense swallow
#

Yeah backend stuff

slate swan
#

Bro how do i even decide what job i want i have 0 clue of what i want to be but ofc it will be something related to pythonshipit

#

Just like Discord, they use Rust but, I think, only for voice-related stuff

dense swallow
#

Rust?? I thought they used electron js

slate swan
#

Sometimes idk

slate swan
dense swallow
#

Hmm

slate swan
slate swan
#

Discord uses JavaScript (no shit), Elixir, Python, Rust and C++

fallen mica
slate swan
fallen mica
#

for example GUI.

slate swan
#

Although I can't really say it's an official company, but yeah

dapper cobalt
fallen mica
slate swan
slate swan
fallen mica
slate swan
#

So I guess they use C++

fallen mica
#

They also use python, but I'm not sure really what they use it for.

dense swallow
#

Probably backend

slate swan
#

No idea aoabout that

dense swallow
#

Isn't yt written in Django?

slate swan
#

Probably APIs

floral jacinth
#

hello, there's a code to simulate what TAB does? like \u200b for a single space

slate swan
floral jacinth
dense swallow
#

Just hit spacebar lol

slate swan
fallen mica
floral jacinth
slate swan
#

What if google makes a internacional language that uses all languages and can connect to all of themlemon_hyperpleased

dense swallow
slate swan
fallen mica
dense swallow
#

Eh.. dk, they have their own version of everything .. they have their own DB called big table

dense swallow
slate swan
#

Yeah still

dense swallow
#

Can py and js do everything?

slate swan
#

Nah

#

No language can really do everything

fallen mica
dense swallow
#

We'll replace the bad stuff of one lang with other lol 😂

fallen mica
#

they do bad in aspects which they wasn't originally planned on doing

slate swan
#

Its like voice languages in Spanish you have a word to say have a great meal but you dont have one in english and bon appetite is a french word

slate swan
slate swan
dense swallow
#

I was thinking of web related stuff

dense swallow
#

They both can't do games.. pygame, but 2d :/

slate swan
#

Well without frameworks they can't

dense swallow
#

True

slate swan
#

Python cannot do a web server without a framework

undone wyvern
#

!ot This is getting extremely off topic. I'm no mod, but I would recommend going here

unkempt canyonBOT
slate swan
#

Same for JavaScript

#

What are most games written in js and c++?

#

C++

#

I see

#

Or Java/C#

#

Alr

#

But C++ remains the standard I guess

#

Guess ill learn py and c++🤷‍♂️

#

Good luck 2DRenownThumbsUp (I gave up C++ pretty quickly)

dense swallow
#

Krypton, do u know Postgres?

#

or anyone

slate swan
#

Nope

dense swallow
#

What DB do u use?

slate swan
#

MySQL/MariaDB

dense swallow
#

And hosting is paid?

slate swan
#

And used MongoDB once

dense swallow
#

I tried mongo, but I don't like the syntax

slate swan
dense swallow
#

Ooh

slate swan
#

@slate swan do you know?

#

You have typed a . instead of a _

#

oh ty

#
if user_message
slate swan
#

Change what message?

#

by id message

slate swan
slate swan
slate swan
#

?

slate swan
slate swan
slate swan
#

Unless ur doing a selfbot

#

You can't edit user messages

slate swan
#

Only the ones sent by the bot

#

Ah yeah wrong token as the error says

slate swan
#

np

sick birch
steady flume
#

thank you

sick birch
#

👍

steady flume
#
class Pages(discord.ui.View):
    def __init__(self, author: int, embeds: list):
        super().__init__(timeout=15)
        self.embeds = embeds
        self.author = author
        self.embed_count = 0
        self.response = None

    async def on_timeout(self):
        for child in self.children:
            child.disabled = True
        await self.response.edit(view=self)

    async def interaction_check(self, interaction: discord.Interaction):
        if self.author == interaction.user.id:
            return True
        else:
            await interaction.response.send_message(f"This menu is not for you", ephemeral=True)

    @discord.ui.button(label='left',
                       custom_id='1',
                       style=discord.ButtonStyle.blurple, disabled=True)
    async def back_page(self, button: discord.ui.Button, interaction: discord.Interaction):
        if self.embed_count > 0:
            self.embed_count -= 1
            self.children[1].disabled = False
            if self.embed_count == 0:
                button.disabled = True
            await interaction.response.edit_message(embed=self.embeds[self.embed_count], view=self)

            print(self.embed_count)

    @discord.ui.button(label='right',
                       custom_id='2',
                       style=discord.ButtonStyle.blurple, disabled=False)
    async def last_page(self, button: discord.ui.Button, interaction: discord.Interaction):
        print(len(self.embeds))
        if self.embed_count < len(self.embeds) - 1:
            self.embed_count += 1
            self.children[0].disabled = False
            if self.embed_count == len(self.embeds) - 1:
                button.disabled = True
            await interaction.response.edit_message(embed=self.embeds[self.embed_count], view=self)
#

free discord pagination!!!!

#

no mistakes!!

sick birch
#

glad to hear 🙂

steady flume
#

all woeks!!!

#

copy my pagination for free

#

its 2.0

#

not d-components

slate swan
#

error:

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

@bot.command()
async def target(ctx):
    channel = ctx.channel
    message_1 = await ctx.channel.send("`text`")
    target_message = 835236006713098304
    msg = await bot.wait_for('message', check=check)
    await message.edit()
    await ctx.channel.send()
#

You never defined a check

#

Look at the example on the website again

#

You will somewhere see something like def check()

slate swan
steady flume
#

)))

slate swan
#

Wont cuz its better to learn tbh

steady flume
#

@slate swan sorry for ping

#

will u copy?

slate swan
slate swan
steady flume
#

if yes, i need say one more thing

#

about cmd, where u nedd this:

#
view = Pages(author=ctx.author.id, embeds=[page1, page2, page3, page4, page5])
        out = await ctx.send(embed=page1, view=view)
        view.response = out
slate swan
#

I wont cuz i like learning

steady flume
#

okey)

slate swan
steady flume
#

but now guys

#

new question, how to make select menus ?

kindred epoch
#

Why don't you ask it in the library's help server?

steady flume
#

🙂

slate swan
#

I dont think being nice will help either

#

😐

slate swan
#

i can feel my brain cells dying

slate swan
#

i dont understand it

#

well if ur confused with everything then I can’t help

#

ok

#

@bot.command()
async def foo(ctx, arg):
await ctx.send(arg)

#

like what is arg or foo or ctx

#

thats the main bit

#

foo is the name of your command

#

oh

#

arg would be world in this example

!command world
#

what

slate swan
#

so can i change foo to something else

slate swan
#

and ctx you always need it to get the channel, author, guild etc. from where the command has been executed

#

oh

#

so do i change foo?

#

Yup

#

To the name of your command you want, whatever you want

#

so like if i wanted to do !help

#

i would change foo to help

#

Yes, but that's not how help commands should be done

#

Help commands are special and complicated

#

I would keep the default help command for now

#

theres a default help command?

#

Yup

#

@slate swan do you know python?

#

Make sure you don't have client = discord.Client() but bot = discord.ext.commands.Bot()

slate swan
#

Bot supports commands, Client doesn't

slate swan
sick birch
#

that's more of a requirement

slate swan
sick birch
#

discord.py library is quite complex and as such is not fit for a beginner

#

it is strongly recommended that you have a fairly strong grasp of basic and moderate concepts in Python before progressing on to the discord.py library

slate swan
#

my friend said python is hard and i said i bet i could make a discord bot

#

to prove him wrong

sick birch
#

Python isn't hard, but it can be hard

#

Heavily dependant on use-case

slate swan
#

If you've never learned Python and just jumped into making a bot I'd recommend to learn Python in the first place

#

!resources

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.

sick birch
#

The one thing I see most beginners struggling with the most is the concept of asynchronous programming

slate swan
#

I don't like Python asynchronous programming bravemmlol

#

Know how it works, its usage, etc. but I just don't like how it's made in Python

sick birch
#

Yeah, Javascript does asynchronous better imo

slate swan
#

Never really got into it

#

But it seems better than Python

sick birch
#

It makes more sense, isn't really better than Python, though

#

It's easier to understand as well, and it's considered an advanced concept like it is in Python

#

But they both do the same thing just as well on both languages, just in different methods

slate swan
#

Yeah

#

Never really tried asynchronous programming in JavaScript

#

And Python I don't like how it's implemented

#

So never really used it myself

slate swan
cloud dawn
#

Both languages have it's advantages.

slate swan
velvet tinsel
#
async def open_account(user):
    with open("mainbank.json", "r") as f:
        users = await get_bank_data()


    if str(user.id) in users:
        return False
    else:
        users[str(user.id)] = {}
        wallet_amt = users[str(user.id)]["wallet"] = 0
        bank_amt = users[str(user.id)]["bank"] = 0

    with open("mainbank.json", "w") as f:
        json.dump(users, f)
    return True

@client.command()
async def balance(ctx):
    await open_account(ctx.author)

    user = ctx.author

    users = await get_bank_data()

    wallet_amt = users[str(user.id)]["wallet"]
    bank_amt = users[str(user.id)]["bank"]

    emb = discord.Embed(title=f"{ctx.author.name}'s balance", color=discord.Color.green())
    emb.add_field(name="Wallet balance", value=str(wallet_amt))
    emb.add_field(name="Bank balance", value=str(bank_amt))

    await ctx.send(embed=emb)

@client.command()
async def beg(ctx):
    users = await get_bank_data()
    user = ctx.author
    wallet_amt = users[str(user.id)]["wallet"]
    bank_amt = users[str(user.id)]["bank"]
    await open_account(ctx.author)

    earnings = random.randint(300, 550)
    person = ["Steve", "Karen", "Your Mom", "Micheal", "Daniel Craig", "Donald Trump", "Joe Biden"]
    choice = random.randint(1, 2)
    if choice == 1:
        earning_embed = discord.Embed(title="Success!", description=f"\"Oh, you poor little beggar, here's {earnings} dogecoin!\" \n-{random.choice(person)}")
        earning_embed.add_field(name="Earnings", value=str(wallet_amt))
        users[str(user.id)]["wallet"] += earnings
        await ctx.send(embed=earning_embed)
    else:
        responses = ["Imagine begging", "BRO GET A JOB", "Sorry I don't have money", "Nahhhhhh", "Get good"]
        no_embed = discord.Embed(title="Failure", 

first part of code

#
description=f"{random.choice(responses)}. \n-{random.choice(person)}")
        no_embed.add_field(name="Earnings", value=str(wallet_amt))
        await ctx.send(embed=no_embed)


        with open("mainbank.json", "r") as f:
            users = json.load(f)


async def get_bank_data():
    with open("mainbank.json", "r") as f:
        users = json.load(f)

    return users
#

Whenever I do d!beg, nothing happens.

#

What's wrong with the code?

velvet tinsel
#

someone help

cloud dawn
#

9th time

velvet tinsel
#

what

#

what is wrong with code

#

nvm

#

!solved

#

!solve

#

!solved

#

wait wrong channel

steady flume
#
 async def on_timeout(self):
        for child in self.children:
            child.disabled = True
            child.style = discord.ButtonStyle.grey
        await self.response.edit(view=self)

how to change emoji of each button in this event ?

slim whale
#
@bot.command()
async def features(ctx):
  guild = ctx.guild
  featureslist = guild.features
  msgfeatures  = ""
  if featureslist[0]=='partnered':
    partnered = "![partner](https://cdn.discordapp.com/emojis/905485388553015296.webp?size=128 "partner")"
  await ctx.send(partnered)```
#

How can i make to check if verified and partnered is in the list?

blissful bone
#

hey how do u load a cog

hollow shale
#
        channel = client.get_channel(channel)
        users = await get_bank_data()
        msg = await channel.fetch_message(id)
        msg2 = await channel.fetch_message(id2)
        embed = discord.Embed(title="Title",
                              description=f"{text}",
                              color=color)
        embed2 = discord.Embed(description=f"{text2}\nLast updated: <t:{Unix}:R> (<t:{Unix}>)",
                               color=color)
        print("1")
        await msg.edit(content=None, embed=embed)
        await msg2.edit(content=None, embed=embed2)```
anyone knows how to edit 2 embeds into one message?
slate swan
#

If you're using discord.py 2.0 you can give a list of embed objects in the embeds kwarg when editing/sending a message

hollow shale
#

im using 1.7.3

slate swan
hollow shale
#

ok ty

dense swallow
sudden aspen
#

Hey everyone, does someone know how to find my guild id I'm trying to execute this code but it appears like I need a "guild id"

import discord
from discord.ext import commands, tasks


bot = commands.Bot(command_prefix='<')

@bot.event
async def on_ready():
    print('I am ready!')


@tasks.loop(seconds=60)
async def is_still_sub(ctx):
    guild = bot.get_guild(your_guild_id)
    treasure = guild.get_role(905285009873731605)
    twitch_sub = guild.get_role(905284976109580319)
    print(treasure.members)
    for member in twitch_sub.members:
        if treasure in member.roles:
            pass
        else:
            await member.remove_roles(treasure)


bot.run('My token is here')```
slate swan
blissful bone
slate swan
sudden aspen
slate swan
#

Aka the guild you copied the roles from

sudden aspen
# slate swan The guild you want the task on

Ok I'm so sorry for all the questions I'm not very advanced in python, how do I find a guild? This bot is programed to check if all members who has the treasure role also has the twitch sub role, if someone who has the treasure role doesn't have the twitch sub role I want the bot to remove the treasure role from that specific user. So I'm not sure which guild I should copy

slate swan
#

The discord server your cheking the roles from

sudden aspen
slate swan
sudden aspen
slate swan
slate swan
#

So use

if "THE_FEATURE" in guild.features:
slim whale
#

TNX

#

but it can be more than one?

slate swan
slate swan
slate swan
slim whale
#

or both

#

but in the mid of the list it can have community or things like that so idk

slate swan
#

But it would be

if "feature_1" in guild.features or "feature_2" in guild.features
#

maybe need parentheses

slim whale
#

but if the server have both it will send the emojis correctly?

slate swan
#

No it will only send for one

#

You should check each feature separately

slim whale
slate swan
#

Nope

#

Make 2 if

#

Because if it has the first feature you check, then the second elif will be ignored

slim whale
#
@bot.command()
async def features(ctx):
  guild = ctx.guild
  featureslist = guild.features
  msgfeatures  = ""
  if "partnered" in featureslist:
    partnered = "![partner](https://cdn.discordapp.com/emojis/905485388553015296.webp?size=128 "partner")"
  if "verified" in featureslist:
    verified = "![Verified](https://cdn.discordapp.com/emojis/903385959914143784.webp?size=128 "Verified")"
  await ctx.send(partnered, verified)```
slate swan
#

Theres a difference between 2 elifs and 2 ifs

slim whale
#

like this?

slate swan
#

yes and no

slim whale
slate swan
#

Create a string before your ifs

#

And append the emote to that string with +=

#

Then send that single string only

#

Like you did with msgfeatures

#

Use that string and append the emotes to it

#

Then send that variable only

slim whale
slim whale
#

but what is append and how to apply it

slate swan
#

!e
x = "hello"
x += " world"
print(x)

unkempt canyonBOT
#

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

hello world
slate swan
#

This is appending

slim whale
#

aaaaaaaaaa

#

okayyy

slate swan
slate swan
slim whale
#
@bot.command()
async def features(ctx):
  guild = ctx.guild
  featureslist = guild.features
  msgfeatures  = ""
  if "partnered" in featureslist:
    msgfeatures = "![partner](https://cdn.discordapp.com/emojis/905485388553015296.webp?size=128 "partner")"
  if "verified" in featureslist:
    msgfeatures += "![Verified](https://cdn.discordapp.com/emojis/903385959914143784.webp?size=128 "Verified")"
  await ctx.send(msgfeatures)```
slate swan
#

yus

#

Then send msgfeatures

#

Instead of partnered, verified

slate swan
slim whale
#

okkk

slate swan
#

It's just that I used too much Java these days

#

And there's a stringbuilder there

slate swan
#

No because that's not the correct feature name

#

See the list here

#

!d discord.Guild.features

unkempt canyonBOT
#

A list of features that the guild has. The features that a guild can have are subject to arbitrary change by Discord.

They are currently as follows:

slate swan
#

Should be exactly what's shown

slim whale
#

okkk

#

but if theres something between partnered and verified it should work? like [community, partnered, news, verified]

slate swan
#

But yeah, after changing that it should work

slim whale
#

okkk

slim whale
#

tnxxx

slate swan
#

and

if x in list

checks if x is in the list

slim whale
#

u are god dev

#

love u <3<3<3<3<3

slate swan
slim whale
#

XD

slate swan
#

Hes my cutie chill out

slim whale
#

u have badge lol

#

didnt saw that

slate swan
#

Hes a og dev

slim whale
slate swan
slim whale
#

xd

slate swan
#

Lmao

#

Can anyone make a command that gives a role to all server members please?

slate swan
#

🤷‍♂️

#

I don't know how to do

#

Is it possible to make one?

#

Yes

#

how?

slate swan
#

Really isnt hard to use the search feature in the docsyert

acoustic ermine
#
[JUMP TO ROB]({jump_link}\"shows you where you was robbed!\")```
output 

[JUMP TO ROB](#840612280836423720 message%22shows you where you was robbed!")```

#

it doesnt hyperlink ...

slate swan
#

Don't put text inside the ()

#

Just the link

acoustic ermine
#

...

acoustic ermine
#

it is

kindred epoch
#

descripton or field value?

acoustic ermine
#

description

kindred epoch
#

show ur whole code