#discord-bots
1 messages · Page 857 of 1
Python can be extremely useful even if you don't want to work a job as a programmer
bro
bro
And that is good, but like i said before this server doesn't allow recruiting, you can ask for collaborators or interest people in your project by having it open source.
can i jump straight into discord.py? like can i learn it or do i need to learn from the very bottom?
What kind of logic is that? A chatbot isn’t “just” something you can make, or have made without some type of investment: time, money or otherwise. It’s an actual piece of software and needs to be thought of as such
learn Python first
very bottom
You need to learn the language first
Imagine you try to drive a car without learning how to first
You're going to do a lot of bad things
more like if you tried to learn how to swim in the deep ocean
its so deep you cant touch the floor of it
I like this one more
no but if you dont know how to swim youll drown
but it can affect the consequences of you not being able not to swim
@slate swan it is fairly doable, i did it, asked for improvements and suggestions here. Turned out fine (i think)
and its waves are so big you wouldnt survive
Well in that case just die, in this case you would be writing bad code.
okay fine you guys convinced me. i’ll learn code. @slate swan ty for the links :)
Ah i did have some prior php skills :)
yeah i started off really bad and it made it hard to learn everything thats why i prove my point to learn it first so you wont go through the same error as myself
same
I learned python before making a discord bot 😎
mostly why all generals here say it
built different
🤝
I just told myself that i just throw away my bot each week and then improve on what i've learned new.
i learned basics but not oop and async stuff
we all know who you are
I mean, if your main motivation is to create a discord bot, by no means should you abstain from doing that after “learning python”, to whatever level that entails anyway. Could just be a project you work on while learning python, and it would work as well
I just learned python to automate boring stuff
Making a Discord bot is still a great learning project. You just need to know the basics or you're going to have a very bad time
youll get bored of it lol
Might aswell make a bot that makes discord bots
Searches for the word client and tells you are a fool extension.
most exts can do that
I call that a proper IDE
and docs strings do have examples and return types which pylance reads
Your intelisense should already do that for you
^
nvim 🙌
screams in sublime
windows updated notepade
hey brandon👋
i didnt have intellisense for sublime until andy screamed at me and made me download pyright
🗿
Plus coc-pyright 😼

Suggest more topics here!
For questions and discussions relating to Discord bot development with discord.py and other relevant Python libraries.
When I enter commands on other servers, they do not work (22 is written to the console), although they should, in one command (should work on one server), this is written.
if message.author.bot:
return
if message.guild.id != 692305542324027424:
print('22')
return
!d discord.ext.commands.Bot.process_commands
await process_commands(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
It is
how to get the name of a slash sub command after the invokation using disnake?
Throw off the code that works only on one server?
if message.guild.id != 692305542324027424:
``` why does he need that when he wants the commands to work in the other servers?
You could use a check instead
all commands do not work on other servers, one command should work only on one server, if I use other commands on other servers writes 22 in consolee
someone?
How do you use append to edit a variable?
🤔
like
content = []
@client.command()
async def ban(ctx,*,text):
content.append(text)
await ctx.send(f"Banned {text} From Using This Bot"
oh god
basic idea
._. idk, But why the commands do not work on other servers, although they used to work
would I put the global content inside the command, or below the variable?
async def buttons(ctx):
button = Button(label="gyi")
view = View()
view.add_item(button)
await ctx.send("hi", view=view)```How would I change the color of my button
Where is your view
!d discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
^
The style kwarg
specify it in the decorator
isn't it view = View()
Doesn’t need to be in decorator
huh
||oh no||
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
your view class has to derive from the discord.ui.View class
It doesn’t
Button would have to be subclassed
yes but that is if the class is just one button
Yeah I guess it’s best to subclass view
a view can include buttons and other ui elements
Hey so I need some help. Whats going on is when I run my bot on 2 different servers or just twice I get this error. ```
Ignoring exception in command setup:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/Users/coop/Desktop/In Progress Python Programs/ME API test/main.py", line 41, in _command
get_info.start()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/discord/ext/tasks/init.py", line 205, in start
raise RuntimeError('Task is already launched and is not completed.')
RuntimeError: Task is already launched and is not completed.
Here is my full code https://paste.pythondiscord.com/upoveposim. Also I know I'm using requests I will change it later. I'm using discord.py btw.
Like have my bot on 2 different discord servers
looks like something blocked your task from completing
This code is pain
Globals, breaking pep8, using blocking code, readability and a few others
Ok
Do you think you can help?
If you run the bot it becomes online in every server
All this is taking place in a view class
Im trying to send another message that also has buttons on it
I meant the command
I didnt give error
You want to run a command and have it send in 2 different servers?
So basically its not letting me do what im trying to do just saying interaction has been responded to
camelCase should never be used in python
Whats that
snake_case is used for function and variable names while PascalCase is used for class names
It's not the style for python
Ive coded too much dart
Dartpad requures camelCase
I just brang it over here
Oh ok neat
It's not fine
Ima have to email it to myself brb
It's not a major issue but it's not "fine"
you wanna go to pep prison?
Alright
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
🚓 💨
whatever is happening here is very off topic and belongs in #ot2-never-nester’s-nightmare
class rpsMultiConfirmView(View):
def __init__(self, ctx, user):
super().__init__(timeout = 10)
self.ctx = ctx
self.user = user
@discord.ui.button(label = "Cancel", style = discord.ButtonStyle.grey, emoji = None)
async def cancelButton(self, button, interaction):
if interaction.user == self.user:
self.children[0].style = discord.ButtonStyle.green
self.children[0].disabled = True
self.children[1].disabled = True
await interaction.response.edit_message(content = f"Well {self.user} decided not to have fun...", embed = None, view = self)
else:
await interaction.response.send_message("Hey! That button isn't for you!", ephemeral = True)
@discord.ui.button(label = "Confirm", style = discord.ButtonStyle.grey, emoji = None)
async def confirmButton(self, button, interaction):
if interaction.user == self.user:
self.children[1].style = discord.ButtonStyle.green
self.children[0].disabled = True
self.children[1].disabled = True
await interaction.response.edit_message(view = self)
users = [self.ctx.author, self.user]
first = random.choice(users)
for user in users:
if user != first:
second = user
else:
pass
embed = discord.Embed(
title = f"{first} vs. {second}",
description = f"{first}, Pick your choice!",
color = 0xFFFFFF
)
embed.set_footer(icon_url = self.ctx.author.display_avatar.url, text = f"Requested by {self.ctx.author}")
view = rpsMultiFirstView(self.ctx, first, second)
view.message = await interaction.response.send_message(first.mention, embed = embed, view = view)
else:
await interaction.response.send_message("Hey! That button isn't for you!", ephemeral = True)
async def on_timeout(self):
self.children[0].disabled = True
self.children[1].disabled = True
await self.message.edit(f"Well {self.user} decided not to have fun...", embed = None, view = self)
Yeah
then show us it
Its supposed to send another message with buttons but it doesnt
send us, the error.
It logs "interaction has already been responded too"
Different device cant
uh
Okie
Ah I never knew that
Oh ok neat
It says "Interaction" object has no attribute "send"
So an alternative could be I pass ctx to the class and do await self.ctx.send() right?
no interaction has .send
may you send the code?
@okimii#0434
attributes should be put before super init
Why
Every tutorial I see they put super init before
I mean you can but I think it might violate PEP8. it is obscure and might not matter though
but your class name violates pep8
await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=False, delete_after=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
If the interaction hasn’t been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
Note
This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.Interaction.original_message "disnake.Interaction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if you’re sending a followup message.
@slate swan im using pycord
Pycord docs are shit
IKR

And they dont wanna help they tell me to check docs
same as nextcord
No documentation found for the requested symbol.
!d
Alr ty
guess not
Alr
im sorry if this is a beginner question but how do i check if a message sent contains a certain word? (im not trying to make commands)
example something like
if message sent has word fart
send fart
await message.channel.send("giyg')```
if "fart" in ctx.message.content:
await ctx.send("fart")
?
where should i put this exactly
a on_message function ?
if u are making an event than use message
ok so i can just plop this into a cogs ?
Wherever you want
As long as you have some instance of Message. You're about to check it’s content.
async def on_message(message):
if "fart" in message.content:
await message.channel.send("giyg")```
Can I see your current code?
Don't use bot.event
bot.listen() is better
i dont have such code i was just asking in general on how do to this
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").
Example...
Also you should look into type hinting
how would i optimize my code ?https://paste.pythondiscord.com/zozekapano
i feel like im doing something that is very unoptimized
File "main.py", line 2, in <module>
from keep_alive import keep_alive
ImportError: cannot import name 'keep_alive' from 'keep_alive' (/home/runner/Bot-Tutoria-2/keep_alive.py)
``` can someone help me?
Replit 🗿
💀
(source: trust me bro)
be sure you're spelling the filename correctly, as well as the function you're trying to import. if you're file is inside any other folders, be sure to specify the correct path.
async def on_message(message):
if message.content.startswith(prefix + 'information'):
name = str(message.guild.name)
description = str(message.guild.description)
icon = str(message.guild.icon_url)
owner = str(message.guild.owner)
id = str(message.guild.id)
region = str(message.guild.region)
memberCount = str(message.guild.member_count)
embed = DiscordEmbed(
title = name + "Server Information",
description = description,
color = discord.Color.dark_grey
)
embed.set_thumbnail(url = icon)
embed.add_embed_field(name = "Owner", value=id, inline = True)
embed.add_embed_field(name = "Server ID", value=id, inline = True)
embed.add_embed_field(name = "Region", value=id, inline = True)
embed.add_embed_field(name = "Member Count", value=id, inline = True)
await message.reply(embed)
@patent lark
!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.
embed=embed
^
embed.add_field
File "C:\Users\tyler\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\tyler\Desktop\Projects\inspyre discord bot\Bot.py", line 41, in on_message
await message.reply(embed=embed)
File "C:\Users\tyler\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\message.py", line 1358, in reply
return await self.channel.send(content, reference=self, **kwargs)
File "C:\Users\tyler\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1017, in send
embed = embed.to_dict()
AttributeError: 'DiscordEmbed' object has no attribute 'to_dict'
It gives that when i add embed=embed
await message.reply(embed) ---> await message.reply(embed=embed)
🎂
i change to this?
never seen add_embed_field before
but if it works you probably don’t have to change it
thats what vsc told me to do
File "C:\Users\tyler\Desktop\Projects\inspyre discord bot\Bot.py", line 37, in on_message
embed.embed.add_field(name = "Owner", value=id, inline = True)
AttributeError: 'DiscordEmbed' object has no attribute 'embed'
wrong.
well, it can be set up via a dictionary.
File "C:\Users\tyler\Desktop\Projects\inspyre discord bot\Bot.py", line 37, in on_message
embed.embed.add_field(name = "Owner", value=id, inline = True)
AttributeError: 'DiscordEmbed' object has no attribute 'embed'
idk what ot do

how have you implemented the embed into your program?
embed.embed
embed.embed

how would I optimize this code?
https://paste.pythondiscord.com/zozekapano
for what
Don't use python
🗿
Don't use requests
Cntrl+a , backspace, ctrl +s
It's blocking
(Your welcome btw)
!blocking
Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.
What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:
import discord
# Bunch of bot code
async def ping(ctx):
await ctx.send("Pong!")
What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.
async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!
what should i use for reaching an api instead ?
aiohttp
something along the lines of this
help_embed = discord.Embed.from_dict(
{
"type": "rich",
"title": "your title",
"description": "your description"
"color": 0x00FFFF
}
)
await ctx.send(embed=help_embed)```
any documentation to make requests with aiohttp + json ?
https://paste.pythondiscord.com/ifowoledis.py
File "C:\Users\tyler\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\tyler\Desktop\Projects\inspyre discord bot\Bot.py", line 37, in on_message
embed.embed.add_field(name = "Owner", value = id, inline = True)
AttributeError: 'DiscordEmbed' object has no attribute 'embed'
youll stop your code and block your bot from accepting a heartbeat
ok aiohttp makes request some apis format the response body with json
lol
@snopw
@patent lark
look at the response, how would i do Requests with Aiohttp ?
@slate swan what is DiscordEmbed
The boxes that bots make like when using !p
pep_number
!pep <pep_number>
Can also use: get_pep, p
Fetches information about a PEP and sends it to the channel.
where are you getting the DiscordEmbed class from?
Yeah like this
import Discord_embed
no, ik, I've made a few bots myself :3
I'm trying to figure out their code
bro a request is when the client communicates with the api?
there's a class in discordpy which is what you should be using, discord.Embed
it doesn’t have to be an api. Can be any host.
i know what is a request. i just want to know if there is documentation / tutorial on how to make Requests with api's in python WITH Aiohttp
ye but it was in his case
ah yeah
!pypi aiohttp
documention should be there
and Discord.py is included with Aiohttp correct ?
pardon?
i'd have to import
import aiohttp
import asyncio
?
Also I’m not so sure about this. When you block you aren’t rejecting discord heartbeat your blocking your own heartbeat_ack
Discords heartbeat is never rejected or blocked. Only the acknowledgment your bot sends can due to your code being stuck.
doesnt the api send a ack heartbeat and the wrapper needs to handle it and then send it back?
ah true sorry
dont know much about heartbeats since i havent worked with websockets
Layman terms
hb(discord) - Yo are you still there homie
hb_ack(you) - Yea for sure brother.
yeah ik
Just think of it that way and you got a grasp 
not sure if you can define an embed in the embed kwarg
ik whats a heartbeat i just didnt know how it would get acknowledge
never tried it before though
yeah true LMAO
bro its oop
it doesnt matter you always set the class in there if you make a var thats just a class instance
it’s not even oop. It’s just basic programming
i mean class instances
key word argument
!arg-kwargs
*args and **kwargs
These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.
Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.
Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.
Use cases
• Decorators (see !tags decorators)
• Inheritance (overriding methods)
• Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
• Flexibility (writing functions that behave like dict() or print())
See !tags positional-keyword for information about positional and keyword arguments
That’s not really a thing you ask us to help you fix
bro you forgot to close them its basic py
It’s syntax
why is it better?
print(str(a) is what you did
Because using on_message with event overrides the built in message event listener(which listens for commands)
Robin is here. Time to go. 🚶
yes you can
same here btw love your pfp🏃
People use on_message event all the time, and are like, "why isn't my any of my commands working?" save yourself the hassle and use @bot.listen(). There are a few usecases for on_message event but unless you really need those don't worry about it
ok thanks for clarifying
hey robin in listeners how does the on msg event not get overwritten does it proccess the command?
Wait
Listeners are fundementally different from events since events sort of "overwrite" the actual event like you said, but listeners just get added to a list (not exactly but you understand my point), and when an event happens, ever coro in that list gets notified
Am I tripping or something or did you not put the kwargs in the class constructor
yeah but like how exactly
nah youre not tripping
You put title and desc outside of the actual embed
Think of it like this:
@listener_decorator(func):
someList.append(func)
async def some_event(...):
for func in someList:
await func(...)
@listener_decorator
async def some_other_event(...):
...
Dude you don’t need to close anything
You just need to put title and shit inside the parenthesis after discord.Embed
@client.command()
async def ban(...):
embed = discord.Embed()
embed.title = ...
embed.description = ...
embed.color = ...
embed.set_footer(...)
await ctx.send(embed=embed)
discord.Embed(title="yessir")
properly
Why someone would build embeds like this is beyond me
i wanted to know exactly but ill check sec code 😔
Well their current code looks similar, so if they want to keep it like that they can use that route
embed = discord.Embed(
title=...
description=...
...
)
``` works too
I meant the part where they have
title = "User banned",
description = f"{member.name} has been banned by {ctx.author.name}",
footer = "{time}"
color = discord.Color.000000()
Why is it all inside the coro though
why not construct it ouside, then pass it in and save yourself the headache of where to close it
There’s nothing wrong with that.
memory optimization 
who said there was something wrong with it?
👁️ 👁️
why is it all inside the coro
I was talking to Robin
Literally use vsc to figure this out
If you put your cursor beside a parenthesis
It underlines it
With its counterpart
you forgot a coma in footer and thats now how you do it lol
Really isn't but it makes it hard to read
I'm all about readability you know
!d discord.Embed.set_footer | is how you do it
set_footer(*, text=Embed.Empty, icon_url=Embed.Empty)```
Sets the footer for the embed content.
This function returns the class instance to allow for fluent-style chaining.
I mean. I prefer optimization over readability
Even if it is minuscule
It’s good practice.
same peformance > readability
if you cant read it guess you dont have enough experience 
bro i told you already
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.avatar "discord.User.avatar")
np
This module provides various time-related functions. For related functionality, see also the datetime and calendar modules.
Although this module is always available, not all functions are available on all platforms. Most of the functions defined in this module call platform C library functions with the same name. It may sometimes be helpful to consult the platform documentation, because the semantics of these functions varies among platforms.
An explanation of some terminology and conventions is in order.
• The epoch is the point where the time starts, and is platform dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC). To find out what the epoch is on a given platform, look at time.gmtime(0).
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
"readability counts" yeah
I only prefer optimization if readability makes the code extremely unoptimized
Yeah, that's why I prefer readability 99% of the time
Sacrificing a few lines to make something more readable shouldn't come at an extreme performance cost
even if it’s minuscule, it’s good practice.
Like the earlier case about declaring embed object inside the ctx.send() vs outside, I think seperating them is a better idea since it's easier to tell which part does what
Exactly, it's a discord bot at the end of the day
Most of the time you're sitting around waiting for a user to trigger a command
Okimii was referring to memory optimization. There’s no point in declaring a variable if you're just gonna use it once. That defeats the whole point in why variable data types were made.
Do you have any error handlers?
Those might be eating up your errors indiscriminately
🗿
Odd because that looks perfect to me
Unless it's something tiny
on_command_error()
Or a function like that, do you have any?
whats wrong?
Either way if there is no reference to the newly initialised variable it's gonna be garbage collected, but still best to avoid
Gonna point out a few things, if you're gonna use {} inside strings make sure it's an f-string, and if url=None you can just omit it
text=f"{time}"
That’s just shitty ideology. The project itself shouldn’t dictate whether or not you the developer should strive for better practice in your optimizations.
Even with those it should still send the embed,
Readability vs performance is subjective, if you believe readability is better than performance, go for it in your projects. If you believe performance is better than readability, go for that as well
Unless one is really impacting your project in a negative way, it shouldn't be a big deal
as robin says, you can omit url
Readability is at at the slightest level of priority. In the end you should be worrying about functionality. Readability only counts in collaboration. If you understand your own code which can be influenced by things like comments and shit readability isn’t that much important. In this case creating an instance of a class in the coro isn’t that much unreadable nor low level.
really depends tbh ig readability is better for everyone while performance is more for companies and advance developers
how those that work?
where is this time variable coming from
thats like saying you did good code back then and now you do worse
no but where do you declare this variable? unless its not a variable
Comments exist for a reason
^
i doubt you would, you would understand better
They were designed for that purpose. For increasing readability and understanding of what code does.
its time.time() btw
from time import time i think
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
yea if he directly imported the name time() would work
everything isnt about the python zen bro
yes. but it's better to use timestamp
I never hinted at the fact it didn’t exist. I’m saying with the example you provided it would of been aided by adding comments.
no-no
They were designed for that reason alone
As long as your wiring accurate comments you’ll be fine.
embed = discord.Embed(........, timestamp=datetime.datetime.utcnow())
if were going by the python zen then beautiful code that goes by performance is better than ugly code that is more readable with extra variables and useless things, exactly it doesnt matter its all opinions
everyone likes their own thing
why can't you have both beautiful and optimised code
yes
You act like someone’s gonna get totally confused by reading their old code.
some people say its ugly because its too complicated to read 
you need to delete embed.set_footer and add timestamp in embed initialization
If it’s in that sense you probably don’t know python as well as you much as you think you do and the old code you have is probably a boilerplate your stole from stackoverflow

thats just bad style and not performance
ah sorry i never read the msg you were replying to
That’s why comments exist god dammit 😭. As long as you get the understanding from the comments the full understanding will come later.
Then that’s your own fault then if you don’t understand your own code
If it’s low level/unreadable code
i dont read comments i read code tbh
You should
but it's better to do readable code
guys really can we go on topic?
there are no questions
Suggest more topics here!
Fuck off with slash command rollout and message intents.
ye
slash commands are better than command prefix
Omg okimii. You hurt my head sometimes.
you dont know a bots prefix where do you go slash commands its like a global prefix

Reason why its better
because someone won’t know a bots prefix and with slash commands they don’t have to….
i just like auto complete part of them
yes?
Idrc for emphemeral
dude that is literally the easiest problem to solve. This is like the worst type of leverage someone could use to say slash are better.
most people. when their bot gets mentioned they will respond with a prefix
custom status, about me, name, etc
That is like a minuscule point in why they are better than prefix commands
while slash commands you just type a /
My biggest problems with slash commands
- No aliases
- They can take up to an hour to register globally
Especially the aliases part. I need my aliases.
why need an aliases when they show all of the commands?
Because ux
with categories for each bot
🚶
bro
you can duplicate commands with different name 😄
That has literally nothing to do with why aliases exist.
^
why have aliases when you can read all the commands?
theyre in your face
how do i use webhook in discord.py?

I hated slash commands at first, now I quite like them because it's easier with the autocomplete stuff, options
!d discord.WebHook
!d discord.Webhook
class discord.Webhook```
Represents an asynchronous Discord webhook.
Webhooks are a form to send messages to channels in Discord without a bot user or authentication.
There are two main ways to use Webhooks. The first is through the ones received by the library such as [`Guild.webhooks()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.webhooks "discord.Guild.webhooks") and [`TextChannel.webhooks()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.webhooks "discord.TextChannel.webhooks"). The ones received by the library will automatically be bound using the library’s internal HTTP session.
The second form involves creating a webhook object manually using the [`from_url()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook.from_url "discord.Webhook.from_url") or [`partial()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook.partial "discord.Webhook.partial") classmethods.
For example, creating a webhook from a URL and using [aiohttp](https://docs.aiohttp.org/en/stable/index.html "(in aiohttp v3.7)"):
ty :D
I have been working on my bot from 2 weeks now and i think I'm ready to use a db now
Any suggestions.
I will be using mongodb
await message.channel.send('Member count: '+ str(len(message.guild.members()))+"\nStarted: "+str(message.guild.created_at))```
saying list object is not callable idk what to do how would you fix this
It's worth keeping in mind the sort of data you will be modelling, and if a no-sql or sql database will be easier to model said data
!d discord.Guild.members
property members: List[discord.member.Member]```
A list of members that belong to this guild.
oooooh so I have to remove the ()
Yeah
is there a way to make a command say !record, then the bot copys the next message somone says and says it back
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
Can you make it so when’s user clicks a message they can’t click on it anymore
thasnks
i still dont know how the bot would copy the persons message, since this one looks for a certan thing in amesage
It returns a message object
So you can get the content of it
If I were to click the button once I wouldn’t be able to click it anymore using discord.py
!d discord.ui.View.stop
stop()```
Stops listening to interaction events from this view.
This operation cannot be undone.
^ but keep in mind there is always a schema. And more often than not, it's worth trying to figure out before you write anything significant
@slate swan
i have no idea how to use this, my bot already have commands (@bot.command()), how do i put this in use?
There are examples in the docs
await message.channel.send('Member count: '+ str(len(message.guild.members)))```
anybody know why it says there's only 1 person in a 552 person server?
Intents
i saw it, but i dont fully understand how to implement it to my bot
what
uhhh bad choice
how would you do that?
mongodb isn’t relational when it comes to data.
if you want a db just use postgresql.
it’s fast with asynpg, it’s kinda easy to learn, and it has relational data
!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 the Members and Presences intents, which are needed for events such as on_member 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.
bruh
so would I have to do any change to this code once I do that
So I migrating from discord.py to nextcord, and suddenly my serverinfo/avatar/userinfo command doesn't work (I think all command that has footer/timestamp). Can someone help?
Can we see a code example?
Wait
@client.command()
async def info(ctx, member: nextcord.Member = None):
if member == None:
member = ctx.author
roles = [role for role in member.roles]
embed = nextcord.Embed(colour=member.color,
timestamp=ctx.message.created_at)
embed.set_author(name=f"User Info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"Requested by {ctx.author}",
icon_url=ctx.author.avatar_url)
embed.add_field(name="ID : ", value=member.id)
embed.add_field(name="Server Nickname : ", value=member.display_name)
embed.add_field(
name="Created At : ",
value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(
name="Joined At : ",
value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"Roles ({len(roles)})",
value=" ".join([role.mention for role in roles]))
embed.add_field(name="Top Role : ", value=member.top_role.mention)
embed.add_field(name="Bot", value=member.bot)
await ctx.reply(embed=embed)
Ups
What do you mean it doesn't work?
When I run the the code, everything is fine
But when I run the command, the embed won't appear
errors?
Do you have an error handler eating up errors?
I think avatar_url was replaced with avatar.url
At least in discord.py v2
Ya
Then remove it
The error handling embed of missing arguments were fine
Ok lemme try
Ask a specific question
Ah yes, you're right
Thank you for helping
not a question 
@manic wing can help you with that hes done many
umm so
just dont send diff messages
❌ ⭕⭕\n⭕ ❌ ❌ \n❌ ❌ ❌ like that
i mean you need to send
so calc all lines first
hey just tryna do a cog reload command, getting an error unsure what it the meaning of it
Code:
error:
Heh
Don't use a bare exception
Specify the error you want to catch
does @commands.is_owner() refer to the bot owner or the server owner?
it's all fixed
Bot owner
alr thanks
It's terrible practice
!d discord.ext.commands.Bot.load_extension
load_extension(name, *, package=None)```
Loads an extension.
An extension is a python module that contains commands, cogs, or listeners.
An extension must have a global function, `setup` defined as the entry point on what to do when the extension is loaded. This entry point must have a single argument, the `bot`.
yeah im just learning as i go
first time touching cogs, obviously i'll fix things once i get everythin goin
This should be something you learn then
just doing the bare minimum rn
Uhh, dont say too much at once, they said, they just started cogs
Wouldnt you be annoyed if you were a beginner and you would be loaded with stuff at once to use with stuff you were just testing out and didnt have a good grasp of
No
orait
How
I always get ignored or taken as a joke 😭
Knowing to not use a bare exception is beginner stuff
Or you could of just had someone tell you how to do it properly
Dude, its not, you barely need any error catch in an except while learning basic python
How
Or most of them are sometimes not taught*
Error handling is extremely important
I know, that came out wrong lmao
no need to argue about it, pep did say it in a "rude" way instead of just letting me know "hey do this instead of this" nonetheless he made me aware, no need to continue about this. again im just messing around with this whole cog thing, i'll fix up the patches once i actually get to it
We were actually arguing about something else, dw
How was I rude
an argument 🗿
Hey @brittle axle!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
I did recommend them to not do bare exceptions
https://paste.pythondiscord.com/ozahubafuz The problem is that no errors show up in the terminal but the bot wont respond
Explain to me how I was dismissive
"Do it the first time" was so so bad to say
Where's your event decorator
oh
How? Doing it the right time should be everyone's goal
Can you show your full code?
I did tell him to only catch specific errors...
I think they just forgot the decorator
I told them and they disappeared
i put the decorator but it still didnt work
Restarted the bot?
yes
Can we see how you did it?
^
@final iron I don't follow pep8 
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
https://paste.pythondiscord.com/agakoluwaf here is the code
Internet lag rip
Don't change your presence in on_ready, Discord's api really doesn't like it and can disconnect you
Ah yes when "full code" means "partial code"
I didnt see that message lmao
Also, you can either make a task (if you wanna change statuses) or a seperate function to change the status of the bot, do not do it in on_ready
i thought i had to give the full code with the decorated
ok
I say full code even if i only want partial code
Bare exception 🗿. Using them is bad practice, check out the docs for the errors that can be raised and handle them appropriately
What bot you want to build?
Using a bare exception can cause your code to hide errors you want to see
what is a bare exception though
Are you actually calling bot.run()?
the first parts of the code i followed a yt tutorial
then i started use the docs lmao
yes, yes indeed
ohh ok
nope there's a difference between those two
the second one is much better than the first
try:
uwu
except: #bare exception
--------------------------
try: .....
except ValueError: #error specific exception```
BaseException -- this is the true class that all exceptions inherit from, like SystemExit and KeyboardInterrupt
I have i just forgot to copy that part
BaseException is where all Exceptions inherit from
a bare except: is equal to except BaseException: whereas except Exception: will allow the SystemExit or KeyboardInterrupt to propagate outwards
there are some BaseExceptions that are not Exceptions
which include SystemExit, KeyboardInterrupt and GeneratorExit
yes, is that not what I said lol
lol
🙃
tldr except Exception: isn't nearly as bad as except:
but you can, and should, get more specific
i guess you could technically say that to some extent
no, bare exception is just except: afaict
but it still specifies which type of exception
rule 7
its a lot better than a bare except, and in quite a few cases with dpy its the only viable solution as its to catch user generated errors
Rule follower yeah
mhmm
for example, dpy internally uses try/except Exception when invoking a command in order to run the error handler
@slate swan yeah i'm on topic 😝
Yeah, I can simply mass ban all of the server members with a single command not a nuke
cof cof

tbf its extremely easy to write extremely destructive code
Uhh i was kidding
especially when developing 
I have not ever done anything like that when fixing stuff nope
asyncio.sleep
the library should handle ratelimits so it wouldn't be a problem
except for a maximum limit of bans for a day IIRC
Yeah, my friend tried to nuke my server with his bot (totally not a coded bot) in the hopes of making it funny to nuke my server, imagine
😔
Just "tried"
Nah he told me to invite it to my server, I invited it to his server and nuked his

Welp
Ignoring exception in on_raw_reaction_remove
Traceback (most recent call last):
File "C:\Users\\Trello\venv\lib\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "C:\Users\\Trello\cogs\Reaction.py", line 97, in on_raw_reaction_remove
role = discord.utils.get(member.guild.roles, id=reaction_role["role_id"])
AttributeError: 'NoneType' object has no attribute 'guild'
Wow
@commands.Cog.listener()
async def on_raw_reaction_remove(self, payload):
# check if reaction role is in self.db
reaction_roles = reaction_roles_data.get(payload.guild_id, None)
if reaction_roles is None:
return
# check if reaction role is in self.db
for reaction_role in reaction_roles:
if reaction_role["emoji"] == str(payload.emoji):
# remove role from member
member = payload.member
role = discord.utils.get(member.guild.roles, id=reaction_role["role_id"])
await member.remove_roles(role)
break
member is none in a reaction remove
always

Use a search engine
You gives you a user id and guild id, you can fetch a member object
i thought
member = payload.member
I meant, copy them from a website or smth
But but, I'm willing to do it for a free nitro
payload.member is always None in this case
o
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
!rule 9
Lmaoooo
for some reason whenever i try to put random.randrange() in a url in discord.py it only sticks to one number and one number only, only if i restart it changes but it only sticks to one specific number and not a random one, can anyone help me with this?
Is it defined outside the function?
Show your code. Seems like that’s being evaluated at load time
You know what, sure
!d discord.Client.get_user you can try to get the user from the cache
get_user(id, /)```
Returns a user with the given ID.
Why would I ask you like that...plus i guess imma remain an average never nitro used user
hwo do that
# vars
url = f'https://games.roblox.com/v2/users/{random.randint(0, 200000000)}/games?accessFilter=Public&sortOrder=Asc&limit=10'
response_rblx = requests.get(url)
games = Dict(response_rblx.json())
#command
elif user_message.lower() == ';randrblxgame':
game_id = games.data[0]['rootPlace']['id']
await message.channel.send(f'https://www.roblox.com/games/{game_id}')
client.get_user(varwithuserid)
keeps sending the same int
Coincidence?
this may return none, in which case you can attempt to fetch the user as well
no ive tested this a bajillion times
client 😔
Idk how much this
I use client because commands.bot is a subclass 
^^
Yeah I know
how do with commands
pycord.Bot 😔
pycord 😔
its where you're using the random number generation, you aren't using rng in the command body from what I can see
py-cord*
Us 😔
why's everyone such a boomer 😔

Has the same package name as dpy actually, so discord.ext.commands.Bot

Don't use requests, it's blocking. Also, don't use an on_message event for command. Use the command frame work
One's a client in the base library, the other one is the subclass in commands that supports like, cogs n shit and command decorators
.......
can you not
py**-**cord sucks already, you'll make me hate it more by reminding me of things that I hate it for 😔
? how get id
If you mean pycord.Bot I think it's for their slash commands
What's so bad about it?
lmao
yeah why not make them the same class
It's.. literally just a dpy fork
disnake bias 😔
does anyone know how i can keep my bot online 24/7?
Ask the devs
This is why disnake is superior
Dude, I just explained
.
that's not true tho
i dont need to keep my pc on 24/7 for that?
they have discord.Bot, and discord.Client, in addition to discord.ext.commands.Bot
No you didn't
Yeah, forget the subpackage commands, point still applies
oh dang ty
pycord.Bot is for slash commands
Also I know they kept the discord name space
Just saying pycord for clarity
Both discord.Bot and discord.Client shouldn't exist IMO.
It should be either one or the other
It looks like it's just for convenience. Commands is kept for backwards compatibility, presumably, while this new Bot is specifically for the slash commands which discord is trying to force us all to use
pls dm me your reasons I wanna hear them
sure
How come? One supports commands and interactions, one doesn't
how do i gte the var with user id
I will, in some time, I gotta make a news command rn 😔
its on the payload object
!d discord.RawReactionActionEvent.user_id
The user ID who added the reaction or whose reaction was removed.
- Client: supports all of the standard features, but not all interactions
- Bot: supports application commands
- commands.Bot supports application commands and prefix commands
There is no reason from my point of view to not add application command support to Client if you're already adding it in the main library to Bot
What exactly are the 'standard features' though? Client is a client, bot is a bot. A normal user could also have been a client, during a certain point in dpy's history, but it's literally just an interface to state and gateway both
So it kinda makes sense to separate a Bot from a Client. People won't necessarily be using all the stuff that comes with a Bot, nor should pycord force them to, imo.
What are the downsides to using commands.Bot though
Maybe you don't want a bot
Doesn't tell me anything
Just something that listens for reactions or 🤷♂️
Or a low level interface to Discord's http api and gateway, whatever you may use that for is unknown, maybe you want your own bot class
Yes, because it's a subclass of client
what else could i use instead of requests then?
aiohttp or httpx
!pypi aiohttp
!pypi httpx
"next-gen"
aiohttp is more preferred
Yes Gen "X"
lmao
Httpx
anyone ever create a bot and then see that people only use it for the simple features and never touch the stuff that took you ages to code
i created a whole timed battle system for creative prompts and it's been used a total of 2 times this month so far
while the most used thing is the art prompt which just shows pictures from the art subreddit, while my bot is for creative prompts
what is it that discord wants
:incoming_envelope: :ok_hand: applied mute to @stark solar until <t:1645766611:f> (9 minutes and 59 seconds) (reason: newlines rule: sent 137 newlines in 10s).
What’s the problem here?
The console says nothing related to the code
The giveaway command runs but no giveaway embed is sent
!UNMUTE 419754823815266304
:incoming_envelope: :ok_hand: pardoned infraction mute for @stark solar.
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.
use that though
okay
Reply with ping *
https://paste.pythondiscord.com/urejicaloj
this is not working, it has no errors idk why
(pasted it twice, oopsie)
Did you do update_stats.start()?
Did you do update_stats.start()?
that's all the code that could possibly cause an issue
nothing else
I'm 100% sure
Cause I can't tell what this even means
sorry, Im not really a developer type, trying to figure something out on my own, speaking through the developer
on_ready is quite a meaningless event to listen to, I'm still confused as to why so many people rely on it so much
im playing a game of telephone :C
okay, do you know the game telephone? you get told something and you pass it on
and no matter how simple it is, it gets very messed up
Yes, I know the expression, but what do you need help with? You're refusing to provide any more information or actually answer any questions I have
this is what they said
no, hes just stupid and does not like getting help, so im trying to find a solution
? This is stupid, thanks for wasting my time 👍
JSON is not a database, if you prefer to work with JSON-like objects, use something like MongoDB.
There are way too many options for a database out there too, just pick one that you feel is appropriate
I personally don't have much experience with databases other than MongoDB, but it has worked fine for me so far.
https://jsonbase.com/#docs?ref=apilist.fun
you could use this though
if not mongoDB
any free bot hosting sites yall know of?
replit there isnt
Any that are dedicated to hosting a Discord bot are a waste of time and money. They usually target those who don't care enough to learn how to operate a computer via cli or those who have no clue what they're doing. Just pick up a free micro (for 1 year) from AWS or check out Google's cloud computing services for a free vm.
AttributeError: module 'discord' has no attribute 'ui'
``` this is my error
run python3 -m discord --version and show the output
replace python3 with however you run python
I second this, AWS has a free tier that provides 700 free hours per month for a year iirc for their t3.micro or t2.micro instances
going with one of the bigger providers is honestly a better idea imo since they have a vast variety of suites in case you decide to expand your bot, such as website hosting, domains, load balancing, automatic scaling, databases, storage, etc are all provided in one ecosystem
That being said, there is definitely a learning curve to being able to operate one of these vms. Deploying stuff for production in itself is a deep rabbit hole, just thought you should be aware.
^ I second this
It's not all point and click like it may be for the other providers, but with that comes more customizability and options
I have used AWS' free tier, and the micro tier is not all that bad if you're starting out. They are definitely pretty weak and can't do much lifting, but it's way better than I expected (and magnitudes better than trying to abuse repl.it for many reasons)
The micro tier is 2 gb memory and 2 cores iirc?
One plus is that the network bandwidth is pretty good, around 1GB up and down
Honestly for a discord bot this should hold for a good while
I'm pretty sure only t2.micro is eligible for free tier
Considering discord bots spend 90% of the time waiting for a user to trigger something and 10% actually doing something, 2gb ram and 2 cores suffice plenty
yeah something like that
Which is 1GB ram and 1 v core
not too bad, since most people going for the free tier don't have much requirements for their bots
Yeah, it's actually pretty good, especially for private bots or those that are below a few hundred guilds
How's it like with google?
Never used it
Ah, some of my friends were using their firebase (or firestore?) suite and i was curious on how it differs from AWS since i mostly use aws for my hosting needs
How do you find AWS?
My experience with it?
Yeah
I mean i haven't tried any of the others so i honestly can't say, but so far it's been amazing. It's my dad's account and he's fine with me using it so I don't worry about the cost all that much but generally very excellent
Rip, why do I feel like I always advertise Oracle ;-;
Oracle 👀
How do I replicate yggdrasil's userphone command
@languid wagon :white_check_mark: Your eval job has completed with return code 0.
28-07-2019 01:58:26 UTC
make a dict containing origin_server/channel_id as a key and target_server/channel_id and do stuff with it in on_message
stuff with on message 👀
*in
heh?
meh ¯_(ツ)_/¯
!d discord.Object.created_at
property created_at: datetime.datetime```
Returns the snowflake’s creation time in UTC.
Just create an instance of Object with that id and use the .created_at property
It's okay, I've been there and attempted that too
After implementing it myself, I checked the GitHub repo for discord.py (to check if it wasn't implemented for Object) and turns out that it already exists.
Same, I also cannot code properly
How to run exe from py
u need to do os.system(name_of_exe.exe)
and make sure the script is in the same folder as the exe
+1?
Ah wait nvm
I thought u meant ID of member and stuff
sorry
Easy way to access folder inside your project? (Without using absolute path)
Example:
folder_1:
folder_2:
some_other_files
folder_3:
folder_4:
the_file_i_want
script_folder_1:
main.py
script_subfolder:
script_1.py:
I want to access the file in the folder_4 from script 1 for example, without going mad
In python general no one answered to me so don't blast me up please (Hunter...)
@maiden fable hey it is in the same folder btw still not found showing replot
Use relative paths
It is comming permission denied
whats the issue?
Subtract the current time from the .created_at
Well yeah, you need to convert the tz of the aware timezone to utc so you can actually operate on them
Make no mistake, timezone stuff is horrible in Python
smh
thats why you send a bit more context to what you're trying to do, if you really cut out the part where its your problem, then whats gonna cause the error?

ASHLEYYYY
caaaaeeeedennnn
sleeeeeeeep
why my hyperlink not work 🗿
- note that it will only work in interaction responses or embeds
- extra space
ok ty :V
ty 2
is fine
anyone mind giving some suggestion commands/features for a community utility bot
wow cant even match my energy 🙄
uwu we're alike
Url shortener uh,
qr code generator
👀
what could it be of?
? someone sends a link and it generates a qr code
Someone sends their internet name and pass and a QR code is generated 😄
I mean, that is a feature in mobiles
okay well a feature more for the server mods
How it gonna help the mods tho 👀
just utility basically
Okay, ig
no i mean that's what I want
Ah okay
I already have that and to decode too 😔 tell something else
Lmao
Just make a functionality to let user make their own customizable profile for whatever reason
I hope u won't add more of those cringe commands
Whats some fun small commands?
Getting stuff from APIs is... nice?
very nice
you are not old you are ancient
604855154365300753
493451846543998977
(First is Duck's ID, Second is mine)
Hmm more than 1000 days old
why ctx not defined?
ctx*
oh i see
i was trying to speed run it i should take my time
check spelling of async def meme statement
yea just saw it was cx
oops 😅
its alright
@bot.command(aliases=["message"])
async def msg(ctx, *, args):
class dict(*args):
{"description": args}
e = discord.Embed(description= dict["description"])
await ctx.send(embed=e)
``` yo does this look like it works or what do i need to change for the dict embed to work
isn't sending rn
cs.get
Why are you dividing a variable to get req and doing that asynchronously 😳
What's this class crap, just pass args directly
e = discord.Embed(description=args)
Tf u r doing?
i want to add multiple keys, for title, img, author, urls etc
i want it to become an embed builder command, so a user can create any embed
and i was told i need to make a dict class embed for that
well yeah, no need of creating your own class for it
how can I then pass values for the keys to create an embed?
Just like this
that's only args, but i also want to pass a title, author, image, thumbnail, url, footer through the message
How will user run the command
depth doesn’t affect how well you can swim
🚔


