#discord-bots

1 messages · Page 719 of 1

shadow wraith
#

oh the second one

sage otter
#

Send the message before the loop.

#

So it doesn’t continuously send messages.

#

Just send the one and edit it in the while.

winged swan
#

Pls bal

#

No dank? :(

rancid light
#

How can i get the invite link which the bot is in

daring valley
#
@bot.command()
@commands.cooldown(1,2,commands.BucketType.channel)
@commands.has_guild_permissions(manage_messages=True)
async def purge(ctx, num):
    amount = int(num)
    if not amount:
        return
    await asyncio.wait(1)
    ctx.channel.purge(amount=amount)

why it doesn't purge?

slate swan
#

You need to await it, like your error in the cmd says

slate swan
modern fiber
#

Guys, how can I connect a Discord Bot with Roblox API, in the way that Bot connects when the product from the game has been purchased and adds the value of that product to the user's variable.

So basically, user buys for example product worth 10 robuxs, and then the bot adds 10 to his variable.
If possible, with -30%.

Can anybody help me, please?

daring valley
rancid light
slate swan
#

This is considered as backdooring, and is against Discord's Developer Policy

modern fiber
slate swan
#

Giving you access to something you shouldn't.

#

Such as every server your bot joins.

rancid light
#

oh

#

it's my server tho

#

can i just get it with the guild id

daring valley
slate swan
unkempt canyonBOT
#

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

Returns a list of all active instant invites from the guild.

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

Then you'd need to take a random invite from the list.

#

Then to get the guild with the ID you can use get_guild or fetch_guild

slate swan
#

!d asyncio.wait

unkempt canyonBOT
#

coroutine asyncio.wait(aws, *, timeout=None, return_when=ALL_COMPLETED)```
Run [awaitable objects](https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables) in the *aws* iterable concurrently and block until the condition specified by *return\_when*.

The *aws* iterable must not be empty.

Returns two sets of Tasks/Futures: `(done, pending)`.

Usage:

```py
done, pending = await asyncio.wait(aws)
```  *timeout* (a float or int), if specified, can be used to control the maximum number of seconds to wait before returning...
rancid light
daring valley
#

ohhh it was sleep yeah

slate swan
#

No, nothing

#

As the description says

Returns a list of all active instant invites from the guild.

rancid light
#

hm

#

okay

slate swan
#

Since it's a coroutine you will need to await it

modern fiber
#

Guys, how can I connect a Discord Bot with Roblox API, in the way that Bot connects when the product from the game has been purchased and adds the value of that product to the user's variable.

So basically, user buys for example product worth 10 robuxs, and then the bot adds 10 to his variable.
If possible, with -30%.

Can anybody help me, please?

slate swan
#

Then you get a list of discord.Invite objects

daring valley
#
@bot.command()
@commands.cooldown(1,2,commands.BucketType.channel)
@commands.has_guild_permissions(manage_messages=True)
async def purge(ctx, num):
    amount = int(num)
    if not amount:
        print(amount)
        return
    await asyncio.sleep(0.01)
    print("B")
    await ctx.channel.purge(amount=amount)
    print("C")

it's still stuck purging 🥺

slate swan
#

And you can use multiple attributes or methods on a random element.

slate swan
#

what are you trying to do though?

daring valley
#

purge

slate swan
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.

You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Examples

Deleting bot’s messages...
slate swan
#

It's limit

daring valley
#

ok

#
await ctx.channel.purge(limit=amount)

perfect

shadow wraith
#

hey so i have this code for a rhyme command here:

@bot.command()
@commands.guild_only()
@commands.cooldown(1, 3, BucketType.default)
async def rhyme(ctx, *, word):
    try:

        def check(r: disnake.Reaction, u: Union[disnake.Member, disnake.User]):
            return (
                u.id == ctx.author.id
                and r.message.channel.id == ctx.channel.id
                and str(r.emoji) in ["🔄"]
            )

        async with aiohttp.ClientSession() as session:
            newword = quote_plus(word)
            url = await session.get(f"https://api.datamuse.com/words?rel_rhy={newword}")
            urlJSON = await url.json()

            rdn = random.choice(urlJSON).get("word")
            success = await ctx.reply(f"Word: {word}\nWhat rhymes: {rdn}")
            await success.add_reaction("🔄")
            event = await bot.wait_for(
                event="reaction_add",
                check=check,
                timeout=30.0,
            )
    except IndexError as ie:
        await ctx.reply(f"There are no words rhyming with {word} :(")
    except asyncio.TimeoutError:
        pass
    else:
        newWord = random.choice(urlJSON).get("word")
        if str(event[0].emoji) == "🔄" and not event[1].bot:
            await success.edit(content=f"Word: {word}\nWhat rhymes: {newWord}")
        else:
            pass

and the bot.wait_for only listens to 1 reaction, is there a way to make it listen to all reactions until the timeout is triggered

slate swan
#

No there is no way using wait_for

#

It only waits for the first event

#

Only way would be to use the event made for it

shadow wraith
#

"using wait_for"

slate swan
#

!d discord.on_raw_reaction_add

unkempt canyonBOT
#

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

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

well ofc you can't use wait_for to loop it but is there any other way to listen all the reactions until timeout

#

wait i misunderstood your statement

#

but can't you just use while or something?

slate swan
#

What is the input of member you give when executing the command?

loud junco
#

local variable 'emoji' defined in enclosing scope on line 60 referenced before assignment

#
@bot.command(name='mine')
@commands.cooldown(1, 60, commands.BucketType.user)
async def mine(ctx):
  await emoji(ctx)
  num1 = random.randint(0, 100)
  num2 = random.randint(0, 100)
  lootcount = 101
  loottype = None
slate swan
#

What is your method emoji

#

And where have you defined it

loud junco
#

.paste

#

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

loud junco
#

here

slate swan
#

And what is its purpose?

loud junco
#

global var

slate swan
#

Just make a file for your emotes

loud junco
loud junco
#

it works with other global var

#

but not this one

slate swan
#

File emotes.py:
epogchop = ':pogchop:'
ecoal = ':coal:'
ebeef = ':beef:'

File stuff.py
import emotes

print(ebeef)

loud junco
#

it works?

slate swan
#

Why would you need to make such a messy and pretty much useless function?

loud junco
#

but i will need to write await emotes() also

#

cuz they are in a funtion

slate swan
#

No

loud junco
#

the stupid scoping error will come out again

slate swan
#

Make a file, just for variables

#

Import that file

loud junco
#

i tried that

slate swan
#

Then you can use emotes.variable

loud junco
#

trust me it wont work

slate swan
#

And it works fine

#

I legit do it for my own bot, don't tell me it doesn't work xD

loud junco
#

...

slate swan
#

Don't make a function

loud junco
#

my variable

slate swan
#

Don't make the emoji function

#

Just make the variables, without global

loud junco
#

bed = db[userid + 'bed']

#

it will tell userid undefined

#

:/

#

just tell me how to fix that pls ;-;

#

dun complicate the stuff

manic wing
#

@slate swan

drifting arrow
#

How do I make multiple clickable links in an embed response?

slate swan
#

As your code says

#

You should give an argument such as Something#1234

#

I would try to understand the code before just copying it

modern fiber
#

Guys, how can I connect a discord bot with a roblox game, so whenever buys a product in a game it pops a message in the discord server with his user & amout he purchased?

#

or if its possible, that it adds that amout on that user's balance

#

Please somebody help

drifting arrow
#

I want to create something like this, but idk what to look up in the documentation.

modern fiber
#

how do I make it so discord bot notifies whenever someone buys a product in roblox game and if possibly, it adds that amout on user's balance

heavy folio
#
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 994, in invoke  
    await ctx.command.invoke(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 886, in invoke 
    await self.prepare(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 820, in prepare
    await self._parse_arguments(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 726, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 578, in transform
    return await run_converters(ctx, converter, argument, param)  # type: ignore
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\converter.py", line 1182, in run_converters
    return await _actual_conversion(ctx, converter, argument, param)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\converter.py", line 1076, in _actual_conversion
    return await converter().convert(ctx, argument)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\converter.py", line 395, in convert
    raise ChannelNotFound(channel_id)
discord.ext.commands.errors.ChannelNotFound: Channel "None" not found.
``````py
    @commands.command()
    async def mock(self, ctx, message: discord.Message):
        embed = discord.Embed(color=ctx.author.color, timestamp=datetime.datetime.now())
        embed.set_author(
            name=str(message.author),
            icon_url=message.author.display_avatar.url
        )

        await ctx.send(embed=embed)
        await ctx.message.delete()
#

not sure why it keeps raising ChannelNotFound

pseudo nimbus
#

How do i give a role to multiple user ?

#

ah nvm

#

i found the solution

drifting arrow
#

How do I make python ignore this and treat it as a string?

#

It's blue like it's a variable

slate swan
visual island
#

use raw string

#

r"string"

fickle axle
#

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

loud junco
#

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

loud junco
#

line 693 error

#

local variable 'emoji' defined in enclosing scope on line 60 referenced before assignment

#

i dont understand why is it an error

#

:/

meager crown
#

or you referenced it before assignment ofc

#

you didnt reference it before assignment so probably it doesnt have a value

shadow wraith
#

how do i make it so the bot listens to every reaction and not just one, this is my code:

@bot.command()
@commands.guild_only()
@commands.cooldown(1, 3, BucketType.default)
async def rhyme(ctx, *, word):
    try:

        def check(r: disnake.Reaction, u: Union[disnake.Member, disnake.User]):
            return (
                u.id == ctx.author.id
                and r.message.channel.id == ctx.channel.id
                and str(r.emoji) in ["🔄"]
            )

        async with aiohttp.ClientSession() as session:
            newword = quote_plus(word)
            url = await session.get(f"https://api.datamuse.com/words?rel_rhy={newword}")
            urlJSON = await url.json()

            rdn = random.choice(urlJSON).get("word")
            success = await ctx.reply(f"Word: {word}\nWhat rhymes: {rdn}")
            await success.add_reaction("🔄")
            event = await bot.wait_for(
                event="reaction_add",
                check=check,
                timeout=30.0,
            )
    except IndexError as ie:
        await ctx.reply(f"There are no words rhyming with {word} :(")
    except asyncio.TimeoutError:
        pass
    else:
        newWord = random.choice(urlJSON).get("word")
        if str(event[0].emoji) == "🔄" and not event[1].bot:
            await success.edit(content=f"Word: {word}\nWhat rhymes: {newWord}")
        else:
            pass
loud junco
#

i need to return all of them?

meager crown
loud junco
meager crown
#

i read it wrong, i thought it was like a variable i didnt read the paste (sorry lol)

unkempt canyonBOT
#

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

Instead of writing

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

do this instead

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

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

boreal ravine
meager crown
#

wierd, this code should work

#

idk whats wrong with it

velvet tinsel
#

Shoot

loud junco
velvet tinsel
#

Use a wait_for

loud junco
#

my code is dumb

shadow wraith
loud junco
#

same piece of code work for the other command but doesnt work for the other one

velvet tinsel
#

maybe check if event is True?

shadow wraith
#

in what condition would the event be true

manic wing
#

who needs helping hm?

shadow wraith
manic wing
#

whats the problem

shadow wraith
#

no problem, just trying to figure out how to make the bot listen to all reactions, not just one.

loud junco
loud junco
manic wing
shadow wraith
#

alr

velvet tinsel
shadow wraith
velvet tinsel
manic wing
#

im kinda on mobile so don’t trust anything i say 😳

shadow wraith
#

im asking in what state is the event true, like for example it turns true when the event is successfully triggered

velvet tinsel
shadow wraith
#

ratioed question

#

x]

velvet tinsel
boreal ravine
loud junco
#

this is ratio

velvet tinsel
loud junco
velvet tinsel
#

I just don’t understand why people say “ratio”

loud junco
velvet tinsel
#

:kek:

loud junco
#

;-;

#

python doing weird thingi

manic wing
shadow wraith
manic wing
#

global in discord bot = shoot me in the fucking head

velvet tinsel
shadow wraith
loud junco
velvet tinsel
manic wing
loud junco
#

:/

shadow wraith
#

:| im glad i don't use global

velvet tinsel
manic wing
#

man you’ll probably go back in time and kill your previous self when you realise what you’ve been doing

velvet tinsel
#

I already did

shadow wraith
velvet tinsel
#

bitch idk I’m on mobile

shadow wraith
#

that was slightly rude x[

velvet tinsel
#

hurrrr

loud junco
velvet tinsel
loud junco
#

so what do i add inside

shadow wraith
#

forgive ya

velvet tinsel
manic wing
velvet tinsel
shadow wraith
#

i created a file called hangman.py and put global in it (no i just copied hangman somewhere x])

velvet tinsel
#

That would keep listening

loud junco
manic wing
#

i made a hangman command

#

if you wanna take a look at exceptional code

velvet tinsel
shadow wraith
manic wing
#

i even made pseudocode for it

shadow wraith
velvet tinsel
shadow wraith
#

caedan is fucking good at roasts: "airborne cancer" 💀💀

loud junco
#

... fine

velvet tinsel
#

Caeden used to be pretty toxic 💀

manic wing
#

if you spell my name wrong again you’ll be at the other end of the toxicity

velvet tinsel
#

But now he’s pretty cool 💀

manic wing
velvet tinsel
manic wing
#

i help so that it minimised my toxicity levels

#

the good cancels out the bad

manic wing
velvet tinsel
manic wing
#

until i get muted for calling someone braindead

velvet tinsel
#

a bit like kraots and me when people don’t understand what’s happening because they copied and pasted code

rich brook
#

wait... mini.. are you the mini i think you are?

loud junco
#

so are u done with ur toxic shit and are u going to help me

velvet tinsel
shadow wraith
#

ok but caeden what about my thing i wanna change, timeout=None still listened once 💀

velvet tinsel
#

Oh…while True?

velvet tinsel
manic wing
loud junco
#

forget it

velvet tinsel
#

💀

shadow wraith
#

well, the thing i was stuck in was the positioning of the loop

manic wing
#

you can use a walrus for it to be nice and neat

velvet tinsel
velvet tinsel
heavy folio
#

im trynna make a imagine trigger using on_message but not sure how to cut out the first word ("imagine")

shadow wraith
heavy folio
velvet tinsel
velvet tinsel
manic wing
#

so like this - while (message:=await bot.wait_for("message", check=…, timeout=…): that’s all you have to do if you want it to loop endlessly with a walrus. However, if your python is lower than 3.8 this won’t work because walrus is implemented in 3.8. Instead you can do; py message = await bot.wait_for(…) while True: … message = await bot.wait_for(…)

heavy folio
#

hm

manic wing
#

that’s how to loop it, either work

shadow wraith
#

😃 🔫 my code even looks like airborne cancer

manic wing
#

represents the code you want to do inside

velvet tinsel
manic wing
#

i feel like naming conventions are lost on you @shadow wraith

slate swan
shadow wraith
#

wdym by naming conventions

slate swan
#

pls help

rich brook
manic wing
#

shit names

visual island
slate swan
#

okay

shadow wraith
loud junco
manic wing
rich brook
#

!d discord.abc.GuildChannel

unkempt canyonBOT
#

class discord.abc.GuildChannel```
An ABC that details the common operations on a Discord guild channel.

The following implement this ABC...
rich brook
#

!d discord.TextChannel

unkempt canyonBOT
#

class discord.TextChannel```
Represents a Discord guild text channel.

x == y Checks if two channels are equal.

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

hash(x) Returns the channel’s hash.

str(x) Returns the channel’s name.
shadow wraith
#
event = await bot.wait_for(
                event="reaction_add",
                check=check,
                timeout=None,
            )
            while True:
                event = await bot.wait_for(
                    event="reaction_add",
                    check=check,
                    timeout=None,
                )

this good?

manic wing
#

!pep 484 i think this is the one lemme check

unkempt canyonBOT
#
**PEP 484 - Type Hints**
Status

Provisional

Python-Version

3.5

Created

29-Sep-2014

Type

Standards Track

manic wing
#

fuck not that one

shadow wraith
#

type hinting ???? 💀

manic wing
#

oh it’s pep-8

#

for naming conventions

shadow wraith
#

what if i just name it sql statements like WHERE 💀

#

oh yeah @manic wing i did the while true thing you told me to do, now it doesn't listen to any reactions at all :[

manic wing
#

according to my calculations it seems like you’ve done something wrong :O

#

show me the code

#

oh i see

#

dude

#

print(event) inside the while true loop

#

before the second wait_for

#

the second wait_for needs to be the very last line in the while true

shadow wraith
#

sure but that'd just endlessly print event

manic wing
#

no

#

use your nogin

#

think about the logic

shadow wraith
#

fuck i tried it now it just prints the info about the event, no edits :[

shadow wraith
#

istg if this problem doesn't get fixed today im gonna drink water

manic wing
cold sonnet
#

what

#

how

manic wing
# cold sonnet how

if you put a wait_for at the end of a while loop then it waits till the event and when it hits it it reenters the loop

shadow wraith
#

do i have to add more shit or

shadow wraith
#

because the event literally never gets triggered now

cold sonnet
#

I mean
if you use the while correctly it's not a problem

shadow wraith
# cold sonnet so why not a task

this code is not task-loopable:

@bot.command()
@commands.guild_only()
@commands.cooldown(1, 3, BucketType.default)
async def rhyme(ctx, *, word):
    try:

        def check(r: disnake.Reaction, u: Union[disnake.Member, disnake.User]):
            return u.id == ctx.author.id and r.message.channel.id == ctx.channel.id

        async with aiohttp.ClientSession() as session:
            newword = quote_plus(word)
            Api = await session.get(f"https://api.datamuse.com/words?rel_rhy={newword}")
            API = await Api.json()

            randomWord = random.choice(API).get("word")
            __what_rhymes__ = await ctx.reply(
                f"Word: {word}\nWhat rhymes: {randomWord}"
            )
            await __what_rhymes__.add_reaction("🔄")
            event = await bot.wait_for(
                event="reaction_add",
                check=check,
                timeout=30.0,
            )
            while True:
                print(event)
                event = await bot.wait_for(
                    event="reaction_add",
                    check=check,
                    timeout=30.0,
                )
    except IndexError as ie:
        await ctx.reply(f"There are no words rhyming with {word} :(")
    except asyncio.TimeoutError:
        pass
    else:
        newWord = random.choice(API).get("word")
        if str(event[0].emoji) == "🔄" and not event[1].bot:
            await __what_rhymes__.edit(content=f"Word: {word}\nWhat rhymes: {newWord}")
        else:
            pass

or if it was, it'd be too complicated for me to even understand it

cold sonnet
#

seems like it

#

that will not store anything

#

nor do anything

loud junco
#

:/

cold sonnet
#

what'd the expected outcome?

shadow wraith
#

ping me when you come up with a solution, ima go

cold sonnet
#

oh geez

#

it seems to do something now

loud junco
#
#main.py
from emote import emote
@bot.command(name='craft')
@commands.cooldown(1, 1, commands.BucketType.user)
async def craft(ctx, arg: str):
  await item(ctx)
  emote()
    embed = discord.Embed(
      description= f'''
`pog_helmet` ↦ 50 {epogchop} + 50 {ecoal}
  ''',
      color = discord.Color.blue())
    embed.set_author(name= 'Recipes(Page 1)',
    icon_url = ctx.author.avatar_url)
    embed.set_footer(text = 'imagine forgetting recipes')
    await ctx.send(embed=embed)

#emote.py
def emote():
  epogchop = ':pogchop:'
  ecoal = ':coal:'
  ebeef = ':beef:'
  eiron = ':iron_ingot:'
  ediamond = ':diamond:'
  ewool = ':wool:'
  egold = ':gold_ingot:'
  enetherite = ':netherite_ingot:'
  eredstone = ':redstone:'
```is this how u do it?
velvet tinsel
#

the lack of PEP8 though

cold sonnet
#

indents...

manic wing
#

@shadow wraith what are you tryna do?

velvet tinsel
#

And indents

manic wing
#

i’ll code it

loud junco
velvet tinsel
loud junco
#

what indents

manic wing
#

cough definitely not spoonfeeding

cold sonnet
#

!indentation

#

hey

velvet tinsel
manic wing
velvet tinsel
manic wing
#

---> Sending a quote on a timer

you're going to want to have 3 things:
a) a list of channel ids
b) a database to store the channel ids - it can just be a json file, but you probably want the bot to remember to send the quotes, even if you restart the bot.
c) a discord.ext.tasks.loop.
In this example I am going to show how you may want to do it, but I will not show it linked to a database. You can do that part yourself. My github project where I have done this is https://github.com/caedenph/jesterbot.

@tasks.loop()
async def quote(): 
  ### Get channel_ids from database here ###

  for chan_id in channel_ids:
      channel = bot.get_channel(chan_id)
      await channel.send(quote)

in this example there is channel_ids, which holds the channel ids, and tasks.loop which is discord.ext.tasks.loop

You can also link this to a command,

@bot.command()
async def setup_quote():
  #apend to database```
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

loud junco
cold sonnet
#

why the bot slow

cold sonnet
#

oh it's not

velvet tinsel
#

Wdym

loud junco
velvet tinsel
#

You should have included the if statements

loud junco
#
@bot.command(name='craft')
@commands.cooldown(1, 1, commands.BucketType.user)
async def craft(ctx, arg: str):
  await item(ctx)
  emote()
  if arg == '1':
    embed = discord.Embed(
      description= f'''
{eph} `pog_helmet` ↦ 50 {epogchop} + 50 {ecoal}
cold sonnet
#

should have the indentation aliase 😠

loud junco
#

the if arg == '1':

velvet tinsel
#

You should have included it

#

So we wouldn’t get confused

loud junco
#

sry ;-;

velvet tinsel
#

We’re not mind readers

velvet tinsel
manic wing
#

@shadow wraith explain what you want to do

loud junco
#

i thought it will make u all understand easier

manic wing
velvet tinsel
manic wing
#

;)

velvet tinsel
loud junco
manic wing
#

:( meanie

cold sonnet
velvet tinsel
#

What’s the problem anyways @loud junco

velvet tinsel
cold sonnet
#

that don't even make sense now

manic wing
loud junco
velvet tinsel
#

what’s happening

velvet tinsel
loud junco
#
def emote():
  epogchop = ':pogchop:'
  ecoal = ':coal:'
  ebeef = ':beef:'
  eiron = ':iron_ingot:'
  ediamond = ':diamond:'
  ewool = ':wool:'
  egold = ':gold_ingot:'
  enetherite = ':netherite_ingot:'
  eredstone = ':redstone:'
cold sonnet
#

do bot.epogchop =...

boreal ravine
velvet tinsel
#

That’s systematically impossible

What i just said doesnt even make sense xD

loud junco
velvet tinsel
#

What difference is it gonna make?

cold sonnet
#

cuz it stores it as a bot variable

#

where you can grab it globally

velvet tinsel
loud junco
#

lemme try

velvet tinsel
#

I was gonna suggest a dictionary

#

But ok

#

Also hi Kayle 😄

loud junco
#

so what do i do

velvet tinsel
velvet tinsel
#

🤦‍♂️

cold sonnet
#

tho emoji.py should have access to the bot

thin canopy
#

hi

velvet tinsel
#

Hi

#

Also the lack of PEP8 is astounding

#

Guy’s probably using VS Code or something

#

That bad IDE lmfao

cold sonnet
#

he legit holds a dictionary in his hands

thin canopy
#

lol

velvet tinsel
#

Was that meant to be a joke

cold sonnet
#

yes

thin canopy
#

LMAO

velvet tinsel
#

Lol

#

Join r/programmerhumor

#

It’s hilarious

cold sonnet
#

mm

#

sarcasm

tawdry perch
#

Hmm, I saw the deleted message I got ss

velvet tinsel
#

Hmmm

#

I thought that was a ||you know what||

cold sonnet
#

it wasn't

#

trust me

velvet tinsel
#

I dont trust anyone

manic wing
#

i like it when paypal gives me chlamydia

#

tryna make payments and it rejects them but charges my bank brainmon

velvet tinsel
#

Depres

red blade
#

def misuse_embed(command_name, cooldown = "No cooldown.", usage, example_usage): why is this giving me error?

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.IncorrectUsage' raised an error: SyntaxError: non-default argument follows default argument (IncorrectUsage.py, line 4)

manic wing
#

you’ve made cool-down optional but usage and example_usage which aren’t optional are behind the optional

#

which doesn’t make much logical sense

#

hence why python doesn’t like it

red blade
#

ye ok

velvet tinsel
#

Hello

manic wing
boreal ravine
#

@velvet tinsel what bot do you have?

manic wing
#

yeah show us

velvet tinsel
boreal ravine
#

?

manic wing
#

show us your bot

#

we’ve seen kayles nub bot

#

and we’ve seen my sexy bot with 28 cogs and 240 commands ;)

#

now we wanna see yours

boreal ravine
#

true

velvet tinsel
#

I haven’t made a bot for the past few weeks

#

I’m in a collab with Okimii yert

manic wing
#

what collab

velvet tinsel
#

On a bot

manic wing
#

what bot

velvet tinsel
#

I guess

velvet tinsel
upbeat otter
manic wing
#

why would i do anything other than flex

manic wing
boreal ravine
velvet tinsel
velvet tinsel
manic wing
#

whats the github

honest vessel
#

@manic winghopefully u have changed your api keys

manic wing
honest vessel
#
            'x-rapidapi-key': "1c0ae8ee8emsh7bd54f2151cc278p1a0f3djsn9212745a468e",
            'x-rapidapi-host': "fixer-fixer-currency-v1.p.rapidapi.com"
        }```
manic wing
#

what command is that? o.O

boreal ravine
#

leaking private information

manic wing
#

probably forgot to change it after testing

honest vessel
velvet tinsel
#

Also

boreal ravine
#

ban

velvet tinsel
#

I’ll make a bot today

manic wing
#

eh all the apis i use are easy to get keys for

honest vessel
velvet tinsel
#

And I’ll preview it

manic wing
slate swan
#

zamn! nice api key

manic wing
#

not my api key 😎

honest vessel
#

😛

velvet tinsel
#

I’ll make a bot

manic wing
#

there are a couple more api keys if you wanna find em

boreal ravine
velvet tinsel
#

😡

manic wing
#

i can think of 2 off of the top of my head

velvet tinsel
#

And I’ll preview it I guess

boreal ravine
#

👹

slate swan
#
@client.command(pass_context = True)
async def mute(ctx, member: discord.Member):
     if ctx.message.author.server_permissions.administrator:
        role = discord.utils.get(member.server.roles, name='Muted')
        await ctx.add_roles(member, role)
        embed=discord.Embed(title="User Muted!", description="**{0}** was muted by **{1}**!".format(member, ctx.message.author), color=0xff00f6)
        await ctx.send(embed=embed)
     else:
        embed=discord.Embed(title="Permission Denied.", description="You don't have permission to use this command.", color=0xff00f6)
        await ctx.send(embed=embed)

Any guesses why this command doesn't work?

manic wing
#

i don’t think i did at least

manic wing
#

not server_permissions

boreal ravine
#

old code

#

very old

manic wing
#

also discord not disnake, passcontext deprected, client not bot, server a lot not guild, ctx.add_roles doesn’t exist

velvet tinsel
#

Caeden made too many commands

#

He forgot which ones he made lol

manic wing
#

i think i made most of them

honest vessel
#

@manic wingfred?

manic wing
#

what

#

i used to be called fred, its a long story

manic wing
#

i didn’t make end world hunger command x.x

shadow wraith
manic wing
#

huh

velvet tinsel
#

huh

manic wing
#

oh

#

i get it

velvet tinsel
#

Which API

shadow wraith
manic wing
#

so it goes through rhyming words as the user reacts

shadow wraith
manic wing
shadow wraith
#

credit me

#

jk

manic wing
velvet tinsel
#

Is it just me or are programmers pretty laid back

shadow wraith
#

in 30m mins i am kinda busy

manic wing
shadow wraith
#

righting x]

manic wing
#

you can read what i wrote whenever you want

velvet tinsel
#

You’re write!

shadow wraith
#

Your'a rong

velvet tinsel
#

You’re write that we should you righting instead of writing

manic wing
manic wing
#

for the moment

#

i’ll conk out soon

velvet tinsel
manic wing
#

get better sleep smh

velvet tinsel
manic wing
#

i pride myself in getting good sleep

velvet tinsel
manic wing
velvet tinsel
#

Then I got knocked out

manic wing
#

last night was an exception

velvet tinsel
shadow wraith
#

i got like 8-6 hours i think

manic wing
#

i was on a plane

velvet tinsel
shadow wraith
#

i was on a plane like 3-4 days ago, never got sleep :[

velvet tinsel
#

Rookie minutes

manic wing
velvet tinsel
#

I refuse to sleep

shadow wraith
#

same

velvet tinsel
manic wing
#

the better sleep you get the better coding you can achieve

velvet tinsel
# shadow wraith same

I try sleeping but the plane has a weird atmospheric pressure that doesn’t let me sleep

shadow wraith
#

oh yeah and there was this baby and kids running around the plane

velvet tinsel
manic wing
#

I refuse to sleep
followed by
I try sleeping

shadow wraith
#

one had a spray and came near my sister 💀

velvet tinsel
slate swan
velvet tinsel
#

What do you spend your money on

unkempt canyonBOT
velvet tinsel
jagged root
#

how can i get user message content in bot.listen

manic wing
velvet tinsel
#

?

jagged root
#

for example if they type .hello hi the bot says user said hi

velvet tinsel
velvet tinsel
jagged root
#

ik

manic wing
jagged root
#

but i want it .listen cause i already have a command like that

manic wing
#

as in

velvet tinsel
manic wing
#

bot.listen can be on_reaction_add

#

or on_message

jagged root
#

can i make more than 1 command with same name?

manic wing
#

no

velvet tinsel
#

However it is possible

manic wing
#

use your noggin

jagged root
#

what i do then

manic wing
#

change the name of the command? lemon_pika

velvet tinsel
#

It is technically possible

jagged root
manic wing
velvet tinsel
#

However it will cause confusion

velvet tinsel
#

You can make commands using on_message

manic wing
#

🤮

jagged root
#

and can i get user message content with that?

#

how?

manic wing
#

probably

jagged root
#

how would it be idk how

velvet tinsel
#

Dont do it though

manic wing
#

__builtins__["print"].__call__(_message_.content.__str__() or None if not None) this will print the content

#

if esoteric is your cup of tea

jagged root
#

hm

boreal ravine
#

bruh

manic wing
#

each to their own

manic wing
velvet tinsel
#

Well

#

It’s preferable not to have two commands of the same name

#

The computer can’t read minds

boreal ravine
#

u cant even have 2 commands with the same name

visual island
manic wing
#

hmmm could do

#

i made a one line command

#

lemme find it

velvet tinsel
manic wing
#

    @commands.command()
    async def viewfeedback(self, ctx: Context, distance:Union[int, str]=0, author_from:Union[int, str]=None):
        await thebed(ctx, '', '**Error: **distance must be an integer (an index placevalue) if no `author_from` is given!') if hasattr(distance, 'upper') and author_from is None else await thebed(ctx, '', f'*`{distance}`*: "{data["feedback"]["message"][distance]}", submitted by **{data["feedback"]["author"][distance]}**' if distance != 0 else f'**You can index off of the index on the left side. Type `{ctx.prefix}viewfeedback <index>`\n**\n' + "\n".join([f"`{num}:` {data['feedback']['message'][k]}**, said by {data['feedback']['author'][k]}**" for num, k in enumerate(range(len(data['feedback']['message']))) if num <= 9]), a='Feedback', i_u=ctx.author.avatar.url) if author_from is None else await thebed(ctx, '', f'\n'.join([f"`{num}`: {data['feedback']['message'][num]}" for num, k in enumerate(data['feedback']['author']) if k ==author_from]), a=f'Feedback from {author_from}', i_u=ctx.author.avatar.url, f=f'All these messges are from {author_from}') if hasattr(author_from, 'upper') else await thebed(ctx, '', f'\n'.join([f"`{num}`: {data['feedback']['message'][num]}" for num, k in enumerate(data['feedback']['id']) if k ==author_from]), a=f'Feedback from {await self.bot.fetch_user(author_from)}', i_u=ctx.author.avatar.url, f=f'All these messages are from {await self.bot.fetch_user(author_from)}')```
#

very good command

visual island
#

...

#

will take litterally a year to debug a SyntaxError

manic wing
#

imagine making mistakes

velvet tinsel
#

Not Caeden

small igloo
#

question of the day :3 how to make my bot send cooldowns of commands

velvet tinsel
unkempt canyonBOT
#
Not gonna happen.

No documentation found for the requested symbol.

small igloo
velvet tinsel
#

!d discord.ext.commands.cooldown

unkempt canyonBOT
#

@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")

A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").

If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.

A command can only have a single cooldown.
velvet tinsel
#

@small igloo

slate swan
#

How would I add a specific role to a user with there ID?

velvet tinsel
#

Hey I’m in the same house as him

#

Cool

small igloo
slate swan
#

?

small igloo
jagged root
#

how can i get mentioned user name?

velvet tinsel
#

I’m gonna leave

#

You guys don’t Google stuff

manic wing
#

nooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

jagged root
#

xd

manic wing
#

@velvet tinsel

jagged root
#

got it

manic wing
#

come back :(

#

you can watch me write this longass rhyme shit now

velvet tinsel
#

?

#

Ok I’ll stay here

#

It’s boring here

slate swan
#

@manic wing can you send the API documentation

velvet tinsel
#

Are you gonna write a genius paragraph yet

slate swan
#
role = get(message.guild.roles, name = "test role")
await ids.add_roles(role, atomic=True)
#

would that work, as I already got the user ID I want to add the role too.

jagged root
#

How can i get only last word of {message.content}

slate swan
#

You got to split the strings up

jagged root
#

idk how

slate swan
small igloo
#

hmm nice one caeden

manic wing
#

accidentally sent it prematurely

small igloo
#

how can ModMail send DMs to mods :v just curious

velvet tinsel
#

Just Google it

#

What don’t you get about fucking Googling it?

#

It’s the simplest thing on earth

slate swan
#

This is a help channel, your not being much help asking people to google it.

velvet tinsel
slate swan
#

They might of already done that.

velvet tinsel
#

I doubt it

slate swan
velvet tinsel
slate swan
#

then a ban is next

velvet tinsel
#

Cool

kind wind
#

Is it good to have on the output the
'python' is not recognized as an internal or external command, operate program on batch file?

#

On the output

#

not terminal

manic wing
#

!enumerate || So you're going to want to make the aiohttp.ClientSession and have 2 variables;
-> word which holds the base rhyming word
-> rhyming_words which is a list of all the words that rhyme with word
-> iteration_number which is an int of value 0 just holding the index that rhyming_words is on. this can also be dynamically created and executed within the wait_for loop but for simplicity we can just make it manually
I never want to see you do __what_rhymes__ as a name again

you're going to send word and call the message message; add_reaction to it.

then you're going to create your wait_for and unpack it into reaction, user seeing as wait_for('reaction_add') returns a tuple. Assuming your python is v3.8+ we can use a walrus for the loop ```py
while (reaction, user := await bot.wait_for('reaction_add', check=..., timeout=...)):

this is all you have to do for the loop to continue.

if reaction == your_emoji:
new_word = reprocess(iteration_number)
await message.edit(content=...)
#where reprocess returns the rhyming_word so that message shows the new rhymed word```

reprocess can have the check so you dont even need a try/except block. py def reprocess(iteration_number: int) -> str: #iteration_number is the int we defined earlier to keep track of which rhyming word index we're on. if len(rhyming_words) -1 > iteration_number: #there are not enough rhyming_words left, they have all been used. return "No more rhyming words" return rhyming_words[iteration_number] #returns the rhyming word

unkempt canyonBOT
#

Ever find yourself in need of the current iteration number of your for loop? You should use enumerate! Using enumerate, you can turn code that looks like this:

index = 0
for item in my_list:
    print(f"{index}: {item}")
    index += 1

into beautiful, pythonic code:

for index, item in enumerate(my_list):
    print(f"{index}: {item}")

For more information, check out the official docs, or PEP 279.

manic wing
#

not sure how useful that was pithink

jagged root
#

how can i get mentioned user name?

manic wing
kind wind
#

its about discord bot

velvet tinsel
#

I love you Caeden

velvet tinsel
manic wing
#

i feel like i underperformed

velvet tinsel
manic wing
#

ty :)

velvet tinsel
#

😄

jagged root
#

how can i see doc

manic wing
#

see what

velvet tinsel
#

Wdym

jagged root
#

documentation

manic wing
#

what module are you using

thorny flint
#

How to access variable from a different function in cogs?'
I tried using global

commands.Cog.listener()
async def on_ready(self):
        
  f = open('templates.json')
  global template_ids template_ids= json.load(f)


jagged root
#

disnake

velvet tinsel
#

Wait they do

jagged root
#

well so discord

velvet tinsel
#

Never mind

jagged root
#

how can i see it

velvet tinsel
#

I searched it up

jagged root
#

thanks

fading knot
#

I am a bot coader is there anyone here to join my team

velvet tinsel
jagged root
thorny flint
velvet tinsel
velvet tinsel
velvet tinsel
#

♥️ reminds me of Pandabweer

velvet tinsel
leaden hollow
#

so what are the other libraries I can switch from discord.py as it's now dead anyways

velvet tinsel
#

Disnake

#

pithink and nothing else

thorny flint
velvet tinsel
#

Ok

leaden hollow
boreal ravine
#

it does

leaden hollow
visual island
#

!d discord.ui.Button

unkempt canyonBOT
#

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

New in version 2.0.
leaden hollow
#

ty

visual island
#

why use external libraries when you can not use them

manic wing
#

icy

#

wanna make a projecttt

slate swan
#

Hi

boreal ravine
unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
manic wing
#

@visual island make a bot w/ me

visual island
#

what bot

slate swan
#

Anyone have a good video for learning classses

manic wing
#

who knows

boreal ravine
slate swan
#

Ok

visual island
#

I can't think of any "unique" bots

slate swan
#

Very unique

manic wing
boreal ravine
velvet tinsel
manic wing
#

i cant think of either of those two :p

manic wing
boreal ravine
slate swan
velvet tinsel
#

He’ll make 100 cogs and won’t remember what they do

boreal ravine
manic wing
#

i know my cogs jeez ... most of them at least ;)

velvet tinsel
#

See

manic wing
#

dude it is kinda hard to remember all 240 commands

slate swan
#

Bro my code is so fucking messy

boreal ravine
#

use black?

slate swan
#

No I just don’t use cogs lol

velvet tinsel
#

Caeden, what IDE do you use?

visual island
manic wing
velvet tinsel
manic wing
velvet tinsel
#

Your code must be really messy

slate swan
visual island
jagged root
#
async def on_message(message):
    
    if message.author.bot:
        return
    else:
        
        if ".timeout" in message.content.lower(
        ):
            await message.delete()
            await message.channel.send(
                f"{message.author.name} timeouted for {message.content}",
                delete_after=10)```

how can i get mentioned name here
#

like the user that its mentioned

visual island
manic wing
velvet tinsel
#

Use command(), I don’t know how to work with on_message

visual island
manic wing
#

my code is always great quality and sexiness

visual island
#

@velvet tinsel you'll give the idea, deal

velvet tinsel
#

No

jagged root
#

@manic wing help me

velvet tinsel
#

I’m terrible at ideas

visual island
#

me 2

velvet tinsel
#

I spent 10 days thinking of a bot name and all I came up with was “bot”

visual island
manic wing
#

yes yes icy dekriel gives the ideas and we code it :D

velvet tinsel
#

Noooo

visual island
#

we need like 20 people for the ideas and 2 people to code it

velvet tinsel
#

I’ll code it

#

😳

visual island
#

remake dank memer in 2 days and you'll code it

manic wing
#

we want sexy code with typehints

visual island
#

*and very little if elifs

velvet tinsel
#

Deal

#

I’ll remake dank memer

#

In two days

#

Challenge accepted

manic wing
visual island
#

you'll not make it for sure

boreal ravine
manic wing
#

return exists

#

along with break not continue

velvet tinsel
velvet tinsel
#

💀

visual island
velvet tinsel
visual island
#

but cant think of any good use of it

manic wing
#

yeah i was overexagerating

fervent shard
#

so i need a code on the bot dming the member after they're kicked from the server

manic wing
#

well you would have to check audit log for kicks becuase on_member_remove doesnt inherinhtely show how they left

velvet tinsel
#

Would you like to use my dank memer when I finish with it @manic wing jam_cavedude

fervent shard
boreal ravine
velvet tinsel
#

Does it have to use a the dank memer profile picture

boreal ravine
#

@fervent shard is this for a command?

fervent shard
visual island
manic wing
#

dekriel one condition - your dank memer bot cant use json

visual island
#

that too

fervent shard
velvet tinsel
visual island
#

postgres when

boreal ravine
fervent shard
#

but i need the code

velvet tinsel
#

The commands look easy

visual island
#

make it

velvet tinsel
#

The images would be harder

#

I’ll have to use PIL

boreal ravine
velvet tinsel
#

making it

manic wing
#

ok so icy

velvet tinsel
#

Chill

leaden hollow
#

it doesn't recognise view```py
@commands.command()
async def rrole(self, ctx):
but = Button(label="E", style=discord.ButtonStyle.primary)
vb = View()
vb.add_item(but)
await ctx.send("X", view=vb)

manic wing
#

what bot we making

#

kayle

manic wing
#

you joining?

visual island
#

um, I'll let you decide CH_ThumbsUpSmile

velvet tinsel
#

Remake dank memer

leaden hollow
ebon island
#

How do I make commands not case sensitive?

velvet tinsel
#

😏

boreal ravine
fervent shard
leaden hollow
visual island
velvet tinsel
proven ore
#

A

velvet tinsel
#

B

boreal ravine
leaden hollow
#

yes

#

that's the issue

proven ore
ebon island
#

bot's constructor is this line yes?

client = commands.Bot(command_prefix=get_prefix, help_command=None)

ebon island
#

thanks 🙂

velvet tinsel
#

Yes

proven ore
#

np

boreal ravine
proven ore
lethal bloom
#

as you mentioned the id of the channel the command was run on?

proven ore
velvet tinsel
#

💀

boreal ravine
lethal bloom
#

. . .

velvet tinsel
#

?

leaden hollow
boreal ravine
#

djs is an entire library, made from scratch while dpy forks were forked from dpy

proven ore
proven ore
manic wing
#

so what are we all making

proven ore
#

dn noʎ ǝʌᴉƃ ɐuuoƃ ɹǝʌǝu

boreal ravine
visual island
velvet tinsel
boreal ravine
manic wing
#

no

velvet tinsel
#

Jk

#

I don’t know

#

I don’t have ideas

manic wing
#

what do you guys think of a jarvis bot

velvet tinsel
#

Wdym

manic wing
#

you know jarvis from iron man

leaden hollow
manic wing
#

where you can tell him to do shit

velvet tinsel
velvet tinsel
boreal ravine
unkempt canyonBOT
leaden hollow
manic wing
#

so you just type like 'hey jarvis, ban fred'

velvet tinsel
boreal ravine
manic wing
#

kayle icy, your thoughts?

boreal ravine
manic wing
#

i want everyone on this project

velvet tinsel
#

Including me? 💀

visual island
#

sure I'll just follow every idea

manic wing
#

i make a repo and everyone here is apart of it

velvet tinsel
#

I don’t give a shit about ideas

manic wing
velvet tinsel
#

😭 ok

manic wing
#

jk

velvet tinsel
#

I typehint

manic wing
#

is this a thing we wanna go through or is it a one day kinda thing

velvet tinsel
#

Idk

manic wing
#

i can make a gc with us in it

velvet tinsel
#

Ok

#

I guess

leaden hollow
fervent shard
#

what does await member.send(message) do

velvet tinsel
manic wing
fervent shard
velvet tinsel
#

Correct

manic wing
#

mhm

#

ill make a gc with everyone

velvet tinsel
#

My comment touch a nerve?

manic wing
#

this is non-voluntairy

boreal ravine
velvet tinsel
#

Wdym

manic wing
#

you work on this project or you're disowned

leaden hollow
#

2.0.0a

boreal ravine
leaden hollow
#

@boreal ravine

boreal ravine
leaden hollow
#

pip install -U git+https://github.com/Rapptz/discord.py used this

vale wing
#

How to make bot respond both to slash and non slash in disnake?

boreal ravine
manic wing
#

kayle add me

velvet tinsel
manic wing
#

@velvet tinsel

#

accept my friend req

velvet tinsel
#

Wait

#

Did you say friend

leaden hollow
#

what is friend now

velvet tinsel
#

Idk

boreal ravine
dire folio
#

how would i send the dynamic time things?

fervent shard
#

help when i kick my alt the bot doesnt send my alt the message

leaden hollow
dire folio
leaden hollow
dire folio
#

ty

ebon island
#

How do I make link to a channel in DPy?

#

or to a user since it might be useful soon as well

#

like that

leaden hollow
#

<#id>

slate swan
#

User.mention , Channel.mention

leaden hollow
#

if you want to send it as a message

ebon island
#

Thanks 🙂

mellow gulch
#

Anyone know how to find out weather or not a person has a specific role

ebon island
#

Let me test

slate swan
mellow gulch
slate swan
#
if role in member.roles:
   #they have the role```
shadow wraith
#

hey sarthak you are experienced with libs like disnake or discord.py right

mellow gulch
#

If “vip” in msg.author.roles?

slate swan
#

do you have the role id or something?

mellow gulch
shadow wraith
#

becasue im gonna ask a question which is gonna be a lil' hard for most people, i did try what they said but they resulted it a misunderstanding or just didn't work

shadow wraith
#
@bot.command()
@commands.guild_only()
@commands.cooldown(1, 3, BucketType.default)
async def rhyme(ctx, *, word):
    try:

        def check(r: disnake.Reaction, u: Union[disnake.Member, disnake.User]):
            return u.id == ctx.author.id and r.message.channel.id == ctx.channel.id

        async with aiohttp.ClientSession() as session:
            newword = quote_plus(word)
            Api = await session.get(f"https://api.datamuse.com/words?rel_rhy={newword}")
            API = await Api.json()

            randomWord = random.choice(API).get("word")
            __what_rhymes__ = await ctx.reply(
                f"Word: {word}\nWhat rhymes: {randomWord}"
            )
            await __what_rhymes__.add_reaction("🔄")
            event = await bot.wait_for(
                event="reaction_add",
                check=check,
                timeout=30.0,
            )
    except IndexError as ie:
        await ctx.reply(f"There are no words rhyming with {word} :(")
    except asyncio.TimeoutError:
        pass
    else:
        newWord = random.choice(API).get("word")
        if str(event[0].emoji) == "🔄" and not event[1].bot:
            await __what_rhymes__.edit(content=f"Word: {word}\nWhat rhymes: {newWord}")
        else:
            pass

why does this listen to one reaction, why can't i just make it listen to all reactions until timeout

slate swan
slate swan
shadow wraith
#

yup another while True: response, so where would the loop be?

mellow gulch
slate swan
mellow gulch
#

Msg.author?

slate swan
mellow gulch
#

So it would then be role in msg.author.roles

slate swan
#

Yep

shadow wraith
slate swan
shadow wraith
#

yes

#

so i don't move my try, except and my else statements? right?

slate swan
#

You don't need to

#

if that's not related to listening to reactions , which I don't think is

wary ravine
#

what's the command to install discord-py-slash-command

shadow wraith
#

that only works for discord.py 1.7.3 but if you want to install do pip3 install discord-py-slash-command or pip install discord-py-slash-command

wary ravine
#

ok ty

shadow wraith
leaden hollow
#

Error - Command raised an exception: TypeError: send() got an unexpected keyword argument 'view'

@commands.command()
    async def rrole(self, ctx):
        but = Button(label="E", style=discord.ButtonStyle.primary)
        view = View()
        view.add_item(but)
        await ctx.send("X", view=view)
leaden hollow
vale wing
#

How to disable all the buttons after I am done with interaction

shadow wraith
#

weird

#

use a class for that and check

#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
vale wing
#

What check bro

shadow wraith
vale wing
#

So how do I disable all the buttons in get_value?

mellow gulch
#

Guys

#

How do i use slash commands

fading harness
maiden fable