#discord-bots
1 messages ยท Page 1126 of 1
you can just zoom out
meh personally I use the awesome zoom out/scrolling feature
Or just lower the font size
how small are you guys making the text smh
Or just use shortcuts
I have 16px and 1.6 line spacing I believe
yeah, i dont see any use of a vertical monitors until you're using it with your main desktop for multitasking
Ye but font becomes smaller
i just zip code ๐ถ
MonoLisa as font
if you have a horizontal monitor literally half your screen isn't used
Victor Mono :>
doubt it
Well not my case, maybe for others
horizontal
bro
vertical
just split the vscode tabs, you can work on 2 files at a time that way ez
well, i split screen and edit two files at once
Who puts their code editor on the entire screen/have only one file opened?
you have four hands and two keyboards i see
Right is for stack overflow and left for the editor 
Professional
i can switch cursors... ( right at once doesn't make much sense )
replit users: hold my vertical console
i'm using atom ๐ค
ded editor

brains
notepad++ is better
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?
ends the line?
Lol
heres my code:
embed = discord.Embed(title=" Hello! Are you human? Let's find out!", description="`blablabla`
**Additional Notes:**
:white_check_mark: line
:sos: line", color=discord.Colour.blue())```
embed = discord.Embed(title=":verification: Hello! Are you human? Let's find out!", description="""`error`
**Additional Notes:**
:white_check_mark: line
:sos: line""", color=discord.Colour.blue())
that should work
how tf are you doing the description like that without triple quotes
ill try this ty
doc/multiline strings
discord md is trash
MD?
markdown
markdown
markdown?
bruh

thats the thing which allows you to send codeblocks, block etc

u can make a .md file and do things there as well
Oh u mean ticks `
u mightve seen it in a github README.md
^^
backticks*
it does pretty much everything, it converts the text into html and displays it
https://en.wikipedia.org/wiki/Markdown
See the examples, you will understand
Ye that I forgoted
Yeah Discord does that, not Markdown
wish they'd add some colour options for text
Ooh
They have
Not without code blocks
i don't count syntax highlighting
right
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

ANSI provides for example syntax highlighting for terminals that support them
which channel should i go in
replit does not have a chrome installation
huh?
ive been doing this without any problem
and got this error after trying the embed fix
it only downloads an lnk iirc
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home**
its not in the path then
ansi might actually be useful for something on a bot im working on
remember that it doenst work on phones as for now
ansi doesn't render properly on discord
It looks beautiful on my phone 
sometimes it shows, sometimes it doesn't
It does
At least for me it works perfectly fine all the time
yeah i was gonna say i just experimented with it and it doesn't work
Most of the colours aren't supported by discord though, I'm speaking of the 255 colour codes
Probably not discord that doesn't support it, but the library they're using
I only got the basic colours to work when making my ANSI code block builder
i tried it a couple of times, it sometimes worked sometimes didnt
Discord can accept rgb codes with discord.Color.from_rgb()
I'm talking about ANSI codeblocks
ooo
it's a Colour method not Color ๐ "discord.py"
Color is an alias tho
it just doesnt show up on the docs though
Biggest mistake of my life was using colour in the .color command
am I the only one who has a bad habit of using colour everywhere
The British too
just like HTTP and hundred other things
noone documents aliases
disnake has 5 aliases for the same class, but that isnt documented
no one*
weird
calm down ash
ew noone
https://github.com/DisnakeDev/disnake/blob/master/disnake/interactions/application_command.py#L518-L525 how can someone document something like this
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```
its an uncommon variant, doesnt mean its wrong
ikr smh, I've seen the source
no-one is uncommon noone is wrong
thanks for letting me know but i'll still use it
have fun
Hi what's the topic going on?
why no document alias
Confusion

in short, why is Colour documented, but Color is not
I thought that the topic ended...
if color is pointing to colour, you basically waste a wee bit of ram there, innit
in exchange for a byte
yes it is
well who really cares about that much of ram
if that shit's used 845405464 times, you're going to spare 845405464x the amount of ram
stop using ctx.send then, its literally redirects you to ctx.message.channel.send with extra calls
Meanwhile bad code practice in other locations in your code makes it use twice the saved amount of RAM.
that sounds like mad cap
Okay
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
!paste
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.
How to color the title of the embed?
You don't because you can't, besides "blue" which is for a link
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
I choose another language
choose hungarian
i choose hikari and use rest directly
?
But are the sentences shorter there?
yes
but in order to make those sentences, you have to go through 1646161 grammatical rules first
Nice
write your code with _s and integers ez
write binary ๐
How to check if the argument of the command is NULL ?
?
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"
print('your msg')
Sorry, I mean to a chat
thats not even properly cursed
bro write in one line
Send a message through the console
Not to the console
lmao
if the user didn't put a parameter?
so anyone know?
that's just not possible
Then it will be "None" or whatever the default value you've set is
or do you have an async input?
set it to a default value, so it becomes an optional argument
So is this possible?
no, it's a required argument
Then it will never be None if it's required
what do u want to do when i dont provide the value for it?
That's the point of a required argument
?
It will throw an error if you don't supply the argument
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)
if u want the bot to both look for commands in discord and ur console, its really not possible
There we go, the XY problem
Add an error handler
There is a guide on the documentation of discord.py
I just want to like do something to say a message in the console and it will go to the chat i want
It probably is possible yeah
ya but the bot is not looking for any commands in the console, all its looking at is discord
link please
@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?
Just search on Google, I don't have the link in my hands. I would have to search, just like you
Yeah, so could i make a command but dev only to send messages or, how would i do it
its just url for set_image and set_thumbnail
You can make a say command and lock it for specific people only, yes
oh so url instead of icon_url?
Does anyone know of a way to get bot to send an entire mysql table into a chat?
yeah
thank you
like
@command()
async def only_i_can_send(...):
s = input()
await ctx.send(s)
note this will block ur whole bot until u finish typing the input
oh no no no
yeah, but this wouldnt work in the console right?
just use "SELECT * FROM TABLE" and send it?
executor?
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
In a human friendly readable way
?
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
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
Can someone help with this error? disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"
@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)
How to set on_command_eror for a specific command? like each command that got same error but different replies
1 sec
make sure that the channel id is correct
async def command_name_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
em = nextcord.Embed(title=f"Dont spamm commands please",description=f"Try again in {error.retry_after:.2f}s.", color=0x00ff00)
await ctx.send(embed=em,delete_after=5)```
Can someone help with this error? disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"
it is
try printing ctx.channel.id and see what you get
btw i have done that it deletes the message after 5 secs
okay 1sec
@gen.error
async def gen_error(ctx,error):
if isinstance(error,commands.MissingRequiredArgument):
await ctx.reply(embed=embed5)``` this if the command name is 'gen' ?
yeah
Anyone can help with this error? disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: unrecognized token: "!"
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?
show full traceback
Ight
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: "!"
there should be more above
You're trying to use ! in your statement, and it's not possible to do so
yeah
So without showing what statement you wrote/arguments you gave, nobody can help
I'm not...
I'm making a setup command, let me post the code
or is there a better module for this then the discord one, if litteraly all i want to do is occasionally send a small string to one specific discord channel, and i dont care about anything like on_message or anything like that?
``@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
Well your insert is at the wrong place
logging_id won't be visible in the outer scope of your if statement
And you don't need to get_guild, you already have it with ctx.(message).guild
How to put a GIF in an embed?
@slate swan Okay, and how can I have the logging id visible?
Put it inside the if statement
hey @sick birch whats up
The owner of the bot requires 2FA enabled on their account for what you've tried to do
Oh damn, well that's my alt
Hello
yo
@sick birch do you know anything about this?
@slate swan I moved it to the if statement, but still get the token error...
yes, just use the raw API
don't even need a module for it
It should be a simple POST request to the right endpoint
is there docs for that?
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
all i want to do is send a string to a channel id so it should be super simple
Make a POST request to the endpoint with the appropriate header (Authorization: Bot <token>) and the appropriate fields.
hikari
๐
Absolutely no need to use a discord API wrapper for such a simple thing
Still kind of overkill for their purposes
cool, where do i put the bot token for that tho?
In the request headers
How to say the command name in a message?
Header, as I said
Authorization: Bot <Token>
You can just search how to make a POST request with python and how to supply headers to that request
that too, ig requests to the API directly would be better
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?
its already been done
ik
specially in on_command_error message
since its not connected to the gateway it just doesnt receive any gateway events
import requests
requests.post("https://discord.com/api/v9/channels/<channelID>/messages", headers={
"Authorization": "Bot <token>"
}, data={
"content": "Hello, world!"
})
ctx.command.name
You need to actually pass the message payload as well
@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)```
Oh yeah, oops lol
@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)
Also having a bot account just to send a message seems overkill, a webhook would be super easy here
true that
You wonโt need auth headers with that as well
Your if statement applies for everyone executing the command, so it will fail all the time if the channel ID is not equal 9848...
@sick birch where can i find this? https://i.imgur.com/f9XnAew.png
i think something has changed since this guide was made
is it this
So you mean i need to do == instead of !=?
Then click on that integration and you see the same button
It's in a channel settings
ohhhh
Nothing related to a bot
oh
Remove it entirely if you want it to be usable everywhere
?
yes i want to be usable everywhere, but only for the people that has the role gott will it work like that?
You already have the decorator that checks for user roles
So just remove the if statement
so just remove the if statement and then everything will work?
It should, yeah
ok 1sec
wait so does that need the channel integrations thing?
You don't need it if you have a bot, it's another way of doing it and also the purpose of webhooks
i would rather use my bot to do it yea
The code snippet above does not require any webhook created
cool
Just the bot token and channel ID
yea sounds good
but then the else statement wont work?
@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?
No, just bot token
Remove it
you are so helpful
You don't need any check, you already have it above
oh okay
Just do what you need, such as creating a channel
But like Andy mentioned, a webhook is a good alternative
just realised how sarcastic this looks but its not lol ๐
this is what happens
capybara๐
@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
Remove the eror message
yes
the cult continues
i love them
i should make a capybara api with rust
one question, when doing it with requests.post, does it take time or is it just instant and does not wait for it to get all the way to discord? as in, does including this make a function take like half a second longer or like 1ms longer?
lovely
mine has reddit api, google images api, and deepmind image gen api
It won't wait, the speed depends on your network
It's fire and forget, if you want to you can wait for the response
sheesh
So just send the request and move on I believe
me with an HTTPClient for my bot: 
nah thats perfect, thanks alot! ill test it rn 1 sec
tiger cub is cuter
this is only the image related api ofc, is has many others like wolfram|alpha etc
based
fact
which error messages?
seems like you have a skill issue
i do actually ๐

The one you send
You first send an error message and then send the invite
You probably just want to send the invite
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
@slate swan is there anything else I need to do?
Then remove your decorator check and make the checks manually
No need to spam caps lock with lots of exclamation marks either
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
@sick birch works perfectly, ๐๐๐๐
Awesome, glad to hear
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
No
!d discord.ext.commands.has_role
@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")...
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.
thank you , this was really helpful
Can't tell if it's sarcasm but no problem
it isnt
๐
@slate swan Bro, ive been searching for hours for an answer. Thank you so much for taking your time to help me :)
No problem, I usually don't really help but yeah 
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
I'd use the message and channel id in a database and keep track of the message that way.
Oh, got it. Thanks
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?
How would I tell the user that they are on cooldown?
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 ...```
try-except
wait, in the command error handler check if error is an instance of CommandOnCooldown and send a message or something
wheere can i ask forsupport about apis
trying to create a draft invoice with paypals api uinder my bot but im getting bad request
ur trying to do a = (1, 2) then a()
ur calling a tuple in ur code
that was just an example
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
No I tried to do this but I guess it didn't work
u need to decorate it with bot.event
Would I put it in the main function or in the cog
right above the on_command_error like
@bot.event
async def on_command_error(...)
or if ur in a cog then
@commands.Cog.listerner()
async def on_command_error(...)
what is Option?
no im asking what it is
where did u import it from?
Anyone interested in working together on a bot project? Need ideas too ;)
.
what library r u using?
@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
what version of pycord? looks like that bug's been submitted and closed on github a couple months ago
related pr if you want to look into it https://github.com/Pycord-Development/pycord/pull/1257
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
pip install -U git+https://github.com/Pycord-Development/pycord.git should work ( it will download the lastest version from their github )
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...
commands.has_role() is a check to be decorated on commands, so it cant be used in an if-statement; instead you could use the author's .get_role() method to check if they have the role, e.g. if ctx.author.get_role(111): ...
i already got working it still thanks :)
oh aight
@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 :)
btw there's elif statements too
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?
it selects the option
like a tick mark will appear next to it without you having to select it
oh so when the bot sends the dropdown the 'default' option will show as selected instead of a 'select a option msg'
'select a option msg' is just a placeholder, if u have it set, it will show up
what it does is just selects that option, the user can then un-select it or select some other option
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")
Do you have multiple instances of your bot running?
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
i call a tiger cub to kill them ๐ณ
watch them, the tiger cub get jumped by a gang of baby capybaras
i sys.exit with an eval command 
i just have a disconnect command and it kills all the instances
you could delete win32 if your on windows (jk really don't do that)
there are no baby capybaras left in my area 
i think im gonna need that
how readable https://hikari-guide.readthedocs.io/en/latest/intents.html is this
!d discord.ext.commands.Bot.close
await close()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Closes the connection to Discord.
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
just do os.system("shutdown /s /t 1") and sleep ๐ด
oki 
How do i make it so lower or higher case doesn't matter in a if msg.content == '!example':
!d str.lower
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.
lower both of them,
str.lower() or upper()
how can pikachu be passive aggressive 
no i ment the page
yeah, thats y i asked what can i change
imagine being scared of html
soo?? like this?
if msg.content == str.lower('!example'):

woah u wrote that?
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
yeah~
I imported the "Message" as well
damn, nice
someone.. ?
its just some markdown translated to html
msg.content.lower() == "!example"
ok thx
message.content, and listen needs to be called (.listen())
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
oki Crtitc
they are html <h2> tags not bold-items, used to create toctrees
I'm creating a ticket module in my bot, how can I keep it so after the bot is restarted the button to create a new support ticket still works?
ATM after restart and click the button it returns "This interaction failed" in discord with no error
Slash command code: https://paste.nextcord.dev/?id=165645103411762
Button code: https://paste.nextcord.dev/?id=1656451104837421
str.title them instead of uppercase for the sub-headings
i know im just saying its a bold looking letter๐ , maybe use something less bold and dont have everything in caps it looks like you forgot to turn off caps lock or youre making a query in sql
and yeah i should mention the functionality of those intents
Lemme try
yes indeed
and you should show which ones would be turned on depending on the value pass to the intents kwarg
so people know which intents they should use
hikari docs explain them in a much elaborate way tho, should i just link that there? https://www.hikari-py.dev/hikari/intents.html
yep thats a good idea!
Does someone help with fivem api?
i'll do command handlers and the rest class now
how do you do those shortened links in embeds, where its like "Click here for more information" and the "here" is a whole link?
[text](url)
its like in markdown
Or am I just being rate limited?
you probably got ratelimited
Guess I'll wait
you reached rock bottom
epoc
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
Yeah, it's replit. 
If it happens, just need to type kill 1 and it'll be fixed?
sometimes
Whelp.
it kills the container and changes the ip so that is so
no
?
you do need embed links perm in order to send embeds
The code
@bot.listen()
async def on_ready(message: Message) -> None:
if "mitsus" in message_content():
await message.delete()
What's it mean?
on_ready expects zero arguments
I got my bot online and in 7 servers
Aight
This error occurs Cannot have install fields on a private application when I turn off "Public bot" option, any solution?
make sure you add bot.process_commands if you use on_message btw https://discordpy.readthedocs.io/en/latest/faq.html#why-does-on-message-make-my-commands-stop-working
disable the "add to server" button
I went to make selfroles, where do I start?
is there anyway to detect the number of servers where my bot is there?
does anyone know where I should start
Will check it out lol. It didn't delete msg for sum reason
len(self.bot.guilds)
I just noticed but is disnake and discord.py generally the same?
"self" is not defined
they differ the most in their slash commands implementation
just do bot.guilds then
Gotchu
remove the self.
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
how is it not working properly
I fixed that by putting the variable into the event code
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
how?
https://discordpy.readthedocs.io/en/stable/ext/tasks/index.html
has some decent examples
How can I remove characters from list?
Cause i get this error
AttributeError: 'list' object has no attribute 'replace'
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
list indexing is easiest
I mean characters like [
]
not words
Hmm
Why are you trying to remove the brackets
cause i dont need them
That isn't clear
list.remove / list.pop
But it sounds like you want to convert it into a string?
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))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | this
002 | is
003 | a
004 | list
basically that, use .join()
yes
its yaml
!code like this but yaml instead of py
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.
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
braces after delete and remove the process_commands
Lemme try that
Invalid syntax
show the error?
() these braces
how it's possible to use backticks without a string?
@slate swan
"```\ntext\n```"
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.
@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?
maybe because "badword" is not in message.content
message.guild
Wym?
!e ```py
if "badword" in "some text without that word":
print("will this execute?")
@slate swan :warning: Your eval job has completed with return code 0.
[No output]
how can I check if a user is in discord server?
You mean if a message does not contain the word badword?
Kinda confused rn
how make bot
yessir
howdo i make a bot
I typed badword but it didn't delete
!d discord.Guild.members check if that user is in this list
property members```
A list of members that belong to this guild.
How much Python do you know?
The bot even has manage messages perms
show full code
nothing
with token removed
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.
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()
i have the code but how do i pasted
You need to learn python to understand the code you have.
HOW DO I PASTE THE CODE
...
ctrl+c, ctrl+v
when i tried to run it it didnt wokr
it said syntax error
I'm sure it said more than just 2 words
it said syntax error something aboutstate ments missing
You'll need to copy/paste it. It's impossible to debug with just that lol
Or read up on syntax errors
https://realpython.com/invalid-syntax-python/
ASdfbn bsdasdGHBM,MNKBJVHGCFDZSXAZsxdcfvgnhjkm,kfdsazzXSCDVFBGNVGFCDSXXDCFVGBHNJMK,.K,JGXFCVGBHNMN.,,MNBHGVFXVXGG
Probably learn the Syntax of the programming language first? It'll help
someone ?
not quite how intents work
!intents
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.
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 matter
Is that what was preventing the bot from deleting msgs?
hi, vscode doesn't detect cogs.utils and cogs.player, do I need to install something?
what do I use instead of client.guilds
context?
but probably bot.guilds
that doesn't work
paste code or error
guild = discord.utils.find(lambda g: g.id == guild_id, what do i put here.guilds)
ctx.guilds ?
nope
if both bot.guilds and client.guilds aren't working then the problem is somewhere else
@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
since it's in a cog, use self.client.guilds (or self.bot.guilds, depends on what you called your bot constructor)
Wait, could the reason why my msg isn't being deleted is because I'm an Admin?
Guess not
@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
If I'm to guess it has to do with comparing the emoji name
Instead, try to compare their IDs
How to add new entries to the description in embed through a loop?
Something like this
you probably want fields
Add exactly to description, not through add_field
yeea
thanks you so much
np
Hello
When I set the allowspam channels it adds it, but gives me the error embed every time
Code: https://srcb.in/bPtgeqNB96
can you remove the try except and then try so we know what the error is. also you should not have a bare except because it will catch every error
if it is reaching that point then there has to be an error
just remove the try excepts for now
All of them?
the try-except was all of it
try:
print('abc')
except:
print('error')
# change to this
print('abc')
just keep all the code that was in the try before
well its coming from this probably
self.bot.translate.msg(ctx.guild.id, "antiSpam", "CHANNEL_ALREADY_IGNORED_BY_ANTI_SPAM")
Yup
But no channels are already ignored
all are targeted
How could I fix this?
allowspam is the only thing broken
@torn sail If you know
well there is a key error "CHANNEL_ALREADY_IGNORED_BY_ANTI_SPAM" for that key so make sure that key exists in the dictionary used in self.bot.translate.msg
Hmmmm
So channels are ignored by default
!e
dictionary = {}
dictionary["CHANNEL_ALREADY_IGNORED_BY_ANTI_SPAM"]
@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'
yes
show the code for self.bot.translate.msg
could you change the except: in the first try except for be except Exception as e: and then on the next line do raise e
so i could see the full traceback
alright
you can take a look at the changes here
https://discordpy.readthedocs.io/en/latest/migrating.html
how come ive never seen you before๐ค
๐คท
its recommended to use commands.Bot only if you are going to make message commands
depends on what you want, if you want additional methods/override existing methods, etc, you can go for a subclass
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.
you can also take a look at this
https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#bot
!d discord.Client
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").
!d discord.ext.commands.Bot
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.
the bot subclass is used for making commands. client only supports interaction commands and events.
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')```
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
Because it's not released
It's in beta and under active development to make it contain everything needed
should be
Yes everything is supported
anyone know what i messed up?
because its in beta
Ask Danny at https://discord.gg/dpy - it's in beta and not ready to be officially released
check for attachments in the message objects and use the url attribute on the attachment object
cause its not ready
Not at all
whatcha mean?
aight 1s
thanks
eh wk. probially a mistake on the contributer who pushed it. but it may be required idk i use pysnake now lol
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
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.
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
ok
await ctx.reply(file=discord.File(r'web_screenshot.png')) print(discord.Attachment.url)
<member 'url' of 'Attachment' objects>
is all it prints
why does no one answer???
just to be clear, are you trying to get image url from the image sent as a message?
you won't have to do these if you use a command handler
im downloading images off urls.
Image is on pc. I upload image to discord and am trying to get said image url to either add to an embed or do other things with
!pip hikari-lightbulb have a look at this, the examples
hikari has a few handlers, you might wanna see which one suits you best, example: lightbulb is similar to dpy
discord is the easiest way to upload images and get urls for them rather then imgur and other websites
right, do you have a on_message event listener ?
lightbulb is similar to dpy
๐ not anylonger, they rewrote it completely
wow
thats interesting
thats totally optional! its just like discord.ext.commands
and now you can make multiple command types, like a prefix command and slash command under a single function
lightbulb is similar to dpy...?
useful for people who wanna use both
oh nvm
it really used to be, like a exact copy of discord.py's commands extension
yep
hybrid commands as for discord.py in the sense
the plugins worked like cogs
ew
ew, thats why rewrite it :p
that has nothing to do with buttons
discord.ext.commands is optional to use, but itโs required when installing which kind of makes that statement redundant
Perhaps the ext commands framework shouldโve been something like discord-ext-menus
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
what library
A list of components in the message.
New in version 2.0.
^
all i can find is on_button_pressed but not get buttons
Good thing documentations exists
Hello gm everyone ๐
:wave:
@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
morning sparky, have a good day
i know thats why i said it
Thanks, u too
I'm having good days I'm on vacations
Ohk thanks :thumbs-up:
seems like a 3rd part Library case
idts, there's on_interaction
yeah but with it it doesnt let me run my command to download image from said url and paste it
yes on_interaction exists
paste the image where?
paste the image from files to channel
so you mean that the command isnt getting triggered?
nope
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)
!code
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.
(only for discord )
you want to bot to upload image from files to channel ? @shadow abyss
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 โจ
it is ctx.message.attachments
this doesnt really explain much
no
because that won't block your commands from executing
no, ctx is an insance of a Message object for the on_message, they just have a bad naming convention, it is usually named message
ah the event -> listen fixed everything
ah right, mb
Yeah, there is no ctx there
okay
then idk what do you expect from docs
just get a Message object and use the components property on it
๐ฉ dpy users addicted to the term "ctx", I've heard people literally pronouncing it C T X
is it not context
It's just a short version
message object doesnt have components property
it is context, yes
oh
in some old examples iirc it was called cxt๐ณ
i call it _
I mean, it's not bad practice
conxet?
ยฏ_(ใ)_/ยฏ
dpy <=1.2.x users: I don't even call it without pass_context=True
๐ฟ
what does pass_context even do
@slate swan
Starts from you ๐
the word says it
I dont, anymore
newest
Oh #discord-bots addict then
still.....wtf
lol
Anyone know how to send embeds using hikari?
well, cant br, print the vrrsion
using any extension ?
i literally just installed it
hikari-lightbulb
everything is the same as discord.py
just initialize the embed using hikari.Embed
Why hikari has lightbulb ๐
extensions seem overkill for an embed
print(discord.__version__) will most likely not return 2.0
i mean, they have util functions for embeds
https://hikari-guide.readthedocs.io/en/latest/embeds.html
you can create an embed object like this and use it with the embed kwarg for any send method
probably because devs want to make hikari fully modular and have allot of plugins/exts
paginations stuff
mhm but still
....
why dpy has ext.commands
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
um interesting
Idk
If you feel so smart about it, how about you help discord.py developers to make it wonderful
image using discords gateway
In the end what you've said will just be the case for you
lemme do that real quick and get banned from the dpy server
isnt the newest 1.7.3?
then why tf it say that on pypi
Technically yes, but 2.0 is development 'build'
no?
Because it's not published yet
technically, yes, 1.7 is the latest, 2.0 is yet to be released officially
It's on the GitHub page
There is an explanation
Simply follow it
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
can u leave for 5 min and come back
Intents calculation is cool
lets calm down a bit here
Once you learn about it
tru
bitwise operations๐๏ธ๐๏ธ
In that case it's a problem on your side.
|=