#discord-bots

1 messages ยท Page 1126 of 1

dull terrace
#

you see 2x as much code on the screen

#

which is useful when your code is thousands of lines long

slate swan
#

you can just zoom out

#

meh personally I use the awesome zoom out/scrolling feature

#

Or just lower the font size

dull terrace
#

how small are you guys making the text smh

slate swan
#

Or just use shortcuts

slate swan
#

yeah, i dont see any use of a vertical monitors until you're using it with your main desktop for multitasking

slate swan
paper sluice
#

i just zip code ๐Ÿ˜ถ

slate swan
#

MonoLisa as font

dull terrace
#

if you have a horizontal monitor literally half your screen isn't used

slate swan
#

Victor Mono :>

slate swan
#

Well not my case, maybe for others

dull terrace
#

horizontal

slate swan
#

bro

dull terrace
#

vertical

slate swan
#

just split the vscode tabs, you can work on 2 files at a time that way ez

paper sluice
slate swan
#

Who puts their code editor on the entire screen/have only one file opened?

dull terrace
slate swan
#

Right is for stack overflow and left for the editor KEKW

slate swan
paper sluice
slate swan
#

replit users: hold my vertical console

dull terrace
#

i'm using atom ๐Ÿ˜ค

slate swan
#

ded editor

dull terrace
paper sluice
slate swan
#

Nice

#

hello, i am using the character ` to make text look like this in my embed: example. my problem is it ends the line. how do i fix this?

slate swan
#

heres my code:

 embed = discord.Embed(title="![verification](https://cdn.discordapp.com/emojis/990970861823615050.webp?size=128 "verification") Hello! Are you human? Let's find out!", description="`blablabla`

**Additional Notes:**

:white_check_mark: line

:sos: line", color=discord.Colour.blue())```
paper sluice
#

that should work

dull terrace
#

how tf are you doing the description like that without triple quotes

slate swan
paper sluice
slate swan
#

MD?

dull terrace
#

markdown

paper sluice
#

markdown

slate swan
#

markdown?

slate swan
dull terrace
paper sluice
slate swan
paper sluice
slate swan
paper sluice
#

u mightve seen it in a github README.md

slate swan
#

^^

slate swan
paper sluice
slate swan
slate swan
slate swan
dull terrace
#

wish they'd add some colour options for text

pliant gulch
slate swan
#

Not without code blocks

dull terrace
pliant gulch
#

ANSI is not syntax highlighting

#

Not really at least

paper sluice
slate swan
#
  File "main.py", line 3, in <module>
    import QR_Generator
  File "/home/runner/ballero/QR_Generator.py", line 32, in <module>
    driver = webdriver.Chrome(options=options)
  File "/home/runner/ballero/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/home/runner/ballero/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
    self.service.start()
  File "/home/runner/ballero/venv/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home```
#

what is this?

#

im on replit so idrk what to do here

#

It is syntax highlighting

#

dont think this channel is selenium related

paper sluice
slate swan
#

ANSI provides for example syntax highlighting for terminals that support them

#

which channel should i go in

slate swan
slate swan
#

it does

paper sluice
#

huh?

slate swan
#

ive been doing this without any problem

#

and got this error after trying the embed fix

slate swan
dull terrace
slate swan
#

remember that it doenst work on phones as for now

paper sluice
#

ansi doesn't render properly on discord

slate swan
#

It looks beautiful on my phone LUL

paper sluice
#

sometimes it shows, sometimes it doesn't

slate swan
#

At least for me it works perfectly fine all the time

dull terrace
#

yeah i was gonna say i just experimented with it and it doesn't work

pliant gulch
#

Most of the colours aren't supported by discord though, I'm speaking of the 255 colour codes

slate swan
#

Probably not discord that doesn't support it, but the library they're using

pliant gulch
#

I only got the basic colours to work when making my ANSI code block builder

paper sluice
velvet compass
#

Discord can accept rgb codes with discord.Color.from_rgb()

pliant gulch
#

I'm talking about ANSI codeblocks

velvet compass
#

ooo

slate swan
#

Color is an alias tho

#

it just doesnt show up on the docs though

velvet compass
#

Biggest mistake of my life was using colour in the .color command

slate swan
#

oh wait it's a thing

#

not just documented

slate swan
velvet compass
#

The British too

slate swan
slate swan
#

disnake has 5 aliases for the same class, but that isnt documented

slate swan
slate swan
slate swan
unkempt canyonBOT
#

disnake/interactions/application_command.py lines 518 to 525



# People asked about shorter aliases, let's see which one catches on the most
CommandInteraction = ApplicationCommandInteraction
CmdInteraction = ApplicationCommandInteraction
CommandInter = ApplicationCommandInteraction
CmdInter = ApplicationCommandInteraction
AppCommandInteraction = ApplicationCommandInteraction```
slate swan
slate swan
#

thanks for letting me know but i'll still use it

#

have fun

#

Hi what's the topic going on?

#

why no document alias

slate swan
vocal magnet
slate swan
slate swan
heady sluice
#

if color is pointing to colour, you basically waste a wee bit of ram there, innit

#

in exchange for a byte

slate swan
slate swan
heady sluice
#

if that shit's used 845405464 times, you're going to spare 845405464x the amount of ram

slate swan
#

stop using ctx.send then, its literally redirects you to ctx.message.channel.send with extra calls

heady sluice
#

I've been literally telling that to everyone

#

wait what

slate swan
#

Meanwhile bad code practice in other locations in your code makes it use twice the saved amount of RAM.

heady sluice
#

that sounds like mad cap

modern rune
#

not sure if it's me, but why is there no comprehensive guide or book about making a discord bot with python? the only thing available is basically pycord's guide

heady sluice
#

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

deep osprey
#

How to color the title of the embed?

slate swan
#

You don't because you can't, besides "blue" which is for a link

heady sluice
#

where redirect

#

oh msg = await self.interaction.followup.send(**kwargs, wait=True)

#

but that spares you more bytes if you use ctx.send

#

choose sides

slate swan
#

I choose another language

heady sluice
#

choose hungarian

slate swan
#

i choose hikari and use rest directly

deep osprey
slate swan
heady sluice
#

yes

heady sluice
# heady sluice yes

but in order to make those sentences, you have to go through 1646161 grammatical rules first

slate swan
#

Nice

heady sluice
#

which uses ram

#

but you use less bytes

slate swan
#

write your code with _s and integers ez

paper sluice
#

write binary ๐Ÿ’€

deep osprey
#

How to check if the argument of the command is NULL ?

heady sluice
slate swan
#

Hello, Is it possible to send messages through the console? I have a say command but itd be cool to send msgs in console too

#

It will never be "null"

slate swan
slate swan
paper sluice
slate swan
#

Not to the console

#

lmao

deep osprey
slate swan
#

so anyone know?

heady sluice
#

that's just not possible

slate swan
heady sluice
#

or do you have an async input?

paper sluice
slate swan
deep osprey
slate swan
#

Then it will never be None if it's required

paper sluice
slate swan
#

That's the point of a required argument

slate swan
#

It will throw an error if you don't supply the argument

deep osprey
#

discord.ext.commands.errors.MissingRequiredArgument: arg is a required argument that is missing. I want to handle this error via the discord server, To send the user that the argument is missing(or any msg)

paper sluice
slate swan
#

There we go, the XY problem

slate swan
#

There is a guide on the documentation of discord.py

slate swan
#

It probably is possible yeah

paper sluice
deep osprey
austere vale
#
  @commands.Cog.listener()
  async def on_member_join(self,member:nextcord.Member):
    embed=nextcord.Embed(color=0xfd9fa1, description= f'{member.mention}{member.name}{member.discriminator}', title='Member Joined')
    if member.avatar is None:
        embed.set_thumbnail(url=member.default_avatar,
        icon_url=f'{member.default_avatar}')
        embed.set_footer(text=f'{member.guild}', icon_url=f'{member.guild.icon.url}')
    else:
        embed.set_thumbnail(url=member.avatar.url)
        embed.set_author(name=f'{member.name}', icon_url=f'{member.avatar.url}')
        embed.set_footer(text=f'{member.guild}', icon_url=f'{member.guild.icon.url}')
    embed.timestamp=datetime.datetime.utcnow()
    await self.bot.get_channel(933978399280599080).send(embed=embed)

could someone help me please?

slate swan
slate swan
slate swan
#

You can make a say command and lock it for specific people only, yes

austere vale
blissful sparrow
#

Does anyone know of a way to get bot to send an entire mysql table into a chat?

slate swan
austere vale
#

thank you

paper sluice
slate swan
#

oh no no no

slate swan
slate swan
paper sluice
slate swan
#

but it would be a list of tuples

#

I guess you can just make a background task

#

why cant they get the input from discord itself? like a cmd argument

#

And wait for input in console forever, then just send

blissful sparrow
slate swan
#

Iteration

#

Then format it like you want

slate swan
#

It would, you can most likely make the bot normally and add a new background task to wait for any input from the console

#

Never tried in Python as I stopped coding on it, but works on other languages that have asynchronous ferrures

#

I guess the same works for python with asyncio or similar

slate swan
# slate swan It would, you can most likely make the bot normally and add a new background tas...
from discord.ext.commands import slash_command
from discord.ext import commands
from discord.ext.commands import Cog
import discord
from discord.ext import bridge

class sayo(commands.Cog):
  def __init__(self, bot):
    self.bot = bot
import discord
import asyncio
from discord.ext import tasks


class MyClient(discord.Client):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    async def setup_hook(self) -> None:
        # create the background task and run it in the background
        self.bg_task = self.loop.create_task(self.my_background_task())

    @tasks.loop(seconds=60)  # task runs every 60 seconds
    async def my_background_task(self):
        channel = self.get_channel(965533467557371947)  # channel ID goes here
        self.counter += 1
        await channel.send(self.counter)
def setup(bot):
  bot.add_cog(sayo(bot)) ``` I tried this, but nothing happens
#

no errors either

#

just mostly example code from github too

#

Yeah no, you most likely have to create 2 background tasks running asynchronously. One for the normal bot which doesn't interact at all with the console input and one waiting for your console input forever which will then be sent via the bot or the Discord API directly.

#

alr, any idea how i can do this?

#

Create those two background tasks

#

With asyncio I believe, just don't search specifically for Discord bots

#

    async def my_background_task(self):
        await self.wait_until_ready()
        counter = 0
        channel = self.get_channel(1234567)  # Your channel ID goes here
        while not self.is_closed():
            counter += 1
            await channel.send(str(counter))
            await asyncio.sleep(60)  # This asyncio task runs every 60 seconds``` this is one of the examples
#

part of it

#

Just search for an overall way to create background tasks

#

Not specifically for bots

#

Your tasks won't run in a cog I believe

#

Whys that?

#

Just 2 basic background tasks with asyncio that have nothing to do with each other

#

One will be responsible to make the bot online and work like before

#

The other one will just let you send text in the console and handle it

#

I already have bot.run(os.getenv('TOKEN'))

#

Yeah that's not running in the background

#

so if i converted that to a task?

#

Not asynchronously

#

Forget about tasks, that's specific to discord bots once they're online

#

You need 2 "functions" running simultaneously so that your bot goes online

#

and so that you can read text sent in console

#

Then the stuff about the console will be completely isolated

#

So you'd probably need to make requests to the API directly

#

If you don't understand the best is to go for a "say" command that would be like

!say Hello world
and the bot sends that message.
There is an example on how that would work in the discord.py documentation

bleak atlas
#

Can someone help with this error? disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"

swift pumice
#
@commands.cooldown(1,5, commands.BucketType.member)
@commands.has_role("gott")
async def invite(ctx):
    if ctx.channel.id != 984872910961405963:
        em = nextcord.Embed(title=f"You cant use this command here",description=f"Use the command please in [#984872910961405963](/guild/267624335836053506/channel/984872910961405963/).", color=0x00ff00)
        await ctx.send(embed=em,delete_after=8)
    else:
        link = await ctx.channel.create_invite(max_age = 0, max_uses=0)
        await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")``` why isnt this working? like everything works. just i want that the role gott can use the command anywhere in any channel. but it still answers with _you cant use this command here_ does anyone of you guys have answer? (there isnt an error in the console too)
deep osprey
#

How to set on_command_eror for a specific command? like each command that got same error but different replies

torn sail
swift pumice
bleak atlas
#

Can someone help with this error? disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"

swift pumice
torn sail
swift pumice
swift pumice
deep osprey
bleak atlas
#

Anyone can help with this error? disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"

scarlet sorrel
#

Hello! question: if i have an unrelated file that isn't a discord bot, but i just want to send a string to discord when i get to a certain part of that file, whats the best way to send the message without disrupting the rest of the file? do you need to be inside a @client.event to be able to send a message using discord api?

bleak atlas
#

Ight

bleak atlas
# torn sail show full traceback

Traceback (most recent call last):
File "/home/mrkitty/.local/lib/python3.10/site-packages/disnake/ext/commands/bot_base.py", line 578, in invoke
await ctx.command.invoke(ctx)
File "/home/mrkitty/.local/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 914, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/mrkitty/.local/lib/python3.10/site-packages/disnake/ext/commands/core.py", line 181, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"

slate swan
torn sail
#

yeah

slate swan
#

So without showing what statement you wrote/arguments you gave, nobody can help

bleak atlas
scarlet sorrel
bleak atlas
# slate swan So without showing what statement you wrote/arguments you gave, nobody can help

``@client.command(description="Sets up the bot. ")
@commands.has_permissions(administrator=True)
async def setup(ctx, mode: str):
guildId = ctx.message.guild.id
guild = client.get_guild(guildId)
print(guildId)
connection = sqlite3.connect('database.db')
cursor = connection.cursor()
if mode == 'logging':
print('yes')
logging_embed = disnake.Embed(color = disnake.Color.blue(),title = 'Logging setup', description = 'Enter the ID of your logging channel.')
await ctx.send(embed=logging_embed)
logging_id = ctx.message.content
ctx.send('Done, set logging ID. ')
print(logging_id)

name = 'a' + str(guildId)
#cursor.execute(f"CREATE TABLE {name} (id INTEGER)")
cursor.execute(f"INSERT INTO {name} VALUES({logging_id}) ")
print(cursor.fetchall()) ``
#

And I'm running !setup logging

#

The prefix is !

#

I'm trying to put it in a database at the end

slate swan
#

Well your insert is at the wrong place

#

logging_id won't be visible in the outer scope of your if statement

sick panther
slate swan
#

And you don't need to get_guild, you already have it with ctx.(message).guild

#

How to put a GIF in an embed?

bleak atlas
#

@slate swan Okay, and how can I have the logging id visible?

sick birch
#

Also don't use sqlite3

#

Use aiosqlite instead

slate swan
#

Put it inside the if statement

scarlet sorrel
#

hey @sick birch whats up

slate swan
sick panther
#

Oh damn, well that's my alt

sick birch
scarlet sorrel
scarlet sorrel
bleak atlas
#

@slate swan I moved it to the if statement, but still get the token error...

sick birch
#

don't even need a module for it

#

It should be a simple POST request to the right endpoint

scarlet sorrel
#

is there docs for that?

slate swan
scarlet sorrel
#

all i want to do is send a string to a channel id so it should be super simple

slate swan
#

Make a POST request to the endpoint with the appropriate header (Authorization: Bot <token>) and the appropriate fields.

slate swan
#

๐Ÿ˜”

#

Absolutely no need to use a discord API wrapper for such a simple thing

sick birch
scarlet sorrel
sick birch
#

In the request headers

scarlet sorrel
#

could you give a tiny example ๐Ÿฅบ๐Ÿฅบ๐Ÿฅบ

#

my brain is soft ๐Ÿ˜ฉ

deep osprey
#

How to say the command name in a message?

slate swan
slate swan
slate swan
slate swan
#

Well you can, just horrible

#

a rest only bot lol

woven summit
#

Hello, I have a quick question, I'm trying to install discord.py using (pip install -U discord.py) but I have this error, I'm using vscode as editor, pip version (pip 22.1.2), and python version (python 3.9) any suggestions on how to fix this issue?

slate swan
#

its already been done

scarlet sorrel
deep osprey
slate swan
#

since its not connected to the gateway it just doesnt receive any gateway events

sick birch
slate swan
pliant gulch
swift pumice
#
@commands.cooldown(1,5, commands.BucketType.member)
@commands.has_role("gott")
async def invite(ctx):
    if ctx.channel.id != 984872910961405963:
        em = nextcord.Embed(title=f"You cant use this command here",description=f"Use the command please in [#984872910961405963](/guild/267624335836053506/channel/984872910961405963/).", color=0x00ff00)
        await ctx.send(embed=em,delete_after=8)
    else:
        link = await ctx.channel.create_invite(max_age = 0, max_uses=0)
        await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")``` why isnt this working? like everything works. just i want that the role gott can use the command anywhere in any channel. but it still answers with _you cant use this command here_ does anyone of you guys have answer? (there isnt an error in the console too)```
sick birch
deep osprey
#
@bot.event
async def on_command_error(ctx,error):
    if isinstance(error,commands.MissingPermissions):
      await ctx.author.send("You are not authorized to use this command!")
      await ctx.message.delete()
    if isinstance(error, commands.MissingRequiredArgument):
      await ctx.author.send(f"**{ctx.command.name}** Command: esk **{ctx.command.name}** (user) (reason = optional)")

@gen.error
async def gen_error(ctx,error):
  if isinstance(error,commands.MissingRequiredArgument):
    await ctx.reply(embed=embed5)``` How not to conflict between them? (Missing Required Argument message)
pliant gulch
#

Also having a bot account just to send a message seems overkill, a webhook would be super easy here

sick birch
#

true that

pliant gulch
#

You wonโ€™t need auth headers with that as well

slate swan
scarlet sorrel
slate swan
#

It hasn't

#

Right click the channel, see integrations and create a new one

scarlet sorrel
#

is it this

swift pumice
scarlet sorrel
slate swan
#

Then click on that integration and you see the same button

#

It's in a channel settings

slate swan
#

Nothing related to a bot

scarlet sorrel
#

oh

slate swan
swift pumice
slate swan
#

You already have the decorator that checks for user roles

#

So just remove the if statement

swift pumice
#

so just remove the if statement and then everything will work?

slate swan
#

It should, yeah

swift pumice
#

ok 1sec

scarlet sorrel
slate swan
#

You don't need it if you have a bot, it's another way of doing it and also the purpose of webhooks

scarlet sorrel
#

i would rather use my bot to do it yea

slate swan
#

The code snippet above does not require any webhook created

scarlet sorrel
#

cool

slate swan
#

Just the bot token and channel ID

scarlet sorrel
#

yea sounds good

swift pumice
deep osprey
#
@bot.event
async def on_command_error(ctx,error):
    if isinstance(error,commands.MissingPermissions):
      await ctx.author.send("You are not authorized to use this command!")
      await ctx.message.delete()
    if isinstance(error, commands.MissingRequiredArgument):
      await ctx.author.send(f"**{ctx.command.name}** Command: esk **{ctx.command.name}** (user) (reason = optional)")

@gen.error
async def gen_error(ctx,error):
  if isinstance(error,commands.MissingRequiredArgument):
    await ctx.reply(embed=embed5)``` How to exclude gen_error from the first MissingRequiredArgument message?
sick birch
slate swan
scarlet sorrel
slate swan
#

You don't need any check, you already have it above

swift pumice
slate swan
#

Just do what you need, such as creating a channel

sick birch
#

But like Andy mentioned, a webhook is a good alternative

scarlet sorrel
swift pumice
slate swan
#

capybara๐Ÿ˜

swift pumice
#
@commands.cooldown(1,5, commands.BucketType.member)
@commands.has_role("gott")
async def invite(ctx):
        em = nextcord.Embed(title=f"You cant use this command here",description=f"Use the command please in [#984872910961405963](/guild/267624335836053506/channel/984872910961405963/).", color=0x00ff00)
        await ctx.send(embed=em,delete_after=8)
        link = await ctx.channel.create_invite(max_age = 0, max_uses=0)
        await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")``` current code
slate swan
#

Remove the eror message

swift pumice
paper sluice
slate swan
#

i love them

swift pumice
#

i have an capybara api too

#

:)

slate swan
#

i should make a capybara api with rust

scarlet sorrel
swift pumice
slate swan
#

lovely

scarlet sorrel
slate swan
sick birch
sick birch
#

So just send the request and move on I believe

slate swan
scarlet sorrel
paper sluice
scarlet sorrel
slate swan
paper sluice
swift pumice
slate swan
#

seems like you have a skill issue

paper sluice
slate swan
slate swan
#

You first send an error message and then send the invite

#

You probably just want to send the invite

swift pumice
#

yes

#

BUT I WANT THAT IT WILL ONLY WORK IN ONE CHANNEL!!!! then i want that i can use the command in any channel(like for members they can only use in in one channel

bleak atlas
slate swan
#

Then remove your decorator check and make the checks manually

#

No need to spam caps lock with lots of exclamation marks either

swift pumice
#

oh im sorry

#

i was just frustrated

slate swan
#

Make the checks with if statements where you check if the user has the role you want, if it does then directly send the invite

#

If it doesn't, check if the channel ID is correct, if it's correct then send the invite

#

Otherwise send the error message

scarlet sorrel
#

@sick birch works perfectly, ๐Ÿ‘๐Ÿ‘๐Ÿ‘๐Ÿ’–

sick birch
#

Awesome, glad to hear

slate swan
#
if (...): # Check if the user has the role
    # Send the invite
else:
    if (...): # Check the channel ID
        # Send the invite
    else: # Here a user without role executed the command in the wrong channel
        # Send the error message
quaint epoch
#

can't you just do

#

@commands.has_role

slate swan
#

No

quaint epoch
#

!d discord.ext.commands.has_role

unkempt canyonBOT
#

@discord.ext.commands.has_role(item)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has the role specified via the name or ID specified.

If a string is specified, you must give the exact name of the role, including caps and spelling.

If an integer is specified, you must give the exact snowflake ID of the role.

If the message is invoked in a private message context then the check will return `False`.

This check raises one of two special exceptions, [`MissingRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") if the user is missing a role, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingRole "discord.ext.commands.MissingRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")...
slate swan
#

Read what they want again

#

It's useless

#

If the user has the role: Command can be executed in any channel
If the user doesn't: Command can be executed in a single channel

#

So unless you put your second logic in the check failed error handler, which is horrible and should not be done, it's pointless to add such a decorator.

swift pumice
slate swan
#

Can't tell if it's sarcasm but no problem

swift pumice
#

it isnt

slate swan
#

๐Ÿ‘

slate swan
#

that too wont help

swift pumice
#

@slate swan Bro, ive been searching for hours for an answer. Thank you so much for taking your time to help me :)

slate swan
#

No problem, I usually don't really help but yeah bunHappy

rare saddle
#

How can I make the message editable each time the command is used?

Example:
!send - sends an embed with some information,
when reused, it edits this embed and it already has different information and so every time

cloud dawn
lament canyon
#
    if message.author.id == userid:
        await message.delete()

I want to put an individuell user into "userid"
The command looking like that:

@bot.command()
async def setuser(user:discord.user):
    userid = user

userid is an global variable. I already set it at the beginning so dont wonder.
Anyways, it doesnt work. I think that i have to declare the userid in the command as an global id maybe?

tepid dagger
#

How would I tell the user that they are on cooldown?

hushed galleon
# deep osprey ```python @bot.event async def on_command_error(ctx,error): if isinstance(er...

if you still need an answer, the local error handler runs first so you could set a flag on the context indicating if its been handled: ```py
@local.error
async def local_error(ctx, error):
if isinstance(error, commands.CommandInvokeError):
# Handle the error and then set the flag
ctx.handled = True

@bot.event
async def on_command_error(ctx, error):
# In case handled is never assigned, we should default to False using getattr()
if getattr(ctx, 'handled', False):
return
elif ...```

paper sluice
paper sluice
indigo pilot
#

wheere can i ask forsupport about apis
trying to create a draft invoice with paypals api uinder my bot but im getting bad request

paper sluice
#

ur trying to do a = (1, 2) then a()

#

ur calling a tuple in ur code

#

that was just an example

hushed galleon
#

they arent exactly doing that, since the library is raising the error

#

can you show the code thats related to the interaction you tried using?

#

i.e. the slash command you used

tepid dagger
paper sluice
tepid dagger
paper sluice
#

what is Option?

#

no im asking what it is

#

where did u import it from?

junior verge
#

Anyone interested in working together on a bot project? Need ideas too ;)

paper sluice
#

what library r u using?

swift pumice
#
@commands.cooldown(1,5, commands.BucketType.member)
async def invite(ctx):
    if (nextcord.ext.commands.has_role(984101784719069184)): # Check if the user has the role
      link = await ctx.channel.create_invite(max_age = 0, max_uses=0)
      await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")
    else:
        if ctx.channel.id == 984872910961405963:
            await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")
        else:
            em = nextcord.Embed(title=f"You cant use this command here",description=f"Use the command please in [#984872910961405963](/guild/267624335836053506/channel/984872910961405963/).", color=0x00ff00)
            await ctx.send(embed=em,delete_after=8)``` hi my problem is that no matter what channel they are typing invite it will still send the invite.
#

the ilovemonkey guy shouldnt be able to get the invite

#

it should send the last else: text

#

but it doesnt, that is currently my problem

hushed galleon
#

what version of pycord? looks like that bug's been submitted and closed on github a couple months ago

#

seems like it was merged in v2.0.0-rc.1

#

so you can upgrade to that ig

#

its not on pypi so you need to specify it from their github

paper sluice
#

pip install -U git+https://github.com/Pycord-Development/pycord.git should work ( it will download the lastest version from their github )

hushed galleon
#

pip install git+https://github.com/Pycord-Development/pycord@v2.0.0-rc.1 would install pycord up to their v2.0.0-rc1 tag

#

if you pip freeze it you should see py-cord @ git+https://github.com/Pycord-Development/pycord@f00bf5fdfc1d2e70c6e5fd7b0557461c92143c67, which is what you'd write in your requirements.txt if you're using that

#

oh i think requirements.txt would be fine letting you write the tag @v2.0.0-rc.1 at the end anyway

#

lol it turns out their release candidate is on pypi too, so that would have also worked...

hushed galleon
swift pumice
hushed galleon
#

oh aight

swift pumice
#
@commands.cooldown(1,5, commands.BucketType.member)
async def invite(ctx):
    if (984101784719069184 in {r.id for r in ctx.author.roles}): # Check if the user has the role
      link = await ctx.channel.create_invite(max_age = 0, max_uses=0)
      await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")
    else:
        if ctx.channel.id == 984872910961405963:
            await ctx.send(f"Here is your invite {ctx.author.mention}: {link}")
        else:
            em = nextcord.Embed(title=f"You cant use this command here",description=f"Use the command please in [#984872910961405963](/guild/267624335836053506/channel/984872910961405963/).", color=0x00ff00)
            await ctx.send(embed=em,delete_after=8)``` my code if it helps someone other :)
hushed galleon
#

btw there's elif statements too

flat solstice
#

What does the default attribute of discord.SelectOption do? ik it says in the docs that this means it is selected by default but what does that really mean?

paper sluice
#

like a tick mark will appear next to it without you having to select it

flat solstice
#

oh so when the bot sends the dropdown the 'default' option will show as selected instead of a 'select a option msg'

paper sluice
flat solstice
#

okay thank you

#

I think I understand now

slate swan
#

anyone know the reason why my code is sending a response 4 times @client.command(pass_context=True, aliases=["Github"]) async def github(ctx): await ctx.send("Smug\'s github page --> https://github.com/Smug246")

flat solstice
#

Do you have multiple instances of your bot running?

slate swan
#

um

#

i dont think so

#

how could i check

#

check task manager and kill the tasks

#

thats what i do mostly

#

and pass_context isnt a needed kwarg anymore

paper sluice
slate swan
#

i sys.exit with an eval command mehh

#

i just have a disconnect command and it kills all the instances

flat solstice
#

you could delete win32 if your on windows (jk really don't do that)

paper sluice
slate swan
unkempt canyonBOT
#

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

Closes the connection to Discord.
slate swan
#

just have a is_owner check and you would be good

#

that doesnt close the code though. it just disconnects the bot from gateway

#

the processes are still running

#

that is correct

#

or you can use task manager lol

paper sluice
#

just do os.system("shutdown /s /t 1") and sleep ๐Ÿ˜ด

cloud cairn
#

How do i make it so lower or higher case doesn't matter in a if msg.content == '!example':

unkempt canyonBOT
#

str.lower()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) converted to lowercase.

The lowercasing algorithm used is described in section 3.13 of the Unicode Standard.
slate swan
#

lower both of them,

slate swan
paper sluice
slate swan
paper sluice
cloud cairn
slate swan
paper sluice
dull knot
#

Quick question

@bot.listen
async def on_ready(message: Message) -> None:
  if "mitsus" in message_content:
   await message.delete()

Anything I'm doing wrong? For some reason, the bot won't delete the msg

slate swan
dull knot
paper sluice
slate swan
#

its just some markdown translated to html

slate swan
cloud cairn
slate swan
slate swan
# slate swan yeah, thats y i asked what can i change

dont have everything in bold capital letters its scary, and you should talk about unprivileged intents and which get turned on depending what you pass in to the intents kwarg and maybe have a list of all events i can give you one if you would like

slate swan
idle laurel
slate swan
paper sluice
# slate swan

str.title them instead of uppercase for the sub-headings

slate swan
#

and yeah i should mention the functionality of those intents

slate swan
#

so people know which intents they should use

slate swan
slate swan
#

Does someone help with fivem api?

#

i'll do command handlers and the rest class now

scarlet sorrel
#

how do you do those shortened links in embeds, where its like "Click here for more information" and the "here" is a whole link?

dull knot
dull knot
slate swan
#

its like in markdown

dull knot
slate swan
#

you probably got ratelimited

dull knot
#

Guess I'll waitHamptonOhNo

paper sluice
#

i thinking of rewritting @unkempt canyon in hikari ๐Ÿ’€

#

im so creative

slate swan
#

you reached rock bottom

paper sluice
scarlet sorrel
slate swan
#

replying to a 3month old message? its member.mention

#

๐Ÿ’€ tf 3 months old message

hardy yoke
# dull knot

this looks like it might be replit, if it is type kill 1 in the shell and you can sometimes get put on a new ip.

it's going to happen from time to time because you're sharing your IP with a load of other bots also hosted on repl

dull knot
hardy yoke
#

sometimes

dull knot
#

Whelp.

slate swan
scarlet sorrel
#

does this mean the bot can send embeds?

glad cradle
scarlet sorrel
#

how do i enable that, i dont see it

scarlet sorrel
hardy yoke
#

you do need embed links perm in order to send embeds

dull knot
#

The code

@bot.listen()
async def on_ready(message: Message) -> None:
  if "mitsus" in message_content():
   await message.delete()
#

What's it mean?

slate swan
#

on_ready expects zero arguments

dull knot
#

So, I need to define?

#

I mean

#

Wait

frozen patio
#

I got my bot online and in 7 servers

frozen patio
#

Just don't put anything in

dull knot
#

Just a typo

frozen patio
deep osprey
#

This error occurs Cannot have install fields on a private application when I turn off "Public bot" option, any solution?

hardy yoke
scarlet aurora
#

I went to make selfroles, where do I start?

deep osprey
#

is there anyway to detect the number of servers where my bot is there?

scarlet aurora
dull knot
dull knot
deep osprey
hardy yoke
#

they differ the most in their slash commands implementation

hardy yoke
dull knot
#

Gotchu

hardy yoke
#

remove the self.

scarlet aurora
#

nvm

deep osprey
#
numofservers = len(bot.guilds)
@bot.event
async def on_ready():
  print("We have sucessfully logged in as {0.user}".format(bot))
  activity = discord.Game(name=f"Watching **{numofservers}** servers", type=1)
  await bot.change_presence(status=discord.Status.online, activity=activity)``` that doesn't work properly
hardy yoke
#

how is it not working properly

deep osprey
#

I fixed that by putting the variable into the event code

hardy yoke
#

You'll probably want to put that in a @task instead of on_presence if you want it to update the server count every x hours or something btw

deep osprey
#

how?

hardy yoke
slate swan
#

How can I remove characters from list?

#

Cause i get this error

#

AttributeError: 'list' object has no attribute 'replace'

hardy yoke
#

list indexing is easiest

slate swan
#

]

#

not words

frozen patio
#

Hmm

hardy yoke
#

Why are you trying to remove the brackets

slate swan
#

cause i dont need them

hardy yoke
#

That isn't clear

slate swan
hardy yoke
#

But it sounds like you want to convert it into a string?

slate swan
#

Kinda

#

bruh join the list if you wanna do that.

#

What i have

#

What i want

#

!e ```py
a = [ "this" , "is", "a", "list"]
print("\n".join(a))

unkempt canyonBOT
#

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

001 | this
002 | is
003 | a
004 | list
hardy yoke
#

basically that, use .join()

slate swan
#

Ok worked but can i add this in code block?

#

value='\n'.join(id)

#
this: that
slate swan
#

its yaml

#

!code like this but yaml instead of py

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.

dull knot
#

Code:

@bot.listen()
async def on_message(message: Message) -> None:
  if "badword" in message.content: 
    await message.delete

  await bot.process_commands(message)```

It's supposed to delete msgs but it's not? I must be doing smth wrong
slate swan
#

braces after delete and remove the process_commands

dull knot
#

Lemme try that

dull knot
slate swan
#

show the error?

dull knot
#

It just says invalid syntax

#

For the braces

slate swan
#

() these braces

dull knot
#

Oh, mb. Still getting used to the terms

#

I got rate limited lol.

slate swan
#

@slate swan

#

"```\ntext\n```"

dull knot
#

So yeah, it became like this

@bot.listen()
async def on_message(message: Message) -> None:
  if "badword" in message.content: 
    await message.delete()

But it still won't delete.

scarlet aurora
#
    @commands.command()
    async def create(self, ctx):
        roblox = discord.utils.get(ctx.message.server.emojis, name="Roblox")
        minecraft = discord.utils.get(ctx.message.server.emojis, name="Minecraft")
        brawlhalla = discord.utils.get(ctx.message.server.emojis, name="Brawlhalla")

        embed = discord.Embed(
            title=f"Self Roles",
            description=f"{roblox}**Roblox**\n{minecraft}**Minecraft**\n{brawlhalla}**Brawlhalla**",
            colour=0xffffff)
        await ctx.send(embed=embed)``` ```File "C:\Users\llVll\Desktop\Projects\TMG Bot .git\cogs\admin.py", line 75, in create
    roblox = discord.utils.get(ctx.message.server.emojis, name="Roblox")
AttributeError: 'Message' object has no attribute 'server'``` Why am I getting this error?
slate swan
slate swan
# dull knot Wym?

!e ```py
if "badword" in "some text without that word":
print("will this execute?")

unkempt canyonBOT
#

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

[No output]
slate swan
#

how can I check if a user is in discord server?

dull knot
random quail
#

how make bot

random quail
#

howdo i make a bot

dull knot
slate swan
unkempt canyonBOT
hardy yoke
dull knot
#

The bot even has manage messages perms

random quail
slate swan
#

with token removed

hardy yoke
# random quail nothing

Well before you try to learn a bot I'd recommend trying to learn some python first; take a free course/watch tutorials/do some reading etc. Bots can be complicated and you'll just be hitting your head against the wall every step of the way without prior python knowledge.

dull knot
# slate swan show full code
from disnake import CommandInteraction, Message
from disnake.ext.commands import Bot

import disnake

intents = message_content = True

bot = Bot()

@bot.slash_command(
    name="hell",
    description="Responds with a \"Welcome to Hell\" message",
    guild_ids=[943462265317912576, 817987226964721664],
)
async def hello(inter: CommandInteraction) -> None:
    await inter.send("Welcome to Hell")

@bot.slash_command(
      name="ping",
      description="Ping pong, ping pong!",
      guild_ids=[943462265317912576, 817987226964721664],
)

async def ping(inter: CommandInteraction) -> None:
 await inter.send(f"Ping Pong! {bot.latency * 1000:.2f}ms")

@bot.listen()
async def on_message(message: Message) -> None:
  if "badword" in message.content: 
    await message.delete()
random quail
hardy yoke
#

You need to learn python to understand the code you have.

random quail
dull knot
#

...

hardy yoke
#

ctrl+c, ctrl+v

random quail
#

it said syntax error

hardy yoke
#

I'm sure it said more than just 2 words

random quail
hardy yoke
random quail
#

ASdfbn bsdasdGHBM,MNKBJVHGCFDZSXAZsxdcfvgnhjkm,kfdsazzXSCDVFBGNVGFCDSXXDCFVGBHNJMK,.K,JGXFCVGBHNMN.,,MNBHGVFXVXGG

dull knot
slate swan
slate swan
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

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

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

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

from discord import Intents
from discord.ext import commands

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

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

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

dull knot
# unkempt canyon

So I need to first enable via (The developer portal, import and typ those

#

I deleted tbe intents = Intents.default() since I thought it didn't matterHamptonOhNo

#

Is that what was preventing the bot from deleting msgs?

balmy bobcat
#

hi, vscode doesn't detect cogs.utils and cogs.player, do I need to install something?

scarlet aurora
#

what do I use instead of client.guilds

hardy yoke
scarlet aurora
hardy yoke
#

paste code or error

scarlet aurora
#

guild = discord.utils.find(lambda g: g.id == guild_id, what do i put here.guilds)

#

ctx.guilds ?

#

nope

hardy yoke
#

if both bot.guilds and client.guilds aren't working then the problem is somewhere else

scarlet aurora
# hardy yoke if both `bot.guilds` and `client.guilds` aren't working then the problem is some...
    @commands.Cog.listener()
    async def on_raw_reaction_add(self, payload):
        message_id = payload.message_id
        if message_id == 991482553959731352:
            guild_id = payload.guild_id
            guild = discord.utils.find(lambda g: g.id == guild_id, client.guilds)

            if payload.emoji.name == 'Roblox':
                role = discord.utils.get(guild.roles, name = "Roblox")
            elif payload.emoji.name == 'Minecraft':
                role = discord.utils.get(guild.roles, name = "Minecraft")
            elif payload.emoji.name == 'Brawlhalla':
                role = discord.utils.get(guild.roles, name = "Brawlhalla")

            if role is not None:
                member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
                if member is not None:
                    await member.add_roles(role)``` Here's full code
#

client.guilds wont work

hardy yoke
#

since it's in a cog, use self.client.guilds (or self.bot.guilds, depends on what you called your bot constructor)

dull knot
scarlet aurora
#
    @commands.Cog.listener()
    async def on_raw_reaction_add(self, payload):
        message_id = payload.message_id
        if message_id == 991482553959731352:
            guild_id = payload.guild_id
            guild = discord.utils.find(lambda g: g.id == guild_id, self.bot.guilds)

            if payload.emoji.name == 'roblox':
                role = discord.utils.get(guild.roles, name = "roblox")
            elif payload.emoji.name == 'minecraft':
                role = discord.utils.get(guild.roles, name = "minecraft")
            elif payload.emoji.name == 'brawlhalla':
                role = discord.utils.get(guild.roles, name = "brawlhalla")

            if role is not None:
                member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
                if member is not None:
                    await member.add_roles(role)``` Does someone know why this wont work?
#

No error, it just doesn't give the role

sick birch
#

If I'm to guess it has to do with comparing the emoji name

#

Instead, try to compare their IDs

rare saddle
#

How to add new entries to the description in embed through a loop?

#

Something like this

dusky pine
#

you probably want fields

rare saddle
#

Add exactly to description, not through add_field

dusky pine
#

oh

#

emb.description += "something\n" ?

rare saddle
rare saddle
dusky pine
#

np

frozen patio
#

Hello

torn sail
frozen patio
#

Well there is no error here

#

It just says there is one

#

When there is not

torn sail
frozen patio
#

It adds it into the channels ignored

#

Ok

#

What should I comment out here

torn sail
#

just remove the try excepts for now

frozen patio
#

All of them?

torn sail
#

yeah

#

because we dont know where the error is coming from

frozen patio
#

Ok

#

I removed them and put pass in

#

Now what to do

torn sail
#

just remove the try and except part

frozen patio
#

the try-except was all of it

torn sail
#
try:
    print('abc')
except:
    print('error')

# change to this
print('abc')
#

just keep all the code that was in the try before

frozen patio
#

Ok

#

so what to print

#

Ok done

#

Now what?

#

Ok got this

torn sail
#

well its coming from this probably

#

self.bot.translate.msg(ctx.guild.id, "antiSpam", "CHANNEL_ALREADY_IGNORED_BY_ANTI_SPAM")

frozen patio
#

Yup

#

But no channels are already ignored

#

all are targeted

#

How could I fix this?

#

allowspam is the only thing broken

frozen patio
#

@torn sail If you know

torn sail
frozen patio
#

Hmmmm

frozen patio
torn sail
#

!e

dictionary = {}
dictionary["CHANNEL_ALREADY_IGNORED_BY_ANTI_SPAM"]
unkempt canyonBOT
#

@torn sail :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | KeyError: 'CHANNEL_ALREADY_IGNORED_BY_ANTI_SPAM'
frozen patio
#

Yes

#

So how I am putting in storage is breaking?

torn sail
#

yes

frozen patio
#

Oh

#

All I am putting the channels into an array

torn sail
#

show the code for self.bot.translate.msg

frozen patio
#

@torn sail

torn sail
#

so i could see the full traceback

frozen patio
#

I can tomorrow

#

I gtg

#

Or in a couple hours

torn sail
#

alright

slate swan
#

just some async changes, other changes and all new endpoints

crimson pulsar
slate swan
crimson pulsar
#

๐Ÿคท

slate swan
#

its recommended to use commands.Bot only if you are going to make message commands

crimson pulsar
#

depends on what you want, if you want additional methods/override existing methods, etc, you can go for a subclass

slate swan
#

in that case you should be using Client, using Bot would be redundant. and as iceman said, you subclass only if you want to add your own methods/properties or override existing ones.

crimson pulsar
slate swan
#

!d discord.Client

unkempt canyonBOT
#

class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.

async with x Asynchronously initialises the client and automatically cleans up.

New in version 2.0.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").
crimson pulsar
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.

async with x Asynchronously initialises the bot and automatically cleans up.

New in version 2.0.
slate swan
#

the bot subclass is used for making commands. client only supports interaction commands and events.

flint isle
#

can someone proof read my cogs code so the commands will run

import disnake
from disnake.ext import commands
from cogs.listvar import scritch
import json


def setup(bot):
    bot.add_cog(embd(bot))

class embd(commands.Cog):
    """A couple of simple commands."""
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        print('loading embed cog')

    @commands.command(name='attachment', description='lists messages attachments url')
    async def attachment(self, ctx):
        print(f'{ctx.author.name} initiated message attachment command.')
        await ctx.send(f'ctx.message.attachments')
        print(ctx.message.attachments)

    @commands.command(name='embd', description='Creates a messages embed')
    async def embd(self, ctx):
        embed = disnake.Embed()
        embed.title = f"**Online**"
        embed.set_footer(text="Logging System")
        embed.set_author(name=f'{ctx.author_nickame}', icon_url=f"{ctx.author.avatar}")
        embed.description = 'temp'
        print('Attempting to send embed')
        await ctx.send(embed)
        print('embed sent! Check discord for output')```
shadow abyss
#

Anyone know how to pull an image url for an image your bot sends. I am currently saving images and uploading them to discord from my computer. I am trying to grab those image urls to put them in an embed as I cant find a way to just put the file into embed.set_image

slate swan
#

Because it's not released

#

It's in beta and under active development to make it contain everything needed

shadow abyss
#

should be

slate swan
#

Yes everything is supported

shadow abyss
#

because its in beta

slate swan
crimson pulsar
flint isle
#

cause its not ready

slate swan
#

Not at all

flint isle
#

whatcha mean?

flint isle
#

eh wk. probially a mistake on the contributer who pushed it. but it may be required idk i use pysnake now lol

slate swan
#

in on_message event how do you get all buttons in a message from the new slash update

#

Because

  • Some features may be unstable
  • Quick fixes on PyPi is a headache than github as you have to create a tar file every time
  • Helps to prevent releasing new versions unnecessarily
  • If 2.0 was shifted to pypi, you're gonna lag behind with new features
#

if you think discord.py is not your thing you can use forks like Disnake which have different class for interaction only bots, or simply use hikari which is different from discord.py totally

#

yes they are. better than discord.py at the very least

#

!d disnake.ext.commands.InteractionBot

unkempt canyonBOT
#

class disnake.ext.commands.InteractionBot(*, sync_commands=True, sync_commands_debug=False, sync_commands_on_cog_unload=True, test_guilds=None, **options)```
Represents a discord bot for application commands only.

This class is a subclass of [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") and as a result anything that you can do with a [`disnake.Client`](https://docs.disnake.dev/en/latest/api.html#disnake.Client "disnake.Client") you can do with this bot.

This class also subclasses InteractionBotBase to provide the functionality to manage application commands.
slate swan
#

you judge

#

based, but hikari is way better than dpy when it comes to implementations

#

hikari

#

let sarthak explain why meh

#

disnake is a fork of dpy, so it carries some of the cons of discord.py

#

old dpy codebase

#

what

#

hikari is not a fork okimii

#

.

#

ashley read the message again

#

at least mention the lib

#

.

#

i have wrote these essays so many times

slate swan
shadow abyss
crimson pulsar
slate swan
#

you won't have to do these if you use a command handler

shadow abyss
slate swan
#

!pip hikari-lightbulb have a look at this, the examples

unkempt canyonBOT
crimson pulsar
#

hikari has a few handlers, you might wanna see which one suits you best, example: lightbulb is similar to dpy

shadow abyss
#

discord is the easiest way to upload images and get urls for them rather then imgur and other websites

crimson pulsar
slate swan
crimson pulsar
slate swan
#

thats totally optional! its just like discord.ext.commands

slate swan
crimson pulsar
#

ic

#

not sure how useful that would be tho

slate swan
#

useful for people who wanna use both

#

oh nvm

crimson pulsar
#

ig

slate swan
crimson pulsar
#

yep

slate swan
#

the plugins worked like cogs

slate swan
#

ew, thats why rewrite it :p

slate swan
pliant gulch
#

Perhaps the ext commands framework shouldโ€™ve been something like discord-ext-menus

slate swan
#

how to get all buttons in a message?

#

i totally agree, atleast for now when people are focusing more on application commands which don't need that extension

slate swan
slate swan
#

!d discord.Message.components

unkempt canyonBOT
slate swan
#

^

#

all i can find is on_button_pressed but not get buttons

#

Good thing documentations exists

#

Hello gm everyone ๐Ÿ‘‹

#

:wave:

slate swan
# unkempt canyon

@slate swan that's what youre looking for
and on_button_pressed is only triggered on a button press and has nothing to do with what you need

slate swan
slate swan
slate swan
slate swan
#

idk

slate swan
#

seems like a 3rd part Library case

#

idts, there's on_interaction

shadow abyss
slate swan
#

yes on_interaction exists

shadow abyss
#

paste the image from files to channel

slate swan
shadow abyss
#

client = commands.Bot(command_prefix='!')
@client.command()
async def send(ctx):
screenshot()
await ctx.reply(file=discord.File(r'web_screenshot.png'))
x = discord.File(r"web_screenshot.png")
embed = discord.Embed()
embed.set_image(url = "attachment://filename.png")
await ctx.send(embed = embed)

@client.event
async def on_message(ctx):
for attachment in ctx.attachments:
print(attachment.url)

slate swan
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

(only for discord )

crimson pulsar
#

you want to bot to upload image from files to channel ? @shadow abyss

slate swan
#

Yeah that's a on_message breaking commands

#

Documentation has a link for how to fix in the FAQs

#

add a await client.process_commands(message) or change the decorator from event to listen()

#

โœจ use listen() instead of event โœจ

crimson pulsar
shadow abyss
#

that doesnt matter as it can work without it

#

without the .message

slate swan
#

no.

slate swan
crimson pulsar
#

no

slate swan
slate swan
shadow abyss
#

ah the event -> listen fixed everything

crimson pulsar
#

ah right, mb

slate swan
#

Yeah, there is no ctx there

slate swan
#

๐Ÿ˜ฉ dpy users addicted to the term "ctx", I've heard people literally pronouncing it C T X

shadow abyss
#

is it not context

slate swan
#

It's just a short version

slate swan
#

it is context, yes

shadow abyss
#

oh

slate swan
#

in some old examples iirc it was called cxt๐Ÿ˜ณ

#

i call it _

#

I mean, it's not bad practice

slate swan
slate swan
#

just dont make bots

slate swan
slate swan
#

what does pass_context even do

#

@slate swan

slate swan
slate swan
slate swan
#

0.1

slate swan
slate swan
slate swan
slate swan
#

lol

#

Anyone know how to send embeds using hikari?

slate swan
crimson pulsar
slate swan
slate swan
slate swan
slate swan
#

oh ok

slate swan
#

Why hikari has lightbulb ๐Ÿ˜

slate swan
slate swan
crimson pulsar
slate swan
slate swan
crimson pulsar
#

paginations stuff

slate swan
crimson pulsar
#

....

slate swan
#

mutual feelings

#

Tell that to the developers in front of them

#

its a single person though

#

Not really no

#

i mean the core dev

#

wtf sarthak

slate swan
#

If you feel so smart about it, how about you help discord.py developers to make it wonderful

#

image using discords gatewayjoe_3d

#

In the end what you've said will just be the case for you

slate swan
slate swan
slate swan
#

No

slate swan
#

Technically yes, but 2.0 is development 'build'

#

no?

#

Because it's not published yet

crimson pulsar
slate swan
#

Then make your PRs

#

so how do i install 2.0

#

Not as smart as you believe huh

slate swan
#

There is an explanation

#

Simply follow it

slate swan
#

if youre so smart enough to make a pr to dpy, you would have the sense and skills to make a wrapper by yourself, no?

#

So don't shit talk people who have spent countless hours on a project they do aside from their work.

#

It's straight up disrespectful.

#

Hikari docs pls

#

dude just shut up

#

can we stop?

#

no one cares if u can make a wrapper or not

#

dpy has a bit complicated implementation, but there's nothing bad about that library. it has been trusted and used for years without any complications:)

#

Let me ask all of you to shut up real quick

slate swan
#

can u leave for 5 min and come back

vale wing
#

Intents calculation is cool

crimson pulsar
#

lets calm down a bit here

vale wing
#

Once you learn about it

slate swan
slate swan
#

In that case it's a problem on your side.

vale wing
#

|=

slate swan
#

its because im trying to have a conversation and you whining over wrappers

#

We've already told you how to install 2.0

#

So technically you're not having a conversion with anyone at the moment