#discord-bots
1 messages Β· Page 430 of 1
so people won't spam it
or make a limit so they can't use it while a command is running
rip discord.py
yeah
if (message.reference and member == (await message.channel.fetch_message(message.reference.message_id)).author) or member.id in message.raw_metions:```
Why is the `.raw_mentions` giving erros? Btw i am not using Cogs
i stopped coding bots
Hey, do you know how I can get a user input from chat. I want only the input of the user
bot.wait_for
what could possibly go wrong if discord.py never ever get updates
Me too, i already stopped it a while ago...
Anyone?
what could
ive started writing bots in java, its simple but not more than python
75+ guilds bots should have slash commands at april 2022
if they dont?
idk
if not verified then also?
idk
my bot is above 90+ guilds & ill apply for verification
and also does discord.py has slash cmds
not officially
oh
Anybody bothering to help please?
??
@high flame
well what should i do?
its metions
i just started python like a month ago
typo
metions?
raw_metions
oh lol
typo in your code
am dumb
pls help with that
read imgflip dev docs, i am sure there is a method to specify formats
i just saw someone's on github today
can someone please explain this a little more, I am trying to detect user reaction https://discordpy.readthedocs.io/en/latest/api.html#discord.on_reaction_add
Learning full stack web dev (i already know a good amount of backend development) and after that im hoping to look into machine learning and AI
Cool
mind giving me a minute?
okay
@static patio here-https://github.com/topics/imgflip-api
oh ok ty
@static patio If u figure out how to make the meme generator, can u also plz tell me π
How can I send a "only you can see this" message?
ye lol ill share the code once i figure out why the error
thanku
can u tell anything about this?
yes
Indent the data variable with a tab space
does anyone recommend any good slash command libraries?
Join dank memer server and ask them how did they make slash commands
mee6 = possibly java
rythm = java, JDA
carl-bot = discord.py (RIP)
this may help- https://www.youtube.com/watch?v=sEFx0b9y_Xo
yagpdb = golang, discordgo
Idk why my bot suddenly turned off and when i check the replit page i have this huge error (i put it on a pastebin so is a lot shorter on discord) https://pastebin.com/j1yHZA3P
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
python slack bot tutorial?
slack is another chatting platform
lmao, i just picked a video of a channel, i used to watch
lmao
note: the bot was running flawless for about 2 months now and its the first time this happens
discord-py-slash-commands is a mess
wait
long name, idk what's the new name, no docs, can't seem to find the github
send me your replit page link @dire shadow
I see
dislash doesn't have support for discord.Client
basically nothing else
Hey @crystal kestrel, if you want a lib like discord.py, try https://enhanced-dpy.readthedocs.io/en/latest/ . It's a fork which is maintained till date
ooo
But they suggest to not install it rn and wait for 2.0, which should be in a few days
dpy 2.0.0 is still gonna be released?
is it discord-py-slash-commands or discord-interactions
no clue
snekcord is not that active, hikari is bad I heard, and discord.py is dead
and slash commands are a mess
with message intents
and a whole 1 hour cooldown to add slash commands
ima just wait for a few weeks and take a break while I wait for new maintainers
Yup
slash commands has less features till now, it's a nightmare for all discord developers to create bots with slashes and rewriting code without any official releases and documentation
but the code on GitHub is archived and there's no support for slash commands
dpy is dead
Eh, idk then
You can fork the project and add support for it
which I'm not gonna do since im not used to asynchronous programming at all
@bot.command()
async def help(ctx):
embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")
embed.add_field(name="Moderatie", value="!help moderatie", inline=True)
embed.add_field(name="Public", value="!help public", inline=True)
embed.add_field(name="Informatie", value="!help informatie", inline=True)
await ctx.send(embed=embed)
I dont get an output or error?
asynchronous is so useful in other places also, not only for discord
type command
then this code will run
@bot.command(name="help")...?
not sure
yes but discord.py is written entirely with async syntax and I'd have to deal with them while using interactions
Still no output 
@bot.command(name="help")
async def help(ctx):
embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")
embed.add_field(name="Moderatie", value="!help moderatie", inline=True)
embed.add_field(name="Public", value="!help public", inline=True)
embed.add_field(name="Informatie", value="!help informatie", inline=True)
await ctx.send(embed=embed)
Hey hey hey @ionic wadi did u do help_command = None in the bot constructor?
bot = commands.Bot(command_prefix="!", intents=intents, help_command=None)
Weird
I tried bot.remove_command either, but didnt make anything change.
what is intents
other commands working?
intents = discord.Intents.default()
intents.members = True
Lemme try
hmm
intents are the events that the bot will respond to
How to get guild avatar url
Ehh nope,
I know, I know, I'm asking him what he put as the value
if not then itβs a problem with the on_message prob
Thats the only thing working
they are also not necessarily events, some can be guild members and emojis
π€
@bot.event
async def on_message(message):
empty_array = []
id = message.author.id
modmail_channel = discord.utils.get(bot.get_all_channels(), name="modmail")
if message.author == bot.user:
return
if str(message.channel.type) == "private":
if message.attachments != empty_array:
files = message.attachments
await modmail_channel.send("[" + message.author.display_name + "]")
for file in files:
await modmail_channel.send(file.url)
else:
await modmail_channel.send("[" + message.author.display_name + "] " + message.content)
elif str(message.channel) == "modmail" and message.content.startswith("<"):
member_object = message.mentions[0]
if message.attachments != empty_array:
files = message.attachments
await member_object.send("[" + message.author.display_name + "]")
for file in files:
await member_object.send(file.url)
else:
index = message.content.index(" ")
string = message.content
mod_message = string[index:]
await member_object.send("[" + message.author.display_name + "]" + mod_message)
for dpy
if not message.guild:
return
oh
hold on
change bot.event to bot.listen()
try adding this await bot.process_commands(message)
just do this lol
Fixed It, thanks!
np
oh
process commands can cause other problems on some occasions, i much prefer my mehtod
hm
They could Its just If they want to work they do and If they dont want to they dont
I'm sad 'cause discord.py is ending. ;-;
ok
ok
Not ok. I don't want to make bots but in python.
OK
ig we will have to wait until someone creates an outstanding fork
ok
π
you can use a discord.py fork
edpy or whatever
Do u think that's really will happen?
Hope either.
anyone can create a fork
even you
I'll try. But I don't have that experience.
its the same bruh
forking a repository makes a repository with the same content in your account
you can edit it or do whatever
and then people will add new stuff in their own forks
forking = cloning the repo to ur own account, then u can create ur own changes and either share it, or contribute it back to the original repo, but it's dead now
I'll do this.
bruh.
Uh
bruh
That's.
bruh
bruh
bruh
that's what bruh is ig lmao
ok dont spam
It's...hard to explain
yes
Oh, please.
its like
search urban lmao
a moment where u having nothing to say, ur just speechless
It kind of used when something someone says something weird, unexpected, or just irrelevant, etc...?
that's when u bruh
Something like that. It's hard to explain
ugh
bruh π€¦ββοΈ
buh.
yes
!ot
XD
The meaning on there lmfao ||I'll stop now
||
repl is so slow at loading :/
bruh
really
why dont you ask them youself 
Im guessing, probably not and that its a meme
Maybe
then continue using discord.py
but
i saw somewhere in this ^^ that 75+ guilds bots must use slash commands
unless you have the message content intents
if they dont absolutely require the message content, you wont get the intent, so you will need to use slash commands
if you don't, you're forced to use slash commands
or just using a mention prefix
yes, for unverified bots
what about verified
oh k
only after Apr 2022
Breh, that link is just a rock roll 
2022*
not yet
apr 2021 already passed lmao
yes lmaooo
i need help
when i try to run my bot it gives me the error
AttributeError: 'Command' object has no attribute 'run'```
you have a command named client
you have a command named client?
client is a command
ohh tysm
He might be using bot instead of client
nah
i had command named client
for client as in
bot
Oh okay
its saying improper token has been passed when ive just regenerated it also
you know how dank memer has time where you have to wait between command
how do i do that?
discord.ext.commands.cooldown(rate, per, type=<BucketType.default: 0>)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.on_command_error "discord.on_command_error") and the local error handler.
A command can only have a single cooldown.
its saying improper token has been passed when i try to start my bot
@bot.command(name="help")
async def help(ctx):
if message.content.lower() == None:
embed = discord.Embed(title="Hoe kan ik je helpen!", description="Zie hieronder de modules!")
embed.add_field(name="Moderatie", value="!help moderatie", inline=False)
embed.add_field(name="Public", value="!help public", inline=False)
embed.add_field(name="Informatie", value="!help informatie", inline=False)
await ctx.send(embed=embed)
return
if message.content.lower() == "moderatie":
embed = discord.Embed(title="Moderatie commands", description="Zie hieronder de moderatie commands!")
embed.add_field(name="!warn <Gebruiker> <reden>", value="Persoon een waarschuwing geven.", inline=False)
await ctx.send(embed=embed)
return
if message.content.lower() == "public":
embed = discord.Embed(title="Public commands", description="Zie hieronder de public commands!")
embed.add_field(name="!help (moderatie / public / informatie)", value="Help krijgen van een bepaalde module commands.", inline=False)
embed.add_field(name="!warnings <Gebruiker>", value="Waarschuwingen bekijken van een bepaald persoon.", inline=False)
await ctx.send(embed=embed)
return
NameError:name 'message' is not defined
rip my goals of making a good bot
@high flame enhanced-dpy (:
i cant run my bottttttttt
!pypi enhanced-dpy
@client.event
async def on_message(message):
channel1 = client.get_channel(id)
channel2 = client.get_channel(id)
if message.channel.id == channel1:
await channel2.send(message.content)```
trying to grab all messages send in channel1 and send it to channel2, why is it not working? no errors :/
why not make a command group?
Class?
@client.group(invoke_without_command=True)
aysnc def help
@help.command()
async def moderate
@help.command()
async def public
rip discord.py
Development has been stopped by Danny
Is there any similar modules to make discord bots?
I just started learning it :(
!pypi enhanced-dpy you can use this, it will get slash command support soon
nice to hear that
My code still works, what exactly happened to discord.py?
with changes coming to on message, if you only need slash commands, you might consider running it over slash commands webhook
Oh shit
development has stopped, nothing will stop working today but as further API changes are made, the bot might stop working
dpy will still work but it will not support slash commands
I have like 16 bots running rn with all over 1500 lines rip me
!pypi enhanced-dpy
this is very similar to dpy ^
it's the same with added features
You can switch to it i guess
Sure, but it's clear that Discord wnats Slash Commands over HTTP
But like there are no slash commands gonna be supported?
Not in dpy
And discord kinda made us switch to slash commands
is discord py actually losing its only maintainer (rapptz)?
dpy will stop working in 2022
my bot wont send the help commands
no
learn js
because discord is shoving slash commands down developers throats
and how did discord.js and discord.net survive that
read the gist
they implemented it
and why didn't rapptz do the same
He tried
read the gist and find out
AttributeError: module 'discord.ext.commands' has no attribute 'error'
Sadly
Danny has no motivation to implement slash commands
it makes complete sense from both sides
it's easier for load reasons on both sides
pls help
use the command name for @command.error
if you command name is ban, do @ban.error
they are doing it for privacy reasons which is understandable tbh
so it would be py @changepreflix.error
it's 100% understandable from Discord business POV
Trust and Security is massive and expensive problem, bot gateway is extremely heavy
no i want to use it for all
like ?gthrdyg in this
yep
wdym like error handler for all commands in one event?
You can use the on_command_error for that
in def
Ok
!d discord.on_command_error
discord.on_command_error(ctx, error)```
An error handler that is called when an error is raised inside a command either through user input error, check failure, or an error in your own code.
A default one is provided ([`Bot.on_command_error()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.on_command_error "discord.ext.commands.Bot.on_command_error")).
hii how do i get a role in a cog?
get_role(id) works but self doesnt have that attribute
i am already semi prepared for the full transition to slash
just need to move over commands that require an arg then i am done
your code will still work even if dpy is deleted while you have it in site-packages folder
Danny has indicated that Discord.py will not be removed
development has ceased
i know, its an example
However, Danny is right, if you bot is a parrot, stop using Discord.py and move over to HTTP Slash Interactions
what should we use now that discord.py is dying
Is your bot a parrot?
peeps use edpy
Look at my nickname -_-
realistically most people need to move to slash commands
yeah
over HTTP
and you might as well do it over HTTP not over gateway
what does that meen
!pypi dislash.py
(Also if you ever grow the bot you will thank yourself for going with http over gateway)
Dislash.py is a very good package.
I think that's what helpers need to be saying hard. If you bot is parrot, use HTTP

i dont understand how
mine also uses vc
to do what?
rickroll
bruh
It's completely up to you what you want to use. But I suggest using this package.
I imagine voice will be locked down
otherwise it is interacting with a http api for a game
because Danny is right in his farewell message, Discord wants people off the gateway, use HTTP
Remind me, other than it being slow, what is bad with slash commands? I think there is something about message content but not sure because it is an interaction
and allowing users to vote on what the game should do
you can work 100% over HTTP
blanket and harry told me, scroll upppppp or lemme search message
idk if this is related ^^
idk how to do that though
read everything
idk how to work with the http api
you dont have to
this is the whole idea of HTTP slash commands
discord sends you a request to your webserver
you return a JSON
what is in the json
oooh
so thats how /commands work
discord pings you
hmm that will be annoying since i cant port foward
read discord docs
How can you wait for a response tho? I never understood this
like a wait_for?
you send buttons, you get further POST requests to your server with button clicks
he mean how he'll receive that request ig
Like how do you wait for something to happen? Like how does it get on_message
like how to wait for it
wait for what?
oh the websocket waits for data from discord
Hey, how can I ask if args are more than 1 ?
Yeah but how
what do you mean 'how'
Is there some asyncio stuff
yes ofc
read up on how websockets work
i forgot how
you can have a waiter that waits forever until data is received
asyncio.wait_for
not necessarily
Ohh
you can just use a Future
i was learning from capitalism's lib lol
discord.User is like await bot.fetch_user() right?
one is a class the other is a method
fetch_user return discord.User instance
they're not alike
um I think using fetch_user gives you more options
Same object, just with more options
but i how do i use fetch_user
i use ```py
@commands.command()
async def find(self, ctx , user: Union[discord.Member,discord.User] = None):
3k forks π
π’
yes
yeah
Yes, it's dead
they're asking about how the websocket waits for the data

oh my bad
no it doesn't, member object will always have more information that an User object
a Member object is an user that is in a guild
but discord.User gets users from cache right
But he used two methods to get a discord.User object
and an User object represents the User itself
I wasn't talking about a Member object
its better to fetch it aka make an API call than using cache as its not reliable all the time
does anyone need help?
how to do that
The websocket protocol is event based unlike REST.
What are you trying to do?
await bot.fetch_user(ID)
ik this but see my cmd
yes ik, i think they asked how the aiohttp ws internally waits for data to come
so you want to find a certain user?
yep
found this in discord/gateway.py
https://github.com/Rapptz/discord.py/blob/master/discord/gateway.py#L345-L368
Just learned that discord.py got discontinued. Sadness.
im not sure about how aiohttp internally works
even when the user is not cached
if you want to get a member its better to get the user from the Guild object, if you want to find an User, it should be seperate command imo
i think aiohttp just uses a copy of asyncio.StreamReader or that itself, which can asynchronously read data
the discord.Member is to check that the user is in the guild or not thats all
discord.Member is a discord.User that's connected to a specific guild
you can access that guild with discord.Member.guild
half of them is probably for personal use
me who downloaded the code
lol
Sadly, yeah

dislash, discord components
iirc
FastAPI
What?
You are doing disservice linking to WebSocket Interaction bots, Discord wants bots off WebSocket and using HTTP

Hmm.. what's FastAPI do here?
FastAPI is HTTP REST Server
Hey, is there a way to get the voice channel a user is in based on their id?
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Why would you use FastAPI for slash commands
You could use Flask/Django (yuck) if you wanted
Django is not yuck and what you are saying doesn't make sense
Django for REST API is like bringing Moving Truck to go out a date
It helps with Slash Commands?
it makes easier to setup receiving HTTP REST Requests

Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
How does using frameworks to create backends help with using an api
@hasty iron your code in miku is so clean :o
ty
You are aware that Discord sends you Slash Commands over HTTP so you need a server listening for them?
you clearly haven't used django so i'll let it go
no, first time knowing about this, thanks
you can get them over the websocket gateway, however, as Danny pointed out, it's clear Discord wants to move as much off websocket as possible
But isn't websocket faster than HTTP?
and more efficient?
isn't it also harder?
Can anyone help me here?
Nope, it's hard to load balance and requires greater load to keep websocket alive, if all your bot is doing is waiting for slash commands, which is what most bots do and what I call a parrot bot, HTTP makes ton more sense for you and Discord
oh thanks didnt know that
Rabbit is right, if all you want is slash commands and interactions websocket events are a better and less compute hungry solution
Fucking autocorrect
Webhook
it could also be cheaper
I don't know if there is any good libraries yet, hopefully someone will release one
Since you could run it over free Heroku
There's a good one, hang on while I search my dms for it lol
Ok, let it be noted this is very early, but https://github.com/ms7m/dispike
This is over Websocket which as pointed out, is not new hotness
if you have existing Websocket bot, I'd use this to get it while you work on rewrite but if you are making a new one, might as well get ahead of the curve
Very pog, my dispatch working 
Yo, what's that theme? That looks nice asf.
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Neovim isn't configured on my labtop well which is what I'm on rn
The LSP kinda bugging with flake8 and pyright
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
!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.
@slash.slash(description='Igra pesem (Pride v VC).')
@commands.cooldown(1,6,commands.BucketType.channel)
async def igraj(ctx, *, url):
voicetrue = ctx.guild.me.voice
if voicetrue is None:
await ctx.author.voice.channel.connect()
player = music.get_player(guild_id=ctx.guild.id)
if not player:
player = music.create_player(ctx, ffmpeg_error_betterfix=False)
if not ctx.voice_client.is_playing():
embed = discord.Embed(description='Iscem...', colour=0xf1c40f)
msg = await ctx.send(embed=embed)
sleep(1)
await player.queue(url, search=True)
song = await player.play()
desc = f'Igram {song.name}'
songe = discord.Embed(description = desc, colour=0xf1c40f)
await msg.edit(embed=songe)
else:
song = await player.queue(url, search=True)
embed=discord.Embed(description=f'{song.name} je v cakalni vrsti!', colour=0xf1c40f)
await ctx.send(embed=embed)
``` is this illegal??
Illegal like cops raid your house, probably not, copyright infringement where you end like Groovy and Rythm, yes
Unless 100% your work
anyone know how to get slash commands to update into discord earlier
anyone having link to the rust server
https://discord.gg/rust-lang-community If you want my advise, if you intend on writing a bot while learning rust, dont.
whats the next dpy
is this a challenge?
:P
Fair point, I think I'll go with the basics first 
Rust is just one of those languages where you cant random your way around it
smh i can random my way around anything it just takes a while
but yeah async networking is probably a step too far for me to random around in a language im entirely unfamiliar with
for
- there is significantly less Q&As done e.g. stack overflow questions that ik soo many people use
- writing Rust code like you would Python or JS e.g. heavily callback based, wont get you far
- lifetimes and borrowing trip basically everyone up, and it is a hard learning curve to get over
oke
File "c:\Users\dawid\Desktop\Bot-partnerstwa\mainpy123.py", line 47, in on_raw_reaction_add print(payload.member.emoji.name) AttributeError: 'Member' object has no attribute 'emoji'
print(dir(emoji))
@bot.event
async def on_raw_reaction_add(payload):
if payload.emoji == "β
":
print("antek")
else:
print(payload.member.emoji.name)
@bot.command()
@commands.cooldown(1, 60, commands.BucketType.user)
async def wsp(ctx, *, wiadomosc):
if not ctx.message.attachments:
return await ctx.send('Nie dodano zrzutu ekranu')
if not ctx.guild:
channel = bot.get_channel(872857064274296832)
embed=discord.Embed(title= f"WiadomoΕΔ od **{ctx.author}**", color = 0x0000fa00)
embed.set_image(url=ctx.message.attachments[0].url)
await ctx.send("Twoja reklama zostaΕa wysΕana pomyΕlnie")
msg = await channel.send(f"{wiadomosc}",embed=embed)
await msg.add_reaction("β
")
await msg.add_reaction("β")``` code
print the emoji and the type of the emoji
easiest way to solve anything is with printing the attributes, class and itself
oke
in else?
can I have spotify for playing and not getting raided by cops??
lol
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
you cant play from spotify with a bot
what can i use then
how about mee6
dont know why they are botherd by it now lol
??
mee have music
ok?
Likely not for long
you can make music commands but you wonβt receive help here
I heard they removed their music module
I expect voice in bots to become privileged intent before long
Iβm talking ability for bots to use voice
and its not related to the main gateway websocket
^
Like it will be privileged action
yall play fortnite right?
if i had downloaded a full radio track and implemented a command to play that track on a vc would i be at risk or is that different
lol imagine using any other app other than osu for music
2 in 1, spotify premium and a game

why would it be
doesnt mean thats its gonna get deleted
ceasing all updates
no ik that
however you can still fork and continue

I have a problem because how does each bot command used send a message that I am sending a message for player approval and how should I do it separately and the functions event or how?
Are there any βcompleteβ alternatives to discord.py that anyone knows about?
how would i add time to a timestamp, specifically hours
embed.timestamp = datetime.datetime.utcnow()+timedelta(hours=times)
im just not sure how to fix this
What am I supposed to do when the only language I know is python and itβs written in discord.py
tut
Pretty much
?
the rewrite of it was, you are always able to fork the git and add on to the lib if you really wanted to
Possibly. But this will definitely encourage most people to try and write their own wrappers to replace it, so we might see some of that.
as I've been beating the drum about, if you bot is simple call and response, moving towards HTTP Slash Interactions is best way to go
Yeah, no. Half the time my bots are for logging and moderation.
like submitting the JSON? Yes
sure but so many bots are simple call and response
import os
import json
import requests
app_id = os.getenv('app_id')
url = f"https://discord.com/api/v8/applications/{app_id}/commands"
jsonpath = os.path.abspath("command.json")
with open(jsonpath, "r") as json_file:
data = json.load(json_file)
header = {
"Authorization": f"Bot {os.getenv('bot_token')}"
}
r = requests.put(url, headers=header, json=data)
print(r)```
and my command.json has all my commands
Very basic one?
[
{
"name": "dice",
"description": "Roll a D6 Dice"
},
{
"name": "update",
"description": "Updates Discord ID with proper roles as determined by database",
"options": [
{
"name": "userid",
"description": "Discord ID of user to update, leave blank for self",
"type": 3
}
]
}
]```
this is for registering commands
HTTP Slash Commands have some more setup
I'd spend time with documentation
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
how can I make a button usable many times?
Like how discord.py adds callbacks to a command you have to do that with your slash command. I would just listen to the interaction_create event and run the callback of whichever command was ran which you can get via finding the name in some sort of dict
I was talking HTTP Interactions where Discord calls your webserver to tell you got a command
what is happening to discord.py??
my_commands {"command_name" command_callback}
#on interaction create check if slash command
my_command[name](. . .)
Development discontinued by Danny and no one has stepped forward to take it over
Does hikari work?
so can we still use it??
Like is that an alternative
Yes but it's clear that if your bot is call and response, they want you off stuff like Discord.py and moving to HTTP
No in the round brackets you add the args of the command callback
Which you need to parse from the interaction_create event's data
i think im switching so js
What does your bot do?
Cuz I just saw a video about discord.py being dead and they said something about hikari
welcome messages giveaways reaction roles fun commands and moderation
If you want I can give you the repo link to my old slash wrapper built on corded (since its low level) but its essentially the same other then how you receive the interaction
ok, some of that could be moved to interaction and some could be left with discord.py
what my whole 2 months of work will be dead???????
Discord.py will work fine with gateway events
I don't really link how I implemented everything in this repo thus was archived, but in my wrapper I'm working on right now I plan to really step up interactions
Sure but my point is still gateway based
Idk if I should just switch to js now
?
Interactions are passed via gateway, Discord supports that but Danny is right, "This isn't path of discord design"
To me, the message content privileged intent signals the end of the creative freedom and grassroots hacking us library developers all believed in. The control is now inverted and things are being built around Discord's limitations. No longer will bots thrive with a sandbox limited only by your imagination, but instead Discord is now the sole gatekeeper of approved use cases. The future of Discord bots relies solely on the interaction system; things have to be explicitly written and supported by Discord employees, with creative solutions being put aside. I wouldn't be surprised if in the future, the entire gateway API becomes restricted and deprecated, with the only recommended way remaining to create a bot being entirely interaction or HTTP based. I have no real hope for the future of Discord bots.
I'm so confused as to what you're trying to tell me
gateway is current Websocket calls, however, that's not where Discord is going
corded/discord.py use WebSocket, Flask/FastAPI/Django (if you must) for interactions is what Discord wnats
so Discord makes HTTP call to webserver, you process it and send response back to Discord
Yea, I've already played around with webservers and interactions
It won't be hard to add that to what I am doing
Hey, I have a problem where sometimes my command to edit channels just doesn't change anything, I already figured out that the problem is:
await channel_name.edit(name=name)
the code just gets stuck there without an error.
channel_name is:
channel_name = ctx.message.author.voice.channel
and name is getting defined by the author of the message.
What could be the problem here? Since it works again if I go into another channel.
Please tell me what to do with it?
u need to await it
atleast, i think thats the error
I have already fixed await
How can I lock a command to a specified channel?
If your bot is in less than 75 guilds you can still use the commands extension, as you will still get the message content
If your question isn't about the command extension breaking eventually, then it's up to you π
But will you get message content too?
It's gonna stop working eventually, right?
Once the change is released, you will still get message content if your bot is in less than 75 guilds.
Not in the foreseeable future for small bots
how can I make a button usable many times for different users? 
import discord
from discord import channel
from config import *
import asyncio
import discord
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
async def reply(message):
if message.content.startswith(prefix+'hello'):
await message.channel.send('Hello!')
client.run(token)```why is reply not working 
you arenβt calling it
how do you expect it to work
oh
@slate swan read about cogs too π€
Hey guys how would i create a help command like dank memer
read the doc page i sent
it comes with discord.py, you donβt have to install anything
In the documentation they are explained quite well, they basically serve to group commands in a single python class
sure send it 
isnt it with python ?
i meant discord py
import discord
from config import *
from discord.ext import commands ```importing discord twice ?
You're importing the discord package then a class from it.
Yes
You're not importing discord twice
!d discord.Context
No documentation found for the requested symbol.
!d discord.ext.commands.Context
class discord.ext.commands.Context(**attrs)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
Youβre importing discord itself and then the commands ext for easier access
So you donβt have to write discord.ext.commands but just commands
oh alright
i meant here py async def hello(self, ctx, *, member: discord.Member = None):
This must be in a cog, first understand how the command extensions work and then move on cogs
but that * is actually used in python to make the next parameter a keyword only, which means it must be passed as member=
oh alright got it
in discord py it makes it kinda greedy and not require to have "" around it if it contains spaces, also eats the rest of the message
@slate swan https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Context here you can read more about ctx
Yeah start from there, it's better
should i start from the one you're talking about ^ or ctx ?
Start from the commands one
which one exactly ?
And it will link you to ctx too so dw
You can divide the whole commands into separate files, those are called cogs
yea
with dpy ending idk if he should even learn them
unload_extension
what is from config import *
hi guys how i contact admins here?
what does the import * mean
damn
Could you DM @novel apex please.
how?
Just send a DM to @novel apex and the mods will see it and reply to you.
does anybody know how to dm a person by ID? I have tried using the DMChannel library but it returns an error
you also need to click the little green check mark emoji when you start the thread.
wtf is import *
does anybody know how to fix this
from discord import DMchannel
user = await client.fetch_user(<id>)
await DMChannel.send(user, "test")
how many checkmarks i have to click?
@glacial sail
@visual yarrow
is checkmark == send this?
ok got chu
yeah, the checkmark is asking you to confirm before the thread gets created.
Normally if you do py import x and you wanted to use y in the x module, you would refer to it as x.y. But if you do py from x import * you can refer to it as just y.
Although I only recommend you use from x import * if you're trying out code in the python shell. It's not great as you can't see what names it creates.
same
from config import *
from discord.ext import commands
bot = commands.Bot(command_prefix='$')
@bot.command()
async def test(ctx,args):
await ctx.send(args)
bot.add_command(test)
bot.start(token)```
what did i do wrong
he doesnt need it
still wrong
from config import *
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='$')
@bot.command()
async def test(ctx,args):
await ctx.send(args)
bot.add_command(test)
bot.start(token)```
i didnt define the bot client ?
why are you calling add_command?
what will now happen when discord.py.will shut down or som will my bot still work?
idk thats what i found on the docs
.command() already does that
the decorator
oh alright
same why i am confused i nvr done that
its just manually registering it
new error
RuntimeWarning: Enable tracemalloc to get the object allocation traceback 
@mighty muralration should do the job
and why are you using.start() instead of run()
that only if you want to uhh
i thought it was start
what was it i forgot lol
multi thread
start it for service
what
intents.guild_messages and other intent attributes are telling me attribute guild_messages is read only and has no attribute guild_messages. This error only appeared recently, is there any way to fix this?
.run(token) is the one
thats the normal way of doing it
just use run() lucid
you are not providing the full traceback anyways so i cant really help any further
@visual yarrowty
Whats the effect of the situation with Danny leaving the discord.py library going to have on its use?
it will slowly decrease, then in a year become forgotten unfortunately
in 9 months it will not be usable by verified bots
there has been a ceasement of changes
Has somebody created a fork yet?
not sure
bot.run()
The library is still usable right now though right?
alright
!pypi discord.py will also be usable and it will always be forkable, the only difference is there will be no slash commands and no changes
!pypi discord.py
it will remain in its current state until somebody becomes the maintainer of it
no, someone will need to fork it and create a new name - its been archived and danny said no one wanted to take over
bro someone need to do it
why dont you π€¦ββοΈ
lotd
lots of talented people will fork it
im placing my bets on EQEUNOS
hes gonna make the best fork
bro i started 1 month ago im 13 discord.py was my first project and now d.py is shuting down? wtf
not shutting down, just no further progresss
there are discord libraries other than discord.py
it wont effect you in the slightest
im planning to use hikari or switch to js
what if youβre 13? age doesnβt matter
how can i make new d.py?
when i have no experience
there is not really a guide on "how to make discord.py", you can read source and docs
then gain experience, nobodyβs stopping you
blanket stop trying to make a 1 month python beginner make a full libary smh
fr
maybe if you didnβt start with discord.py as your first project, you couldβve done more
what
they asked "how can i make new d.py?"
i didnt asked like that
eh, its good to do something you enjoy, that said you will not in a month of python be able to create a discord library, that much i am confident of
he asked it rhetorically
he was like 'bruh, how can i make it if i have no experience'
ok dude
anyways they can always gain experience by doing other projects
i got into wrappers by learning how http requests work
discord bots arenβt the only thing you can do with python
but im still on team EQEUNOS
i have another project i am wokring on
facts
working*
which is?
an async web framework
borring
bro his dad is web dev lol.. he helped him too much
doesnt matter
it will be nice to have dad who knows how to code lol
and how he even got that much eth to pay fees
ever heard of google 
you're right. Google is my dad
How would you do in the case of creating a command that calls the server icon and when it does not have it, it sends an error?
congrats
what part of that are you stuck on
!d discord.Guild.icon_url
icon_url```
Returns the guildβs icon asset.
I don't really know what you're asking
raise Y if not X else send Z
when I use the command, it does not detect the url of the icon because it does not have any icon and that is why it sends an error
?
i made that nft lol
Off-topic channels
There are three off-topic channels:
β’ #ot0-psvmβs-eternal-disapproval
β’ #ot1-perplexing-regexing
β’ #ot2-never-nesterβs-nightmare
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
I don't know how this works, could you explain to me?
just to show him that makimg nfts is easy
what the fuck is an nfts
non fungible token
are you trying to make it not error if there is no icon?
like digital art
not necessarily art
yes
ahh the same but its easy to make pixelated whale
and how the f did he got money for gas fees
simply put;
try:
await ctx.send(ctx.guild.icon_url)
except:
await ctx.send('No icon')```
a bare except is a no no
you should except for the error you expect
- i dont know what it raises, i just said simply put 2) there are many things wrong with that (can just use a check) 3) i can leave an empty except because i have a thousand and one checks in my subclassed ctx.send
btw @fleet oracle when i sent
the icon_url in a server without an icon it didnt error
it just gave nonetype
in which case;
await ctx.send(ctx.guild.icon_url) if ctx.guild.icon_url else await ctx.send('none')```
or readable;
```py
icon = ctx.guild.icon_url
if icon:
return await ctx.send(icon)
await ctx.send('No icon')```
You can just shorten this to await ctx.send(ctx.guild.icon_url or "none")
File "C:\Users\ronal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 125, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\ronal\Desktop\Proyectos\tests\cogs\test.py", line 10, in icon
icon = ctx.guild.icon.url
AttributeError: 'NoneType' object has no attribute 'url'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\ronal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 960, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\ronal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 825, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\ronal\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 134, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'url'```
this happens when the server does not have an icon
hes 1.7
in this version it is .url
would be icon_url then ( i use 1.7.3 and its icon_url)
is that the problem is not that here, the code works when there is an icon on the server, but when there is none, it sends that error
weird. never had that issue before π€
if hasattr(guild, 'url')
?
just use try and except then lol
icon_url```
Returns the guildβs icon asset.
or you can do this but with hasattr
what version of discord.py are you
type pip show discord.py in the terminal
or print(discord.__version__)
whichever's easier
yes im curious. that is a serious breaking change between some minimals π
say goodbye to discord.py
It still works, just will need custom patches done by devs themselves, or 3rd party libs, until something breaking is added im pretty sure
Maybe I make a tutorial on how to make discord libraries π³
π§
Well, on April 2022 it will be broken for sure
ale, im sorry im on team eqeunos
Slash commands...
Yep
so i need to study discord.js
or make them on your own
for verified bots
unverified bots are unaffected
ngl, its super interesting to play with the discord api at a low level yourself, and if you have the knowledge i'd certainly say to take a shot at making a minimal wrapper, you'll learn a lot about the api
π§
Abandonedware
can someone send me invite for d.js server?
π§
thanks im switchingπ
learn the language first
i will
How to delete bot
bro.
you can't?
rip dpy
https://discord.gg/gPpPuRfcXD is still maintained (an external discord.py library for slash commands)
It is not discord expect us to migrate to slash command even for unverified bots?
if you look at your Application Page, bots cannot be removed
(they're just too cool to destroy)
Then can I delete application
Or maybe I can make a team and move the application in there then delete the team?
Ive used this for like forever now
Actually I donβt think u can move applications
it is very good
actually I may be confused with another one, lemme check
nope nvm was that one
Its an amazing extension lib, and now has the chance to become the main lib 
Well danny rejected them.
I think...
@client.command()
@commands.has_permissions(kick_members=True)
async def unmute(ctx, member: discord.Member, *, reason=None):
muteRole = discord.utils.get(ctx.guild.roles, name="Muted")
if member == ctx.author:
await ctx.send("You can't unmute yourself!")
else:
embed = discord.Embed(colour=0xFF0000)
embed.set_author(name=f'User Unmuted | {member}', icon_url=member.avatar_url)
embed.add_field(name='User', value=f'{member.mention}', inline=True)
embed.add_field(name='Moderator', value=f'{ctx.author.mention}', inline=True)
embed.add_field(name='Reason', value=f'{reason}', inline=True)
embed2 = discord.Embed(description=f'You were unmuted in {ctx.guild.name}', colour=0xFF0000)
embed2.add_field(name='Reason', value=f'{reason}', inline=True)
embed2.add_field(name='Moderator', value=f'{ctx.author.name}', inline=True)
await member.remove_roles(muteRole, reason=reason)
await ctx.send(embed=embed)
await member.send(embed=embed2) ```
how do i make it so, someone who doesnt have kick_members gets a mssg saying "you can use this command" or something
administrator can use?
wdym
Damn this is so sad
qwq
server administrator can use this command and the member can't use
rip, so need to change to js
i know java and python, so ig javacord for me
tho i don't think people use javacord too often
This channel is not only for dpy ( channel is still remain active tho )
@bot.command()
async def facts(ctx, * , args):
url = 'https://api.popcat.xyz/facts?text='
args.replace(' ', '+')
url += args
await ctx.send(url)```
why
http encode it
wdym ?
i'm taking the string from a user
yes?
oh alright just had to let you know
like this ?py args.replace('%20', '+')
like this
async def facts(ctx , *, args):
url = 'https://api.popcat.xyz/facts?text='
x = args
x = x.replace('%20', '+')
url += x
await ctx.send(url)```
args = args.replace(' ', '+')
i did that here.
wait
@bot.command()
async def facts(ctx, * , args):
url = 'https://api.popcat.xyz/facts?text={}'
args = args.replace(' ', '+')
url = url.format(args)
await ctx.send(url)
format ?
yes

replaces {} with the arg




how why where
ifaik