#discord-bots

1 messages Β· Page 33 of 1

tawdry karma
#

try:
print(int(message.content))
except:
#error

vocal snow
#

there isn't any ctx in slash commands so how are you sending it?

slate swan
#

wait we need try

silk fulcrum
rugged shadow
#

lbyl vs eafp πŸ˜‚

silk fulcrum
#

that's how hybrid commands work

slate swan
#

No

#

then me see it so hard

#

Ok

vocal snow
silk fulcrum
#

yeah

slate swan
#

me need unblock now

silk fulcrum
#

well even in slash command you can do Context.from_interaction

slate swan
#

goood no mor block messages

#

@silk fulcrum don't even block me

silk fulcrum
#

I unblocked you when the mod came

slate swan
#

Rude TES_rage block me

tawdry karma
silk fulcrum
#

sure

slate swan
#

ok

tawdry karma
vocal snow
#

could you just raise the error and see? Or print it's type()

slate swan
#

good he blocked me

slate swan
tawdry karma
silk fulcrum
slate swan
#

i think thats because of delete_after kwarg if thats not wrapped for interactions properly, lemme check the src

tawdry karma
silk fulcrum
slate swan
#

me fix errors

tawdry karma
#

Now work?

slate swan
#

o it work

silk fulcrum
#

well after NotFound I think it's delete_after

slate swan
#

lol thanks for everyone that die here :)

silk fulcrum
#

bruh

tawdry karma
#

No problem

slate swan
#

@silk fulcrum want nitro :)

#

He really die from me

silk fulcrum
slate swan
#

i can give him nitro bc he dead

tawdry karma
#

F

slate swan
#

others just tolled

slate swan
#

O in text it say error but in number it not

#

great great

slate swan
#

so no nitro :D

silk fulcrum
#

unblocked you

slate swan
#

because the method to delete an interaction response and a normal message are different

rugged shadow
unkempt canyonBOT
#

discord/ext/commands/context.py lines 872 to 879

if self.interaction.response.is_done():
    msg = await self.interaction.followup.send(**kwargs, wait=True)
else:
    await self.interaction.response.send_message(**kwargs)
    msg = await self.interaction.original_response()

if delete_after is not None and not (ephemeral and self.interaction is not None):
    await msg.delete(delay=delete_after)```
silk fulcrum
vocal snow
#

i need to read dpy codebase again so much has changed !

slate swan
#

wait i got it
master do you

  • run the command
  • send the message with delete _after
  • purge the channel?
silk fulcrum
rugged shadow
#

master 😩

slate swan
#

because that may be the reason of your error, the message is getting deleted and thus returning NotFound

vocal snow
#

5head

silk fulcrum
rugged shadow
#

just found it funny that sarth is calling you master

silk fulcrum
#

:))

slate swan
#

master is a big bren so why not

rugged shadow
#

That's not the only time they called someone master I think

slate swan
rugged shadow
#

:)) is bullying now guys

silk fulcrum
#

:)))))

vocal snow
slate swan
slate swan
rugged shadow
#

Lmao

silk fulcrum
#

he wont

rugged shadow
#

You really know how to manipulate conversations

slate swan
slate swan
#

unless you have a check

slate swan
#

in past

#

10 mins ago

slate swan
#

me learn code after read it but before me dumb

silk fulcrum
#

how can slash command invocation be deleted

slate swan
#

try it and see

silk fulcrum
#

trywhatandsee

slate swan
#

what else could NotFound mean in context of a slash command

slate swan
silk fulcrum
#

well, then why when I do like /clear 5

slate swan
#

and did it purge the messages?

silk fulcrum
#

yes

lone lichen
slate swan
#

i will screen share

silk fulcrum
#

no

slate swan
#

rude cat

silk fulcrum
lone lichen
silk fulcrum
#

beep boop baap(

#

howdiscord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction

torn sail
#

Defer

silk fulcrum
torn sail
#

Put the defer at the top of the command

silk fulcrum
#

ok

silk fulcrum
glad cradle
#

ctx with app commands πŸ’€

silk fulcrum
glad cradle
torn sail
silk fulcrum
#

ohh i see

torn sail
#

So you defer it which makes it say bot is thinking

slate swan
#

Thx for everyone who help me and i sorry :)

torn sail
#

!d discord.InteractionResponse.defer

unkempt canyonBOT
#

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

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

This is only supported with the following interaction types...
glad cradle
#

defer extend the duration of the interaction to 15min instead of 3sec

torn sail
#

Yes

scarlet widget
#

I have a bot and the application but how do I put it in vscode so I can code it

silk fulcrum
#

you only need token in code

#

a tutorial

#

might be helpful

scarlet widget
#

Thanks

slate swan
#

that tutorial is only for disnake nd nextcord...

scarlet widget
slate swan
scarlet widget
#

How did you learn programming then?

slate swan
#

dogepray school

#

I learned it by myself ASakashrug

scarlet widget
#

Oh

#

But is there just a simple quick tutorial telling me how to put my bot in vscode and make it run

#

I don't need a tutorial on commands and everything

#

I just don't know how to put it in vscode

vocal snow
#

What does that mean, vscode is just a text editor

slate swan
vocal snow
scarlet widget
vocal snow
#

Connect it to what

scarlet widget
#

cuz I can't just make a new file and say "print ("hello world")" and expect it to be connected to the bot

scarlet widget
slate swan
#

Don't tell me that the gist is a whole lot worse than it should be 'cause I know AScry

#
channel2 = await guild.create_text_channel(f"ticket-{payload.member.name}", category=category, overwrites=overwrites)
if channel2.id:
   if str(payload.emoji) in ["β›”"]:
      print('test')``` it this ok?
slate swan
#

thats why i asked πŸ˜„

#

error?

#

also if you're mentioning the category, might as well just use the category to create the channel too

#

!d discord.CategoryChannel.create_text_channel

unkempt canyonBOT
#

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

A shortcut method to [`Guild.create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") to create a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") in the category.
slate swan
#

i already use that

#

oh wait

gusty shard
#

theres a lot of people using my bot

#

and my bot is getting rate limited because of that

#

how can i prevent it?

pale turtle
#

Make a command timeout maybe

slate swan
gusty shard
#

i do

gusty shard
slate swan
#

well then bad news, its not the users who are making your bot ratelimited, its replit.

gusty shard
#

wtf

#

somebody said use another hosting service

pale turtle
#

I think replit works on a joined ip, so everyone who uses replit sends a request from same ip

gusty shard
#

but i bought yearly plan and i dont want to lose my money

#

isnt there any way to fix it?

pale turtle
#

@gusty shard

slate swan
#

guys what this error mean Traceback (most recent call last): File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 466, in _run_event await coro(*args, **kwargs) File "c:\Users\Ibrah\Desktop\Discord Bot\main.py", line 54, in on_message await message.delete() File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\message.py", line 806, in delete await self._state.http.delete_message(self.channel.id, self.id) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 711, in request raise NotFound(response, data) discord.errors.NotFound: 404 Not Found (error code: 10008): Unknown Message

#

and es me nitro

gusty shard
#

i can do that without any problem on replit

#

why is it giving errors on a basic gamble bot

silk fulcrum
pale turtle
#

The problem is with replit. Imagine all the people using replit, and they all send a request to the discord api. That is so much that IP, which is only one IP gets ratelimited.

gusty shard
#

dang

gusty shard
#

can i host multiple bots with it

keen talon
cloud dawn
gusty shard
cloud dawn
#

Bruh

gusty shard
#

that makes so much money on telegram

cloud dawn
#

You know selfbots are against ToS

gusty shard
#

im doing it since 2020 and nothing happend yet

cloud dawn
#

You'd need to setup a VPS, if you earn that much money I think a proper VPS is pretty valid.

slate swan
# gusty shard im doing it since 2020 and nothing happend yet

that's how you do not support the community, more like a rusty user/traitor to your own service. People make efforts to serve you the best, and all you do is break the terms they granted permission to use the app with. Reasons we'll never have a good community ever.

#

I can't express my hate towards people who break the laws or even just for so called "fun"

gusty shard
#

im not doing it for "fun"

#

its called shilling

slate swan
#

I never said that it is for fun specifically but ok

gusty shard
#

we are making the advertising for coins

cloud dawn
gusty shard
#

i know some people making thousands from it

shrewd apex
slate swan
#

anyways, back on topic prayge

pearl shoal
#

i want to make so the chat in minecraft shows in a channel in a dc server is this possible

shrewd apex
#

yes

rapid knoll
#

Can someone please tell me why this doesn't work


@neonnix.command
async def developer(ctx):
    channel = neonnix.get_channel(1007993775840309298)
    embed = discord.Embed(title=f"{ctx.mention}'s Developer Request", description="Wants to become a developer")
    await channel.send(embed=embed)

silk fulcrum
slate swan
cloud dawn
shrewd apex
#

even easier if it's ur own server

rapid knoll
shrewd apex
#

what's neonix

slate swan
pearl shoal
pearl shoal
cloud dawn
shrewd apex
pearl shoal
cloud dawn
#

/sudo <player> c:Hello World!

slate swan
#

just add a plugin to the server like Panda suggested, there's loads of it

pearl shoal
#

its a bedrock server btw

slate swan
#

eww

shrewd apex
cloud dawn
#

πŸ’€

slate swan
#

imagine using bedrock when you can use the java version

pearl shoal
slate swan
#

speechless

cloud dawn
#

The whole reason for bedrock is to not use plugins.

pearl shoal
#

not even my server

shrewd apex
#

my Minecraft knowledge is 0 so not able to appreciate u PPL commenting

silk fulcrum
slate swan
#

I suddenly forgot everything, let panda enjoy

shrewd apex
#

no python Minecraft πŸ‘€

cloud dawn
slate swan
cloud dawn
pearl shoal
#

zu?

silk fulcrum
pearl shoal
#

24/7

cloud dawn
pearl shoal
#

nobpdy gets your token

silk fulcrum
#

anyways, looks nice

slate swan
shrewd apex
#

why would someone get it in first place πŸ‘€

slate swan
slate swan
silk fulcrum
pearl shoal
#

nitro is 10k in my country

slate swan
silk fulcrum
#

are you in russia?

shrewd apex
#

ur country currency value lowπŸ‘€

pearl shoal
#

😦

shrewd apex
#

...

pearl shoal
#

its growing now it was like 15k before and now its 7k

shrewd apex
#

πŸ™ˆ πŸ™Š

pearl shoal
shrewd apex
#

me Indian too...

silk fulcrum
#

so 10k or 7k?

pearl shoal
#

really?

cloud dawn
slate swan
cloud dawn
#

I mean if you instantly buy the 1 year plan it's expensive yeah.

silk fulcrum
#

well, 100 dollars is 7k in my country too

pearl shoal
silk fulcrum
slate swan
cloud dawn
shrewd apex
#

discord surprisingly accurate 9999.99 sus

pearl shoal
#

lol]

shrewd apex
#

who their sales manager chose such a perfect amount

silk fulcrum
#

πŸ˜‚

slate swan
#

,

cloud dawn
#

100 in our country is 102.64 USD

slate swan
#

100.42 in mine is 121 USD

pearl shoal
shrewd apex
#

74 bucks 1usd

silk fulcrum
#

100 in mine is 1.61 usd

pearl shoal
#

in 1 dollor you can get a 500ml pepsi bottle + a packet of chips here

#

dollar*

shrewd apex
#

less than a dollar

slate swan
#

ok, start talking about inflation rates now and we are getting warned or shushed together

pearl shoal
silk fulcrum
#

p :XD:

slate swan
#

without the p

pearl shoal
#

p

shrewd apex
pearl shoal
#

!shhh

slate swan
#

!shh but okay

silk fulcrum
shrewd apex
#

/shh

silk fulcrum
#

+2 mins

cloud dawn
shrewd apex
#

mhm

silk fulcrum
#

interval is based on hs

cloud dawn
silk fulcrum
#

shh is 4 mins, shhh is 6

slate swan
#

the number of hs determine the amount of minutes and you just pinged a mod

silk fulcrum
#

ping

unkempt canyonBOT
#
Bad argument

Unable to convert 'shh' to valid command, tag, or Cog.

#
Bad argument

Unable to convert 'sh' to valid command, tag, or Cog.

cloud dawn
#

Dynamic command

silk fulcrum
cloud dawn
pearl shoal
#

!src shhh

unkempt canyonBOT
#
Bad argument

Unable to convert 'shhh' to valid command, tag, or Cog.

#
Command Help

!source [source_item=None]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

shrewd apex
#

!src hush

unkempt canyonBOT
#
Command: silence

Silence the current channel for duration minutes or forever.

Source Code
pearl shoal
#

!source unhush

unkempt canyonBOT
#
Command: unsilence

Unsilence the given channel if given, else the current one.

Source Code
pearl shoal
#

which state you live asher

#
from threading import Thread

app = Flask('')

@app.route('/')
def home():
    return "Hello. I am alive!"

def run():
  app.run(host='0.0.0.0',port=8080)

def keep_alive():
    t = Thread(target=run)
    t.start()
silk fulcrum
#

keep alive

#

repl it is not alive

#

so you need to keep it

pearl shoal
#

its not for that

#

it is to keep mi bot online 24/7

silk fulcrum
#

why is okimii offline, is he stealing my cat again?

cloud dawn
#

Ask ash they seem close

shrewd apex
cloud dawn
shrewd apex
#

u might as well ask city directly πŸ‘€

silk fulcrum
#

HEAD

slate swan
cloud dawn
#

This is a discord bot server sir.

shrewd apex
#

thats up timer robot pinging

silk fulcrum
cloud dawn
shrewd apex
cloud dawn
silk fulcrum
cloud dawn
#

πŸ™ πŸ˜‚

silk fulcrum
slate swan
#

I have a question

cloud dawn
silk fulcrum
#

CREATE ROLE Ashley;
GRANT Ashley PERMISSIONS None;

shrewd apex
silk fulcrum
shrewd apex
#

why even bother creating

slate swan
#
client.run("token")

class client(commands.client):
  def init():
    return super().init(intents=commands.Intents(True))

client = client()

import nextcord
import disnake
from discord.ext import commands

@client.cmd()
async def mycmd():
  await client.send_message_to_user("hello")```
why not working
silk fulcrum
#

commands.client

slate swan
silk fulcrum
#

what error?

slate swan
#

'client' not defined

silk fulcrum
#

hmmm... really weird

slate swan
#

how to fix?

silk fulcrum
#

consider checking you deleted the bot, regenerated token 666 times and installed thecatapi.discord

shrewd apex
slate swan
#

wait I didnt create the bot

#

how to create bot

#

ok enough shitposting

silk fulcrum
#

why

rapid knoll
#

How do I fix this error

in _actual_conversion
    raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "discord.member" failed for parameter "member".

silk fulcrum
#

i was searching for random site where you can click button

silk fulcrum
#

discord.****M****ember

rapid knoll
slate swan
#

which is it

cloud dawn
#

πŸ‘΄

silk fulcrum
shrewd apex
#

common sense and reading abilityπŸ‘€

cloud dawn
#

Gained another year

shrewd apex
slate swan
silk fulcrum
#

all the commands look trash :)

cloud dawn
slate swan
#

lmao

#

I

#

know it is a lot more shitty than it should be but okay

#

am too lazy to apply any amount of brain

cloud dawn
#

πŸ˜‚

#

I'll stop then.

rotund bloom
#

How do I add options to my slash commands in discord.py v2?

slate swan
#

thanks panda

cloud dawn
rotund bloom
silk fulcrum
#

same as in usual commands

cloud dawn
rotund bloom
#

yes

#

but with options included

slate swan
#
async def ban(interaction, member, duration, reason):
  ...

easy as that

silk fulcrum
#

@slate swan πŸ‘Ž

slate swan
rotund bloom
#

with options to choose from

slate swan
#

spotted it before you did

silk fulcrum
slate swan
#

and you do know that is such a long gist

#

mistakes happen

slate swan
silk fulcrum
slate swan
silk fulcrum
shrewd apex
#

why group capital in one and smol in another discrimination between g'sπŸ‘€

rotund bloom
shrewd apex
#

wdym by option to choose from?

rotund bloom
cloud dawn
# rotund bloom can you help

async def user_ban(self, interaction: Interaction, member: Member, duration: int = None, decimal: Literal["Years", "Days", "Hours", "Minutes", "Seconds"] = None, reason: str = None) -> None

#

I'd prob do this.

cloud dawn
silk fulcrum
#

own Time subclass via calendar πŸ‘

cloud dawn
rotund bloom
shrewd apex
#

s ;-;

cloud dawn
shrewd apex
cloud dawn
shrewd apex
cloud dawn
#

That's how

shrewd apex
cloud dawn
#

For the int you can also use range to limit the max

#

🧠

shrewd apex
silk fulcrum
shrewd apex
#

kek didn't read

#

nvm

cloud dawn
silk fulcrum
#

lmao

rotund bloom
cloud dawn
silk fulcrum
#

logging get logger

cloud dawn
#

!traceback

unkempt canyonBOT
#

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

A full traceback could look like:

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

If the traceback is long, use our pastebin.

rotund bloom
# cloud dawn Well I can't do anything with this.
File "C:\Users\Admin\PycharmProjects\Snap\venv\lib\site-packages\discord\commands\core.py", line 638, in _parse_options
    option = Option(option, "No description provided")
  File "C:\Users\Admin\PycharmProjects\Snap\venv\lib\site-packages\discord\commands\options.py", line 75, in __init__
    _type = SlashCommandOptionType.from_datatype(input_type)
  File "C:\Users\Admin\PycharmProjects\Snap\venv\lib\site-packages\discord\enums.py", line 657, in from_datatype
    if datatype.__name__ in ["Member", "User"]:
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\typing.py", line 706, in __getattr__
    raise AttributeError(attr)
AttributeError: __name__

Process finished with exit code 1
cloud dawn
#

Since when are the crying about that.

rotund bloom
#

?

rotund bloom
rotund bloom
#

wtf am I doing wrong

cloud dawn
#

Are you working in a venv?

rotund bloom
#

no

#

well yes

#

in pycharm

cloud dawn
#

Did you install the git version there?

rotund bloom
#

Ye

cloud dawn
#

Could you check over at package control?

rotund bloom
cloud dawn
rotund bloom
#

yes

#

what should I search there?

cloud dawn
rotund bloom
#

done

cloud dawn
#

What version does it have?

rotund bloom
#

none

#

it's not installedI installed it using git and the source

cloud dawn
#

Click on "Add Package" then "From version control" insert https://github.com/Rapptz/discord.py and click ok

rotund bloom
#

because I need v2

#

okay

#

done

cloud dawn
#

Now you got v2 inside the venv.

#

And my literal will most likely work.

rotund bloom
#

but now my slash commands aren't working

cloud dawn
#

Then you are using/ combining other libraries with eachother.

rotund bloom
#

hmm

#

I'll see. But thx at first

cloud dawn
#

Did you use 3th libraries before?

rotund bloom
#

no

cloud dawn
#

How where they working before then? Since 1.7.3 doesn't have anything related to slash.

rotund bloom
#

yes

#

i had v. 2 before and after

cloud dawn
#

Okay, do you have a clue as to why they aren't working?

rotund bloom
#

nope...

cloud dawn
#

Did you get a traceback or just not loading?

rotund bloom
#

I got traseback

cloud dawn
#

Could you paste it here?

rotund bloom
#
Traceback (most recent call last):
  File "C:\Users\Admin\PycharmProjects\Snap\Final2\main-slash.py", line 28, in <module>
    bot = commands.Bot()
TypeError: __init__() missing 1 required positional argument: 'command_prefix'
cloud dawn
#

Ah yeah in 2.0 command prefix is required, if you don't want any prefix you will need to switch to Client.

#

Inside Client Intents is now a required kwarg.

rotund bloom
#

Hmm okay

slate swan
# silk fulcrum

I don't see an issue so I'll gladly ignore that plus light mode ew

pearl shoal
#

!src mute

unkempt canyonBOT
#
Command: tempmute

Temporarily mute a user for the given reason and duration.

Source Code
silk fulcrum
heavy folio
#

ye it has always been required, intents is just a required arg in Client and Bot on 2.0

silk fulcrum
#

intents are required in 2.0

pearl shoal
#
import random
from discord.ext import commands
import timewrap

TOKEN = "e"
client = commands.Bot(command_prefix=';')

@client.event
async def on_ready():
  print(f'{client.user} is on')


@command(aliases=["mute"])
   @ensure_future_timestamp(timestamp_arg=3)
    async def tempmute(
        self, ctx: Context,
        user: UnambiguousMemberOrUser,
        duration: t.Optional[Expiry] = None,
        *,
        reason: t.Optional[str] = None
    ) -> None:
        """
        Temporarily mute a user for the given reason and duration.
        A unit of time should be appended to the duration.
        Units (βˆ—case-sensitive):
        \u2003`y` - years
        \u2003`m` - monthsβˆ—
        \u2003`w` - weeks
        \u2003`d` - days
        \u2003`h` - hours
        \u2003`M` - minutesβˆ—
        \u2003`s` - seconds
        Alternatively, an ISO 8601 timestamp can be provided for the duration.
        If no duration is given, a one hour duration is used by default.
        """
        if not isinstance(user, Member):
            await ctx.send(":x: The user doesn't appear to be on the server.")
            return

        if duration is None:
            duration = await Duration().convert(ctx, "1h")
        await self.apply_mute(ctx, user, reason, expires_at=duration)

client.run(TOKEN)
silk fulcrum
pearl shoal
#

error - File "main.py", line 15
@ensure_future_timestamp(timestamp_arg=3)
^
IndentationError: unexpected indent
ξΊ§
KeyboardInterrupt

pearl shoal
cloud dawn
pearl shoal
#

how

cloud dawn
#

!indention

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

silk fulcrum
#

also 'ensure_future_timestamp' is not defined

#

and command is not defined

pearl shoal
#

i copied from

#

!src mute

unkempt canyonBOT
#
Command: tempmute

Temporarily mute a user for the given reason and duration.

Source Code
cloud dawn
#

Isn't ensure_future_timestamp from annotations?

silk fulcrum
#

πŸ—Ώ

cloud dawn
#

No asyncio

#

Makes sense

silk fulcrum
cloud dawn
#

These days a slash command does the same with 20/30 lines

pearl shoal
#

ctrl z incoming

slate swan
#

Hey can someone help me add choices to my slash commands. I’m using discord.py

cloud dawn
silk fulcrum
#

@pearl shoal you'd better do timeout and not care about anything

shrewd apex
#

tempmute?

slate swan
#

Thanks

shrewd apex
#

300-400 is too much for a mute πŸ’€

rapid knoll
#

how many command prefixes and you have per bot?

cloud dawn
shrewd apex
#

kek message content is going to become privelaged intent πŸ˜”

cloud dawn
#

I don't see why you would need it tbh.

shrewd apex
silk fulcrum
rapid knoll
#

so if I have bot = commands.Bot(command_prefix='/')
i can create another one of these or does it need to be in the same line?

shrewd apex
cloud dawn
silk fulcrum
#

ohkay

golden tapir
#

why error

silk fulcrum
#

because message is int

#

probably it's an ID of message

golden tapir
#
bot.command()
async def purge(ctx, howmany: int):
    message = ctx.message.id
    for i in range(howmany):
      await message.delete()

bot.run(token)
cloud dawn
#

!d discord.TextChannel.purge

unkempt canyonBOT
#

await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=None, bulk=True, reason=None)```
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/latest/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/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.

Changed in version 2.0: The `reason` keyword-only parameter was added.

Examples

Deleting bot’s messages...
golden tapir
#

where would i put it πŸ˜‰

cloud dawn
#

Anywhere you want.

#

I don't know what you want to make.

hushed coral
#

ping the server, by using keep alive

#

you use uptime?

#

hm

#

weird

#

you can use github and Heroku

#

what doesnt work with it?

#

you added on github?

pearl shoal
#
@commands.has_permissions(kick_members=True)
@async def mute(ctx, member : discord.Member):
  muted_role = ctx.guild.get_role(1008014989979815987)

  await member.add_roles(muted_role)
  await ctx.send(f'{member.mention} was muted')

@client.command(aliases=['um'])
@commands.has_permissions(kick_members=True)
@async def mute(ctx, member : discord.Member):
  muted_role = ctx.guild.get_role(1008014989979815987)

  await member.remove_roles(muted_role)
  await ctx.send(f'{member.mention} was unmuted')
#

error - File "main.py", line 16
@async def mute(ctx, member : discord.Member):
^
SyntaxError: invalid syntax

pearl shoal
#

nothng

slate swan
#

reload the page

hushed coral
#

I havent used it in a long time so I am unsure sorry

slate swan
#

you dont need a runtime.txt necessarily tbh

#

but okay

#

what's in the Procfile

limber bison
#

how can i create link behind a text ?

#

for normal text ? by bot

slate swan
#

remove 3, that works for me

#

no requirements.txt?

heavy folio
#

just dont use heroku πŸ’€

#

good

grim oar
#

I think you have to add buildpack from your app on heroku

heavy folio
#

dont use replit and heroku

grim oar
#

Nah you can use heroku if you don't have any other choice but be ready for its own problems

#

Is that requirements.txt?

#

Don't put that second line in there, add buildpack from the site

#

heroku buildpacks:set heroku/python

There's a command line option too apparently, run that ^

slate swan
grim oar
#

Yes

#

Maybe.

pearl shoal
#
async def announce(ctx, member : discord.Member, *, message = None):
  if message == None:
    return

  else:
    embed = discord.Embed(title= "Announcement!", description=message, color = discord.color.Blue)
    embed.set_footer(name=f'Announced by {member.mention}', inline = True)
    await ctx.send(embed=embed)
```error - Ignoring exception in command announce:
Traceback (most recent call last):
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 855, in invoke
    await self.prepare(ctx)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 789, in prepare
    await self._parse_arguments(ctx)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 697, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 552, in transform
    return await self.do_conversion(ctx, converter, argument, param)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 505, in do_conversion
    return await self._actual_conversion(ctx, converter, argument, param)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 451, in _actual_conversion
    ret = await instance.convert(ctx, argument)
  File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/converter.py", line 195, in convert
    raise MemberNotFound(argument)
discord.ext.commands.errors.MemberNotFound: Member "tslo" not found.
#

!src announce

unkempt canyonBOT
#
Bad argument

Unable to convert 'announce' to valid command, tag, or Cog.

#
Command Help

!source [source_item=None]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

pearl shoal
#

any help?

silk fulcrum
pearl shoal
#
async def announce(ctx, *, message = None):
  if message == None:
    return

  else:
    embed = discord.Embed(title= "Announcement!", description=message)
    embed.set_footer(name= (f'Announced by {ctx.author}'), inline = True)
    await ctx.send(embed=embed)

error = Ignoring exception in command announce:
Traceback (most recent call last):
File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 54, in announce
embed.set_footer(name= (f'Announced by {ctx.author}'), inline = True)
TypeError: set_footer() got an unexpected keyword argument 'name'

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

Traceback (most recent call last):
File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/Plague/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: set_footer() got an unexpected keyword argument 'name'

meager chasm
#

If only comprehensive documentation that told you about the parameter name and type existed, so we wouldn't have to guess!

edgy maple
#

whats the difference between lavalink and youtubedl

meager chasm
#

lavalink is an independent webserver, youtubedl is a python package. Both of them violate Youtube's Terms of Service so can't help with them here

sick birch
#

!ytdl applies to lavalink as well

unkempt canyonBOT
#

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

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

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

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

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

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
gusty shard
#
@commands.cooldown(1,10,commands.BucketType.user)
@bot.command(aliases=["cf", "yazitura", "yazΔ±tura"])
async def yt(message, secim:str, sayi:int):
    id = str(message.author.id)
    if id in data:
        if data[id]['cash'] < sayi:
            await message.reply("You dont have that much money.")
        elif sayi <= data[id]['cash']:
            sonucstr = ["heads", "tails"]
            sonuc = random.choice(sonucstr)
            if secim[0].lower() == sonuc[0].lower():
                if data[id]['inv']['boosts']['boost'] == 5:
                    data[id]['cash'] += sayi * 6
                    embed=discord.Embed(title=f"SonuΓ§ {sonuc} geldi",color=0xfbff00)
                    embed.add_field(name=f"You won {sayi} :pcoin:.", value=f"You got extra {sayi*5} :pcoin: with level 5 boost.", inline=True)
                    await message.reply(embed=embed)
                elif data[id]['inv']['boosts']['boost'] == 4:
                    sayi2 = sayi/2
                    data[id]['cash'] += sayi * 2 + sayi2
                    embed=discord.Embed(title=f"Coin lands on {sonuc}",color=0xfbff00)
                    embed.add_field(name=f"You won {sayi} :pcoin:.", value=f"You got 4 extra {sayi + sayi2} :pcoin: with level 4 boost", inline=True)
                    await message.reply(embed=embed)
                else:
                    embed=discord.Embed(color=0xfbff00)
                    embed.add_field(name=f"Coin lands on {sonuc}.", value=f"You won :pcoin:.", inline=True)
            else:
                embed=discord.Embed(color=0x740202)
                embed.add_field(name=f"Coin lands on {sonuc}.", value=f"You lost :pcoin:.", inline=True)
                await message.reply(embed=embed)
                data[id]['cash'] -= sayi

            with open("values.json", "w") as f:
                json.dump(data,f,indent=4)
    else:
            await message.reply("You dont have an accout yet")
@yt.error
async def yt_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown):
        await ctx.reply('wait `{e:.1f}` sec.'.format(e = error.retry_after))```
#

i dont know why but user always wins

#

the sonuc is always being equal to the secim

#

can somebody help me please?

pearl shoal
#

can we send a msg like a embed and after that there is a ping?

gusty shard
pearl shoal
#

i wanna ping everyone as its an announcement cmd

slate swan
#

i need help

#

so

#

im making a add role command and i want it to ad d arole to a user just a single one b ut idk how to make it work ive tried so many things

#
@client.group(invoke_without_command=True)
async def help(ctx):
    embed=discord.Embed(title="Help Commands", color=Color.green)
    embed.add_field(name="Mderation", value="!help Moderation", inline=True)
    embed.add_field(name="Other", value="!help other", inline=True)
    embed.add_field(name="Neutral", value="!help Neutral", inline=True)
    embed.set_footer(text="For a more in-depth explination on each command, simply type `!help <command>` (replace <command> with the command you want help with)")
    await ctx.send(embed=embed)```

nothing is being sent, why?
#
  @app_commands.command(name="premium", description="premium role")
  async def premium(self, interaction: discord.Interaction,member: discord.Member):
      if interaction.user.guild_permissions.ban_members == True:
          embed = discord.Embed(description=f"premium has been added to {member.mention}",color=color.color)
          await interaction.response.send_message(embed=embed)
``` this is the cmd
vocal snow
#

Where's the part where you're adding a role

pearl shoal
vocal snow
#

There is no ctx

slate swan
slate swan
pearl shoal
#

i replied to wring person

#

i wanted to reply to myself''

gusty shard
#

you can just add @everyone on your string

#

@pearl shoal

pearl shoal
#

we cant do pings ib embed

gusty shard
gusty shard
pearl shoal
gusty shard
#
await message.channel.send(embed=embed)
await message.channel.send("@everyone")```
slate swan
#

lol

pearl shoal
#

thanks

gusty shard
slate swan
slate swan
#

make sure the bot has perms

pearl shoal
#

hm

sick birch
slate swan
pearl shoal
sick birch
slate swan
#

ik i tried it it didnt owkr for me

sick birch
#

What did you try and how did it not work for you?

pearl shoal
#

can we send a msg like a embed and after that there is a ping?

tidal hawk
#

is there a way to pass state to discord's oauth2 and redirect the user to specific uri endpoint after authorizing himself?

rapid knoll
#

how do you create that reaction thing for discord bots, when you click the reaction you can get custom roles or something else

sick birch
tidal hawk
#

damn

sick birch
#

But the redirect URL should be part of the URL

#

It's required to pass it in

pearl shoal
#

!src autorole

unkempt canyonBOT
#
Bad argument

Unable to convert 'autorole' to valid command, tag, or Cog.

#
Command Help

!source [source_item=None]
Can also use: src

Display information and a GitHub link to the source code of a command, tag, or cog.

gusty shard
tidal hawk
#

i just want to redirect the user to SAME endpoint after authorizing himself

pearl shoal
#

didntwork

gusty shard
#

can you send the whole code

sick birch
#

It's on_reaction_add

tidal hawk
sick birch
#

Though this only works for cached messages, so on_raw_reaction_add may be a better alternative

gusty shard
sick birch
pearl shoal
sick birch
sick birch
tidal hawk
#

say i'm on address: localhost:3000/<guild_id> and then do the oauth2 process and then send the user back to /<guild_id>

#

it's so sad ffs

sick birch
#

Ah. No, that's not possible I'm afraid

#

But it should just be a minor nuisance rather than a major functionality problem

#

Though, erm, if you're laying out your site properly.. how would you get to localhost:3000/<guild_id> without first authorizing yourself with Oauth2?

pearl shoal
#

?

slate swan
#

python.default.role awkward

zealous jay
#

uuuh Im suddenly getting this error...
Exception has occurred: AttributeError 'client' object has no attribute 'tree'

class client(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()
        intents.members = True
        super().__init__(
            command_prefix ='.',
            intents = intents,
            owner_id = 394138910508449792,
            application_id = os.getenv('BOT_ID'))
        self.synced = False
    
    async def setup_hook(self) -> None:
        self.session = aiohttp.ClientSession()

        target_dir = Path.cwd() / 'cogs'

        for cog in target_dir.rglob('*.py'):
            await self.load_extension(f'cogs.{cog.parent.name}.{cog.stem}')

        await cltree.sync(guild=discord.Object(770698123915165747))
        self.synced = True
        print('All commands are now synced.')

    async def on_ready(self):
        await self.change_presence(
            status=discord.Status.online, 
            activity=discord.Activity(type=discord.ActivityType.watching, 
            name=f'{len(self.guilds)} servers! | g!help'))
        print(f'Logged in as {self.user} (ID:{self.user.id})')

aclient = client()
cltree = aclient.tree

load_dotenv()
aclient.run(os.getenv('TOKEN'))            

I know that it shouldn't be named client...

sick birch
#

No, you need to have a discord.Guild instance. Be that ctx.guild, interaction.guild, or obtain it somehow from any event

pearl shoal
#

wow i really dont undersrtand

#

sad

sick birch
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
zealous jay
#

πŸ€¦β€β™‚οΈ

#

wait im confused

#

what do I need to define

sick birch
#

You can't use it if you haven't defined it

wanton cipher
#

I don't used discord.py anymore, but I just pulled up the docs, it's part of commands.Bot

sick birch
#

commands.Bot does have a default built in tree, yes. If you're using client, you'll have to do it manually

zealous jay
#

I would swear this used to work

#

like I haven't touched the code

wanton cipher
sick birch
zealous jay
#

oh yeah sorry

sick birch
#

Which version are you on?

zealous jay
#

I added this at the end but maybe I should have mentioned

zealous jay
sick birch
zealous jay
#

oh I found the error

#

i moved the code to another folder

#

and its not initiating the .venv, so its using an old d.py version

wanton cipher
#

lel

sick birch
#

That would explain it

zealous jay
#

thanks haha

wanton cipher
#

yw ig? xD

zealous jay
#

and I should probably change client to bot

wanton cipher
#

please xD

vocal snow
#

Bot, not bot

zealous jay
#

yeah

rapid knoll
#

how do you get a discord bot to edit its own messages

tidal hawk
#

bot has to take message obj and then use edit method

slate swan
#

my on_message event don't let my commands work

wanton cipher
slate swan
zealous jay
#

make it a listener

wanton cipher
#

!d discord.ext.commands.Bot.process_commands

unkempt canyonBOT
#

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

This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.

By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.

This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").

This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.

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

ty

sick birch
#

It'd be very helpful if we can see the code

rapid knoll
# sick birch You're probably forgetting to await something

The Code is for my reporting system

@neonnix.command()
async def report(ctx, Member: discord.Member, reason):
    message = ctx.send(f"Reporting Member {Member}")
    await message
    channel = neonnix.get_channel(1007993775840309298)
    embed = discord.Embed(title=f"{Member} Has been reported by {ctx.message.author}", description=f"Reason For: {reason}\nRank of Member Reporting: {ctx.message.author.top_role}\nRank of Reported Member: {Member.top_role}")
    await channel.send(embed=embed)
    await neonnix.change_presence(activity=discord.Streaming(name='Discord', url='https://www.twitch.tv/neonnix_live'))
    await asyncio.sleep(5)
    await message.edit(content="Reported Member")
    await message
zealous jay
sick birch
zealous jay
#

oh wrong reply

wanton cipher
#

ngl, didn't even know you can do awaits like that xD

sick birch
#

The better alternative would be to do this:

message = await ctx.send(...)
await message.edit(...)
slate swan
zealous jay
#

this hurts

wanton cipher
#

my brain go melt

sick birch
#

Useful for things like callbacks

silk fulcrum
#

how is it even possible?

sick birch
#

It's very possible

silk fulcrum
#

what

sick birch
#

Like I mentioned, higher order functions work for coroutines as well

silk fulcrum
#

won't ctx.send(..) raise an error?

sick birch
#

!e

async def coroutine():
  ...
print(type(coroutine()))
unkempt canyonBOT
#

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

001 | <string>:3: RuntimeWarning: coroutine 'coroutine' was never awaited
002 | RuntimeWarning: Enable tracemalloc to get the object allocation traceback
003 | <class 'coroutine'>
sick birch
#

Aside from that warning, you can see it's type

silk fulcrum
#

!e ```py
async def func():
print('yeah, it's async cus yes')

do = func()
await do```

unkempt canyonBOT
#

@silk fulcrum :x: Your 3.11 eval job has completed with return code 1.

001 |   File "<string>", line 5
002 | SyntaxError: 'await' outside function
silk fulcrum
#

woops

sick birch
#

Top level await when

zealous jay
#

lol

silk fulcrum
#

well it doesnt raise an error at do = func()

#

so that is possible

#

python are you crazy?

sick birch
#

It's nothing crazy, I assure you

wanton cipher
#

isn't it kinda like making a func then calling it later?

silk fulcrum
#

i understand smth like py if smth: strategy = ctx.send else: strategy = ctx.reply await strategy(content)

#

but not that

gleaming anvil
silk fulcrum
#

wait what

#

new sarth?

gleaming anvil
#

kinda yeah, that account was distracting so i just disabled it :p

silk fulcrum
#

@slate swan no he is here

#

what

#

lmao ok i didnt understand anything

gleaming anvil
#

anyways

#

!e async def foo():...;
print(type(foo), type(foo()))

unkempt canyonBOT
#

@gleaming anvil :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | <string>:2: RuntimeWarning: coroutine 'foo' was never awaited
002 | RuntimeWarning: Enable tracemalloc to get the object allocation traceback
003 | <class 'function'> <class 'coroutine'>
gleaming anvil
#

the difference between those two things

slate swan
#
async def order(ctx):
  if ctx.channel.name.startswith("ticket") == True :
    TheChoice = await ctx.send ("**Please choose one from our services\nVPS : :red_circle:\nRDP : :green_circle:\nMTA : :yellow_circle: **")
    TheEmoji = discord.Client.get_emoji(self ,id=919399790410866689)
    await TheChoice.add_reaction(TheEmoji)```
#

what's the error ?

shrewd apex
slate swan
#
  File "main.py", line 23, in order
    TheEmoji = discord.Client.get_emoji(self ,id=919399790410866689)
NameError: name 'self' is not defined```
hard hinge
#

Hi, i have adiscord.py 2.0 issue:

SLash command works, but still says "Application did not respond" but it did respons, what can i do?

slate swan
#

so

hard hinge
shrewd apex
slate swan
#

remove self

shrewd apex
#

so it's bot.get_emoji()

slate swan
hard hinge
shrewd apex
#

what's your bot object here use that

cloud dawn
#

The most cursed language on the planet.

hard hinge
#
@tree.command(name = "ad_leaderboard", description = "Leaderboard-embed", guild = discord.Object(id = 979395371992240198))
async def self(interaction: discord.Interaction, pagina: int):
    p = 0
    p = pagina
    p = p - 1
    e = levelLeaderboard(p)
    if e is None:
        await interaction.channel.send("Er ging iets mis. Oepsie!")
    else:
        await interaction.channel.send(embed=e)```
hard hinge
shrewd apex
#

why u name it selfπŸ‘€

hard hinge
hard hinge
cloud dawn
hard hinge
#
def levelLeaderboard(p):
    global cursor
    cursor.execute("SELECT id, lvl, xp FROM Users ORDER BY xp DESC")
    users = cursor.fetchall()

    embed = discord.Embed(title='ADTG XP Leaderboard, page ' + str(p + 1), color=discord.Color.green())
    
    i = 0;
    i = i + 10 * p
    p = (p+1) * 10
    if i >= len(users):
        embed = discord.Embed(title="Zoveel pagina's hebben we niet.", color=discord.Color.red())
        return embed
    
    while i < p and i < len(users):
        text = "level: " + str(users[i][1]) + ", total xp: " + str(users[i][2])
        if (client.get_user(users[i][0])):
            name = client.get_user(users[i][0]).name
            print(name)
            embed.add_field(name=name, value=text, inline=False)
        else:
            embed.add_field(name="Onbekend", value=text, inline=False)
        i = i + 1
    
    return embed```

This one
shrewd apex
#

and pagina sus πŸ‘€

hard hinge
slate swan
cloud dawn
#

🀏

shrewd apex
#

sync db

slate swan
#

global cursor

cloud dawn
hard hinge
#

But can i fix the not responding issue?

shrewd apex
cloud dawn
cloud dawn
shrewd apex
#

ok

slate swan
cloud dawn
slate swan
#

I dont even like for loops

#

I just like list comps but still for loop but okay

cloud dawn
cloud dawn
hard hinge
#

Fixed it

slate swan
#

nice

shrewd apex
#

πŸŽ‰

hard hinge
#

In stead of: await interaction.channel.send i did: await interaction.response.send_message

cloud dawn
#

@hard hinge Checking out your website and... about me, Ik vindt is not grammatically correct.

hard hinge
slate swan
#

jeez, panda chill

hard hinge
cloud dawn
cloud dawn
hard hinge
#

It's MySQL db πŸ™‚

cloud dawn
# hard hinge It's MySQL db πŸ™‚

Ah, well then you are in for a treat... Python doesn't really offer great support for Mysql since it's meant for websites. Since Discord bots are in a async environment it's best to make as much as possible async. An async database module does increase performance.

cloud dawn
slate swan
#

hi

#

does anyone have an example of an on click event?

cloud dawn
slate swan
slate swan
cloud dawn
cloud dawn
#

It's inside the root named "examples".

shrewd apex
#

disnake discord nextcord replace names and u will be fine 99.99% of the time

sick birch
#

And I think most are community made

cloud dawn
shrewd apex
#

pfft

cloud dawn
#

jkπŸ˜‚

#

dont kill me plz

shrewd apex
#

that was like epic plot twist

sick birch
shrewd apex
#

cya panda πŸ‘€

torn sail
#

what should I use to get the translations for slash cmd localizations

torn sail
#

ok thanks. i was probably gonna use that but it would take a long time cause ratelimits

cloud dawn
torn sail
#

yeah i looked a lot

cloud dawn
#

It does make sense since it's not a lightweight task.

slate swan
#

don't have what i need

torn sail
#

i originally used google translate but it figuired out im a bot

cloud dawn
shrewd apex
#

u could use a lib ig

torn sail
#

so i guess ill do that

#

i saw that

shrewd apex
#

i keep forgetting my packages

slate swan
#

that's yours?

shrewd apex
shrewd apex
torn sail
#

well i only looked at google but i didnt notice the 10 others

slate swan
#

,

torn sail
#

thanks

shrewd apex
#

i ain't got patience to make wrapper for so many APIs i just use ready made ones

cloud dawn
shrewd apex
slate swan
shrewd apex
unkempt canyonBOT
#

deep_translator/deepl.py lines 28 to 32

"""
@param api_key: your DeeplTranslator api key.
Get one here: https://www.deepl.com/docs-api/accessing-the-api/
@param source: source language
@param target: target language```
cloud dawn
torn sail
#

oop

shrewd apex
#

yeah api key is free

torn sail
#

ohk

cloud dawn
shrewd apex
#

deepl has few translations better than Google

slate swan
#

can someone help me make a give role cmd?

shrewd apex
#

thats why i still recommend deepl in few cases

shrewd apex
cloud dawn
#

tbf for 6 bucks a month you get unlimited translations but who uses translations anyways.

slate swan
#

can someone help me make a give role cmd?

torn sail
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

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

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

where they provide services

cloud dawn
#
await member.add_roles([role for role in guild.roles])
slate swan
cloud dawn
slate swan
#

there isnt

#

its a one server bot

shrewd apex
#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Changed in version 2.0: The `iterable` parameter is now positional-only.

Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
slate swan
#

im not good w reading docs 😭

cloud dawn
#

You didn't even try or you read crazy fast.

sick birch
cloud dawn
#

Click on the blue link on top of the embed to see more info.

slate swan
#

Do the run command works for accounts tokens or just bots ?

sick birch
limber bison
#

any suggetion for poll command

#

?

#

hmmmmmmmmmmmmmmm

#

buttons vc emojis ?

torn sail
#

emojis make it so you can easily see the amount of votes but i like buttons cause they look better

slate swan
#
  @app_commands.command(name="premium", description="premium role")
  async def premium(self, interaction: discord.Interaction,member: discord.Member):
      if interaction.user.guild_permissions.ban_members == True:
          Role = discord.utils.get(member.guild.roles, name="premium")
          await self.client.add_roles(member, Role)
          embed = discord.Embed(description=f"premium has been added to {member.mention}",color=color.color)
          await interaction.response.send_message(embed=embed)```
error 

Traceback (most recent call last):
File "/home/runner/donate/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 655, in _do_call
return await self._callback(self.binding, interaction, **params) # type: ignore
File "/home/runner/donate/cogs/config.py", line 54, in premium
await self.client.add_roles(member, Role)
AttributeError: 'Bot' object has no attribute 'add_roles'

slate swan
#

im adding it to a mem ber

#

well then you would use the member argument and not your bot

vocal snow
#

(add_roles is a method of Member, not Bot)

slate swan
#

TL;DR^

#

i need help this is not working

sick birch
slate swan
#

i dont get it, kinda get it but not rlly

sick birch
#

!d discord.Member.add_roles this is how you add role to a member

unkempt canyonBOT
#

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

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

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

My brain is kinda small could someone explain why this is broken

zealous jay
#

why was interaction.edit_original_message() changed to interaction.edit_original_response()?

slate swan
#

Can the bot be ran on an account ?

zealous jay
#

its against discord TOS

slate swan
#

?

silk fulcrum
sick birch
zealous jay
#

makes sense πŸ˜…

sick birch
#

Me and @smoky cedar (sorry for ping) had this issue a while ago

#

It took us a solid 10 minutes to figure out that edit_original_message did in fact, edit the response

zealous jay
#

bruh

hard hinge
#

@tree.command(name = "ad_leaderboard", description = "Leaderboard-embed", guild = discord.Object(id = 979395371992240198))
I need this, but then for all the server the bot is in, how can i do that? πŸ™‚

sick birch
#

Because, for example, how would you edit_original_message of a slash command?

#

There is no original message that the interaction originated from, similar to how a button or a select menu originates from a message

zealous jay
#

right

hard hinge
sick birch
zealous jay
#

o

hard hinge
zealous jay
#

was about to ask if he needed that πŸ›Œ

hard hinge
#

I appriciate (idk how to write it) very mutch! πŸ™‚

sick birch
#

No worries, I get what you mean πŸ˜„

slate swan
cloud dawn
hard hinge
#

Thanks

scarlet widget
#

how do I make the bot send an embed message?

slate swan
#

if "lol" in message.content.lower():
with open("lol.txt", "w+") as f:
f.write(f"{message.content}\n")
f.close()
print("lolreceived")

#

it keeps overlapping

scarlet widget
slate swan
scarlet widget
#

im using discordpy

slate swan
#

ok

silk fulcrum
unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, 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.

x == y Checks if two embeds are equal.

New in version 2.0...
slate swan
#

just make embed a variable

slate swan
#

then a.add_field(name=)

silk fulcrum
scarlet widget
#

thanks

silk fulcrum
#

why did it "``" 😳

scarlet widget
#

what does url mean

silk fulcrum
#

url where?

slate swan
slate swan
#

url is if you wanna make it clickable into link

slate swan
silk fulcrum
#

url for title

scarlet widget
#

How does it know what channel to send it to

silk fulcrum
#

are you making a command?

slate swan
#

channel = bot.get_channel(channelid)

scarlet widget
#

No I just want the bot to send an embed

slate swan
#

await channel.send(embed=em)