#discord-bots
1 messages · Page 912 of 1
Was the function async?
yes.
Hey daniel
Show me how you call it
What can I do here?
@glossy hilldonate money to ukraine
Put "ctx" inside the parentheses if you have ctx
read it
You can ask for help, help people or talk 
await fornut
Sorry, but no
and try understand it trust me@slate swan
spoonfeeder
damn u really asking obama to trust you
Use await before you call fornite
he can trust me i dont trust him.
racist
But u can help others who are in here asking for help
the assumtion was racist lol
not called spoonfeed if he doesn't understand
im so fokin dumb im so sorry for annoying u with this question
sometimes my brain just dies after 5 oclock
I'll tell you right away. I use google translator and I can't write fast.
@hoary cargoi mean u could have let him try figure it out
and yes. I am a Russian person
no its 5oclock and my brain dies after 5 oclock
i only come here when i have brain damage
All persons welcome
so like tuesday's and 1 other day
hard to answer
thanks
what u thinking about?
@glossy hillprivet
what if I write in Russian?
No
@honest vessel how are you mf
imagine
@velvet tinselam good my mf how R u mf?
不觉得他会懂
well good
u kinda black tbh
😔
Doing well
@velvet tinselu chinese?
Yes
xiao piaopiao
hej hur mår du idag?
a esli tak?
cool my drawing teacher was obsessed with japanse he taught us arrigato n stuff n bow n hold hands 🙏🏻
mycket bra. Tack själv?
oj nämen vad angenämnt att du talar svenska
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
god damn
@regal covetallar gör man på bröst, talar gör man med munnen
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
hahahah
?
i have no idea how i spelled that wrong in my own language haha
Lmao
hahahaha jösses
?
yessir
Dead chat
@regal covewhat is role lovefest?
its from valentines day
är det möjligt åtminstone på engelska?
aaah i had a backflash from WoW xD
is it possible at least in English?
u get an A for effort
?
yes englush pl0x cause we have to respect we all have diffrent languges but we have 1 common its english not russia or chinese
or spanish for that matter or france
yes
got it
our second lang to use is python kek
Lmao
hey, how would I display the 🗑️ emoji in code, ik I need the Unicode version but I don't know what that is (I've found a few different codes) and I can't remember how to actually format the emoji in code
i once heard a guy on tiktok say there is one universal language we could use to talk to aliens
HEY
math..
copy this \🗑️
just do :emoji_name:
i got so mad when he said that
Like :flushed:
Can I ask you a question
Can someone help me in #help-lollipop
go ahead
@flat solsticea tips: do ur : get emoji then put a \ backslash infront of it n post it n u got ur unicode
u dont need to ask to ask
fuzzing hate that
?
what?
niet
вперед, продолжать
niet para russka
thats what go ahead means in russian
ok
someone help in #help-lollipop
how do you feel about pirates?
what? i guess i dont like them since they are crimminals
pirate movies are cool tho
this doesnt work in all situations, e.g. adding reactions or searching for 😳 in a message
pls
I'm not in that sense
I'm sorry, but I have Parental control on my computer.
😔
Try before buy is a good thing i support. Who wanna buy clothes u cant test then it dosnt fit u. But hey no return here. I wish games did give out more demos. WOrld of warcraftg u dont donwload pirate u get a week to test it out no limits.
What?
why?
Mayeb u talk abiout somalian pirates
from this point on in more detail
@glossy hillmaybe u should define pirates next time 🦜
the heck is happening
im trying to use pebblehost to host my bot, but it says "module discord not found" even thought i did "pip install discord" in requirements.txt
pirates
@slate swannothing he asked if we support pirates? 🤷🏻♂️
pirates are overrated
it should be discord.py in the requirements file
not discord and no pip install
yeah and you need to specify the version
no. I'm not in that sense
i just type 'discord.py'?
discord.py <= "1.7.3" was it?
assuming you want 1.7.3 it would be discord.py==1.7.3
Now it says 'no module name requests'
well add it lol
how
cool
and what is there to do with Python?
code ur own girlfriend
I have 1 minute left. all pack
ccya in keiv - not
bro scroll up
you can do anything with it lol
Traceback (most recent call last):
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\tree.py", line 879, in call
await command._invoke_with_namespace(interaction, namespace)
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\commands.py", line 470, in _invoke_with_namespace
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'load' raised an exception: AttributeError: 'Interaction' object has no attribute 'command'```but interactions do have command attrs, unless I misunderstand this https://discordpy.readthedocs.io/en/master/interactions/api.html?highlight=app_commands#discord.Interaction.command
Anyone know how to fix this?
looks like you forgot the f at the start of f"{member.mention} ..."
not that the mention would work in the embed title anyway
you probs have somehting likepy embed(title="{member.mention} was unmuted")first off your going to want to wrap it as a f string py embed(title=f"{member.mention} was unmuted")and secondly mentions can't be titles, so just remove the .mention as it will show the user name and tag
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | KeyError: 4
so I see @unkempt canyons snippet cog has support for GitHub gist links, I had a go with it in #bot-commands but couldn't seem to get it to snippet the gist, how does it work?
also how do I specify both a first and last line of a GitHub repo in the link, whenever i try to grab and link it just grabs one line
!src
@flat solstice https://github.com/python-discord/bot/blob/main/bot/exts/info/code_snippets.py here it is
how do i fix it then
you set a correct key?
it is correct tho
so you're calling python a liar
i just chcked
i didn't
i copy pasted it
do i need anything in my main .py with the token
or just in the .env
my pre-commit is so fucked what the fuck
yeah I looked at the code, I'm just not sure how to structure GitHub links with both start and end points (more of a GitHub related question from a GitHub noob) and i also tried sending a gist with a heading link in #bot-commands but @unkempt canyon did nothing with it
rip, whathappened
everything
oh
fucking hell
gl mate
why is this working globally
@tree.command(description = "Add Money To people", guild=discord.Object(id=954052385309863998))
async def adminsetmoney(interaction: discord.Interaction, userid: discord.Member, amount:int):```
:D
?
I'm getting this errorpy File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\message.py", line 1504, in add_reaction await self._state.http.add_reaction(self.channel.id, self.id, emoji) File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\http.py", line 502, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 10014): Unknown Emojiwhich I think is being caused by thispy try: await message.add_reaction(":wastebasket:") except NotFound:
why does it not import slash commands for me?
from discord_slash import SlashCommand from discord_slash.utils.manage_commands import create_option
are you getting any errors
Why use a 3rd party lib when dpy has slash commands?
Makes 0 sense
pip install discord-py-slash-command
^^^
thx
👌
slash = SlashCommand(bot, sync_commands = True)
"SlashCommand" is not defined Pylance(reportUndefinedVariable)
just use main smh
while True:
string = (dtag)
tag, discrim = string.split("#")
taglist.clear()
altFinder = requests.get(f"http://api.antisniper.net/discord/query?key={akey}&name={tag}&number={discrim}")
altjson = json.loads(altFinder.text)
if altjson['success'] is True:
taglist.clear()
for x in altjson['results']:
taglist.append(x['ign'])
embed = discord.Embed(title=f"Accounts linked to {dtag}", description="\n".join(taglist))
embed.set_footer(text="dewier private bot")
await ctx.send(embed=embed)
break```
why does it send a message twice
Can be more?
Do you have 2 instances of your bot running?
I dont think eo
be more of what
youre just making your bot freeze
what d u mean
it works now, but what do u mean by freezing
What do I need to do?
requests.get() is blocking
whta do i do instead
!d aiohttp.request
async-with aiohttp.request(method, url, *, params=None, data=None, json=None, headers=None, cookies=None, auth=None, allow_redirects=True, max_redirects=10, encoding='utf-8', ...)```
Asynchronous context manager for performing an asynchronous HTTP request. Returns a [`ClientResponse`](https://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ClientResponse "aiohttp.ClientResponse") response object.
!pypi aiohttp
how do I make my bot actually check someone is banned when it unbans
instead of just "unbanning them in chat"
!d discord.on_member_ban
discord.on_member_ban(guild, user)```
Called when user gets banned from a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.bans`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.bans "discord.Intents.bans") to be enabled.
!d discord.Guild.unban
await unban(user, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
on_member_ban gives you a user object and a guild object
You can use the unban method of the guild object to unban the user
I wasn’t aware it gave you a guild object
Since you can get guild from member.guild anyway
Returns a user object though
I want it instead to realize im not actually on the ban list
Oh we’ll get guilds.bans()
So it can return a member object
Then check if the banned member was in the banned members
Or vice versa for unbans
Same concept though
are there any rules here?
@commands.commands(name='decancer', aliases=["dc"])
@commands.guild_only()
@commands.has_permissions(manage_nicknames=True)
async def decancer(self, ctx, member: Member = None):
"""Decancers a user's nickname."""
if not member:
member = ctx.author
name = member.display_name
while name.startswith(tuple("!\"#$%&'()*+,-./:;<=>?@")):
name = name[1:]
if not name:
name = "Decancered Name."
await member.edit(nick=name, reason="Decancer")
await ctx.send(f"{member.mention} was decancered by {ctx.author}. Their new nickname is {name}.")```
I get an error of indent but the indents seem fine to me, can someone double check them?
ok
which line? could be the docstring
what language is it?
py 💀
if altjson['success'] is True:
taglist.clear()
for x in altjson['results']:
taglist.append(x['ign'])
embed = discord.Embed(title=f"Accounts linked to {dtag}", description="\n".join(taglist))
embed.set_footer(text="dewier private bot")
await ctx.send(embed=embed)
break```
How do I make it so if they enter an invalid player it doesn't display an error
I wonder 🤔
await member.edit(nick=name, reason="Decancer")
do you mean to put that in the if statement?
ya
I only know python!
then indent it
@bot.command()
@commands.has_any_role("Guild Master", "Warden", "~", "dewier bot perms")
async def tagfinder(ctx, *, dtag):
while True:
string = (dtag)
tag, discrim = string.split("#")
taglist.clear()
altFinder = requests.get(f"http://api.antisniper.net/discord/query?key={akey}&name={tag}&number={discrim}")
altjson = json.loads(altFinder.text)
if altjson['success'] is True:
taglist.clear()
for x in altjson['results']:
taglist.append(x['ign'])
embed = discord.Embed(title=f"Accounts linked to {dtag}", description="\n".join(taglist))
embed.set_footer(text="dewier private bot")
await ctx.send(embed=embed)
break```
How do i make it so if the user doesnt have one of the required roles it displays an error messgae
you can handle it with try..except
??? show the new code
where would i put that
oh
do i put it before the if stateent
do you know what a try..except block is?
and I don't think you want to not warn the user about an error...
my brain is boiling!
okimii moment
!except
A key part of the Python philosophy is to ask for forgiveness, not permission. This means that it's okay to write code that may produce an error, as long as you specify how that error should be handled. Code written this way is readable and resilient.
try:
number = int(user_input)
except ValueError:
print("failed to convert user_input to a number. setting number to 0.")
number = 0
You should always specify the exception type if it is possible to do so, and your try block should be as short as possible. Attempting to handle broad categories of unexpected exceptions can silently hide serious problems.
try:
number = int(user_input)
item = some_list[number]
except:
print("An exception was raised, but we have no idea if it was a ValueError or an IndexError.")
For more information about exception handling, see the official Python docs, or watch Corey Schafer's video on exception handling.
bro
try and except statements
||im making my own Rust backend stack, @slate swan ||
which can be called a try and except block
tech stack
@commands.commands(name='decancer', aliases=["dc"])
@commands.guild_only()
@commands.has_permissions(manage_nicknames=True)
async def decancer(self, ctx, member: Member = None):
"""Decancers a user's nickname."""
if not member:
member = ctx.author
name = member.display_name
while name.startswith(tuple("!\"#$%&'()*+,-./:;<=>?@")):
name = name[1:]
if not name:
name = "Decancered Name."
await member.edit(nick=name, reason="Decancer")
await ctx.send(f"{member.mention} was decancered by {ctx.author}. Their new nickname is {name}.")```
lmaoooo
A "tech stack" includes all the technologies used to build a complete web or mobile application - like frameworks, cloud services, libraries, languages, and APIs. Let’s over-engineer a tech stack for an MVP, then simplify it. Learn how to build fullstack apps in courses https://fireship.io/courses/
#tech #code #dev
🔗 Resources
Learn about pop...
bottom stack is a what the heck moment
shit andy is here
ah a group of frameworks used for a app or website or something like that?
ehh i guess
Traceback (most recent call last):
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\tree.py", line 879, in call
await command._invoke_with_namespace(interaction, namespace)
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\commands.py", line 470, in _invoke_with_namespace
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'load' raised an exception: AttributeError: 'Interaction' object has no attribute 'command'```but interactions do have command attrs, unless I misunderstand this https://discordpy.readthedocs.io/en/master/interactions/api.html?highlight=app_commands#discord.Interaction.command
show code
@cogs_group.command(name="unload", description="unloads a cog")
@app_commands.describe(cog="the cog to unload.")
@app_commands.choices(cog=[app_commands.Choice(name=cog.split('.')[1].title(),value=cog) for cog in bot.config.initial_extensions])
async def unload_slash(self, interaction: Interaction, cog: str):
try:
await self.bot.unload_extension(cog)
embed.color=Colour.green()
embed.title=(f"__Cog {interaction.command.name.title()}ed__")
ephemeral=False
except Exception as e:
embed.title=f"__{interaction.command.name.title()} Error__"
embed.description=(f"There was an error trying to {interaction.command.name.lower()} `{cog.split('.')[1].title()}`")
embed.color=(Colour.red())
embed.add_field(name="Traceback", value=f"``py\n{format_exc()}``")
ephemeral=True
embed.set_footer(text=f"{transaction.user}", icon_url=transaction.user.display_avatar.url)
await interaction.response.send_message(embed=object_arg, ephemeral=ephemeral)
await self.bot.tree.sync(guild=Object(id=interaction.guild_id))```
error is from line 1 i assume
nice
today i went to a tour for my tech course and maybe im gonna learn cpp and or java in it and python which i already know it
c# > java
idk chief i cant really say anything about it
I can 🗿
Annything but java
so true
you mean the try:, why would that be causing the error. I think it's caused by thispy embed.title=(f"__Cog {interaction.command.name.title()}ed__")based on the error but that should be valid according to this https://discordpy.readthedocs.io/en/master/interactions/api.html?highlight=app_commands#discord.Interaction.command
Is there a function where I can pass in a User ID and it would return a username?
java is so irrelevant and useless for what
kotlin killed it
you will not say anything about java
:(
first time i've seen a java advocate ngl
then you should love C#
its basically the c families little bitch which got replaced by kotlin and more modern shit. pain in the ass to use and its pretty irrelevant these days
I tried it
kotlin is just idek
mhm
im fine with Kotlin and Java and Java is always better lol
the C fam is the best
anyway can someone help me here?
good thing im gonna learn cpp which i want to learn it personally and im gonna learn it in the course so pog
learn rust
practically everything is in the c family
this
and this
yeah
its way better than cpp
!ot shall we continue here
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
i got some code to compare
what's happening?
something
!d discord.Client.get_user, you may also use fetch_user which is a coro, you pass in the id, then the ret is a discord.User object. With this you can access the name attribute via dotnotation
No documentation found for the requested symbol.
💀
the comma!
thx u :)
!d discord.Client.get_user
Sorry, an unexpected error occurred. Please let us know!
ServerDisconnectedError: Server disconnected
LMAO
Guess it's not just the comma
!code
andy really got ratiod
!d discord.Client.get_user
get_user(id, /)```
Returns a user with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
an admin 🗿
I know one person who is very well versed in programming. he can help you.
??

Владимир Журавлёв#1316
anyone know how to fix this problem
i open the terminal in Visual studio code
and it closes with that error
💀
i'll go google
android dev
thanks google
why guild.owner returns none? my disappointment is immeasurable and my day is ruined
async def meme(ctx):
memeAPI = urllib.request.urlopen('https://ww.reddit.com/r/memes.json')
memeData = json.load(memeAPI)
memeUrl = memeData['url']
memeName = memeData['title']
memePoster = memeData['author']
memeSub = memeData['subreddit']
memeLink = memeData['postLink']
embed = disnake.Embed(title=memeName, colour=disnake.orange())
embed.set_image(url=memeUrl)
embed.set_footer(text=f'Meme by: {memePoster} | Subreddit: {memeSub} | Post: {memeLink} ')
await ctx.send(embed=embed)
why url no open
the error is clear
how to work this?
Variable names should be named with the snake_case convention, not mixedCase
Error is obvious
So
Meme_Data
PEP8 is made to be broken by people
So memedata
meme_data
If you think that's more readable than meme_data, sure
it's about readability
i still have this small problem btw
the way im caching user info is bugged to fuck
fml
whoever convinced me to switch to dbs i hate you 😤
https://stackoverflow.com/questions/48987006/how-to-make-a-discord-bot-that-gives-roles-in-python first google result
which well is wrong on what he needs
it's like 90% of what he needs
after just google how to detect when someone joins a server and you're done
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
U need members intent
Agreed
intents = discord.Intents.default()
Intents.members = True
bot = commands.AutoShardedBot(command_prefix="s!", intents=intents, sync_permissions=True, case_insensitive=True)
it's not like i don't have them already
what kind of amazon web service server would you need to host a discord bot on
wut abt the discord portal

i didn't started to code discord bots a day ago
it is 
t2 micro
anyway it's weird bc it shouldn't return none lol
Ik this might not be the right place since the bot is both Reddit and Discord combiend
But here I go
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Subreddit.submit_image() got an unexpected keyword argument 'image'
This is the error and
Here is the code
@client.command()
async def post(ctx):
def checkbot(message: discord.Message) -> bool:
if message.user == client.user:
return
await ctx.send("Insert Title Here")
title = await client.wait_for("message")
title=title.content
await ctx.send("Insert Image Link Here")
image_discord_url = await client.wait_for("message")
image_discord_url = image_discord_url.content
image_url = requests.get(image_discord_url)
image = Image.open(BytesIO(image_url.content))
image.save("redditpost.png")
reddit.subreddit("IslamicHistoryMeme").submit_image(title, image = discord.File("redditpost.png"))```
unexpected keyword argument 'image' means that you used it where you shouldn't or used it wrong
async praw documentation
should be image_path by looks of it
reddit.subreddit("IslamicHistoryMeme").submit_image(title, image_path = "path/to_image.png")
never done that with praw so might be wrong idk
thanks the previous issue was fixed
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
https://paste.pythondiscord.com/vejocaqova
@dull terrace now this is the latest issue
probably your credentials aren't right
is there a way to connect your discord bot on replit to an AWS EC2 server so it won't get ratelimited and can run 24/7
what do you mean connect it?
like instead of uploading a file to the AWS I just connect the replit thing to it
if i remember correctly, replit is that website where you write your code and run it directly, just copy the code to a py file on your aws
i doubt it
and all the dependencies + secrets will go with it?
no, just install them..
install python with google search on your aws and get pip and then it's as simple as opening command prompt and typing "pip install >package name<"
Well, repl.it uses poetry, a depedency manager
So just install all of the files, including pyproject.toml and poetry.lock
then install poetry, then do poetry install
This will then install all the dependencies you had on repl.it
You'd run your file by doing poetry run python file.py
You'd still need to manually add the secrets, this is done by exporting
export SECRET="foo"
and I'd have to re-upload the files every time I have to update the bot right?
Correct, yes
If you setup a github repo, you can just add a command to your bot that clone the repo and updates
so if I'm running the bot on the server and run it on replit to test at the same time will the commands double and like glitch out or will it be fine
Meaning you'd only need to upload to github after updating instead of doing an FTP or some other way into your AWS server
@client.command()
async def Help(ctx):
embed=discord.Embed(title="**Help Menu**",
colour=0x979c9f, timestamp=datetime.utcnow())
embed.add_field(name="**{Prefix}Ping**",
value="**Tests The, Bots Response, Time**", inline=True)
embed.add_field(name="**{Prefix}Basic_Command**",
value="**Responds With Hello World**", inline=True)
embed.add_field(name="**{Prefix}Servers**",
value="**How Many Servers, The Bots Currently In**",
inline=True)
embed.add_field(name="**{Prefix}Code**",
value="**What Language, The Bot Is Coded In**", inline=True)
embed.set_footer(text = ctx.author.name, icon_url = ctx.author.avatar_url)
await ctx.send(embed=embed)```
If they are on at the same time they will both run
Anyone know why im getting this error?
is there a way to take all cogs out of a folder instead of it manually
tskk it says invalid grant but the details are correct
so like cogs.
instead of
['commands.help',
'commands.ping',
'commands.slap',
'commands.nick',
'commands.meme']```
no idea how i did it but i think i fixed my cache issue 🥳
if I just upgraded my replit account's membership could I not get ratelimited by discord or would that still be a problem
you still would
i just gave up with that and ran python on my pc instead
looks like Help is already a command
damn
commands take the function name as the command name if you don't specify
I get rate limited on python but it still runs the bot fine replit's shitty
it'd be easier if I could just keep using replit since I can run/update things in real time and I already know how to use it
why even use replit
cause it's what I learned on
im only using it so i can continue coding in school 🤣
fight the inertia and learn to do it without
also that it's more flexible
so much better
does atom get ratelimited
no atom is a way to edit your stuff like replit
the only issue I have rn is the ratelimit thing happens constantly
but its all pc based
but wouldn't I have to keep my pc on 24/7 to do that
you could set up an amazon web server which is extremely fast and free if you're only running a lil bot
ye but you can do everything like making commands etc then put the files into replit then run it all night
is there a way to load all cogs in a folder
instead of
['commands.help',
'commands.ping',
'commands.slap',
'commands.nick',
'commands.meme']```
🤔 repl.it and atom are not the same thing
repl.it is an HOSTED ide, atom is a regular IDE, not hosted
I've been trying that but apparenetly I have to re-upload the files every time which is going to be annoying for testing
test on ur pc once done upload
simple
but wouldn't i not be able to type the commands into discord and happen then
like testing on pc is diff I'm p sure
what?
fun project for you, create a python app that automatically sends your files to your amazon server whenever you run it
AWS has integrations with github, allowing for auto deployments on commits
is there a way to load all cogs in a folder
instead of
['commands.help',
'commands.ping',
'commands.slap',
'commands.nick',
'commands.meme']```
answer plox
Yeah, using os.lostdir
also github but idk how that works
so os it then what?
I got to find an example
mk
yeah github was another solution I heard
like connect the vscode file to github then connect github to AWS?
!e ```py
import os
print(os.listdir())
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
['Pipfile.lock', 'Pipfile', 'config', 'snekbox', 'user_base', 'tests', 'LICENSE']
Use this to get all the file name in the directory
idk, i just keep a test bot on my home pc and one on amazon, when i've done enough updates on my test i merge it over to amazon server
different tokens so i don't disrupt service
anyone here have experience with discord slash
i'm trying to add buttons on an action row without having to redo the entire action row, i remember trying it a while back and getting stuck
if player.generated > 100:
return [
ActionRow(
Button(style=2, label="Back", custom_id=f"bac{end}"),
Button(style=2, label="Reset Game", custom_id=f"res{end}"),
),
]
else:
return [ActionRow(Button(style=2, label="Back", custom_id=f"bac{end}"))]```
instead of doing this doing
so not os.chdir?
Why would it be os.chdir? That changes the directory...
buttoons = (Button(style=2, label="Back", custom_id=f"bac{end}"),)
if player.generated > 100:
buttoons += (Button(style=2, label="Reset Game", custom_id=f"res{end}"),)
return [ActionRow(buttoons)]```
doing that instead but lemme double check that doesn't work
how can you add buttons and dropdown in the same message?
just put dropdown in new action row
alright thanks
dropdown has to have its own
How do I kick someone on a on_message?
is it await message.author.kick(user=message.author)?
only got 2
and its only in that command
discord.py has a default help command
Inside of your bot constructor, you'd pass help_command=None
File "C:\Users\Olie\Desktop\SaltMiner\salt mines\salt_miner.py", line 737, in back
return [ActionRow(buttoons)]
File "C:\Python\Python39\lib\site-packages\discord_slash\utils\manage_components.py", line 24, in create_actionrow
ComponentType.select in [component["type"] for component in components]
File "C:\Python\Python39\lib\site-packages\discord_slash\utils\manage_components.py", line 24, in <listcomp>
ComponentType.select in [component["type"] for component in components]
TypeError: tuple indices must be integers or slices, not str```
without the kwarg
I just did this instead py async def Helpmenu(ctx):
bot.remove_command('help') or if client client.remove.....
changed command name
it is
await message.author.kick(reason if you want)
no use the constructor
like reason="hi"
wrong person
oh ok, and it kicks it right
yes
oops sorry
therefore, if I want to ban someone, it would be await message.author.ban(reason="reason")
oh wait will it work if i just unpack
yeah
woo figured it out
alright ty
Why even return it as a list?
np
so I've had a poke around at @unkempt canyon's https://github.com/python-discord/bot/blob/main/bot/exts/info/code_snippets.py#L23-L27 but I'm not sure how to get those start and end lines for a gist, I'm using https://gist.github.com/Rapptz/c4324f17a80c94776832430007ad40e6#modals for this test, If anyone could explain to me how to get gists to display I'd appreciate it
bot/exts/info/code_snippets.py lines 23 to 27
GITHUB_GIST_RE = re.compile(
r'https://gist\.github\.com/([a-zA-Z0-9-]+)/(?P<gist_id>[a-zA-Z0-9]+)/*'
r'(?P<revision>[a-zA-Z0-9]*)/*#file-(?P<file_path>[^#>]+?)(\?[^#>]+)?'
r'(-L(?P<start_line>\d+)([-~:]L(?P<end_line>\d+))?)'
)```
that feeling when you half the amount of lines a function takes 
the feeling when you make a big function to a one liner
its just 
confused screaming

vco is disnake still gonna go on even with discord.py back
^ that
Both disnake and nextcord have no intent of halting development, we believe that discord.py can no longer be trusted to stick around or be stable, so we see no reason to stop development
hey vco in your yt vids you got a cool accent😳
Still that gist must have been a pretty hard hitter
Bit annoying but it didn't really change much
As I say, we don't really have any trust that discord.py will stick around now, so there's no compelling reason for us to use or recommend it in case it goes away
I might make another video tomorrow 😳
I was gonna impl my next project's websocket with anyio TCP connection but I don't wanna go insane
Lol websockets are somewhat scary to implement
If your using anything other than aiohttp
The anyio streams got me fucked up, couldn't figure out handshaking with the wsproto connection
Gave up after that cause I was getting end of stream error
I'll be the first to watch it
It's a regular expression. You can do match = GITHUB_GIST_RE.search(string) to find the URL in some string. It returns an re.Match object, so you could do match["start_line"] to get the starting line number and match["end_line"] to get the end (notice this name matches what's in the angle brackets for (?P<end_line>\d+)). But you may want to adjust the regular expression slightly so that it requires line numbers in the URL (the current regex matches without them too)
yeah, but how as a GitHub user do you get line numbers of a gist?
I don't understand the question. Are you asking how a user can generate a gist URL that includes line numbers?
yep
Just click the line number
Optionally shift-click on another line number to select a range
how to make a button?
so some gists don't have line numbers then? I was trying to get this gist https://gist.github.com/Rapptz/c4324f17a80c94776832430007ad40e6#modals to show the code for dpy's modals but it wasn't working so I was getting onfused
That seems to be the case. GitHub treats some file extensions specially
cool thanks for helping me understand
I think your best solution is to get the entire markdown content and search for the header
And look for the next header as the point to stop
class memeCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bot.slash_command(description= 'Displays a meme!')
async def meme(interaction):
memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')
memedata = json.load(memeapi)
memeurl = memedata['url']
memename = memedata['title']
memeposter = memedata['author']
memesub = memedata['subreddit']
memelink = memedata['postLink']
embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
embed.set_image(url=memeurl)
embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')
MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
class MyButton(disnake.ui.Button):
def __init__(interaction):
super().__init__()
async def callback(interaction):
await interaction.response.edit_message(embed = embed)```
why dosent this show the embed?
why is your class name in camelCase
it should be UpperWord
import discord
import disnake
from disnake.ext import commands
import datetime
import json
import os
import urllib
bot = commands.Bot(command_prefix="w-", test_guilds=[772968562054660107])
class MemeCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bot.slash_command(description= 'Displays a meme!')
async def meme(self, interaction):
memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')
memedata = json.load(memeapi)
memeurl = memedata['url']
memename = memedata['title']
memeposter = memedata['author']
memesub = memedata['subreddit']
memelink = memedata['postLink']
embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
embed.set_image(url=memeurl)
embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')
MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
class MyButton(disnake.ui.Button):
def __init__(self, interaction):
super().__init__()
async def callback(interaction: disnake.MessageInteraction):
await interaction.response.edit_message(embed = embed)
def setup(bot):
bot.add_cog(MemeCog(bot))
this?
all your methods are missing self
i jsut added self
where?
async def
oh yh
🪑
seems dpy 1.7.3 will survive for just a little longer
API versions & deprecations update
Based on a review of bot usage and discussion with developers, we are postponing the decommission of API v7 until early 2023
The API v6 decommission will continue as planned. The last officially supported date is Tuesday, May 3.
Additionally, we’ve gotten some questions around what the decommission process looks like. We've provided further details on what to expect here: https://github.com/discord/discord-api-docs/discussions/4657
Thanks to all community members for their feedback and input!
#697138785317814292 message
Send code
mhm nice
import discord
import disnake
from disnake.ext import commands
import datetime
import json
import os
import urllib
bot = commands.Bot(command_prefix="w-", test_guilds=[772968562054660107])
class MemeCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bot.slash_command(description= 'Displays a meme!')
async def meme(self, interaction):
memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')
memedata = json.load(memeapi)
memeurl = memedata['url']
memename = memedata['title']
memeposter = memedata['author']
memesub = memedata['subreddit']
memelink = memedata['postLink']
embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
embed.set_image(url=memeurl)
embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')
MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
class MyButton(disnake.ui.Button):
def __init__(self, interaction):
super().__init__()
async def callback(self, interaction: disnake.MessageInteraction):
await interaction.response.edit_message(embed = embed)
def setup(bot):
bot.add_cog(MemeCog(bot))
getting an error in this code
i`mport discum
bot = discum.Client(token="")
def close_after_fetching(resp, guild_id):
if bot.gateway.finishedMemberFetching(guild_id):
lenmembersfetched = len(bot.gateway.session.guild(guild_id).members)
print(str(lenmembersfetched) + ' members fetched')
bot.gateway.removeCommand({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.close()
def get_members(guild_id, channel_id):
bot.gateway.fetchMembers(guild_id, channel_id, keep='all', wait=1)
bot.gateway.command({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.run()
bot.gateway.resetSession()
return bot.gateway.session.guild(guild_id).members
members = get_members('897172510221672458', '897172510741782624')
memberslist = []
for memberID in members:
memberslist.append(memberID)
print(memberID)
f = open('users.txt', "a")
for element in memberslist:
f.write(element + '\n')
f.close()`
What error
import discord
import disnake
from disnake.ext import commands
import datetime
import json
import os
import urllib
bot = commands.Bot(command_prefix="w-", test_guilds=[772968562054660107])
class MemeCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@bot.slash_command(description= 'Displays a meme!')
async def meme(self, interaction):
memeapi = urllib.request.urlopen('https://meme-api.herokuapp.com/gimme')
memedata = json.load(memeapi)
memeurl = memedata['url']
memename = memedata['title']
memeposter = memedata['author']
memesub = memedata['subreddit']
memelink = memedata['postLink']
embed = disnake.Embed(title=memename, color=disnake.Colour.blue(),)
embed.set_image(url=memeurl)
embed.set_footer(text=f'User: {memeposter} | Subreddit: {memesub}')
MyButton = disnake.ui.button(label="Next Meme", style=disnake.ButtonStyle.green)
class MyButton(disnake.ui.Button):
def __init__(self, interaction):
super().__init__()
async def callback(self, interaction: disnake.MessageInteraction):
await interaction.response.edit_message(embed = embed)
def setup(bot):
bot.add_cog(MemeCog(bot))
why wont the embed show?
Guilds is not defined
how do i fix it?
U use your brain
homie jsut help me out
And define guilds
yes
from discord import guild
thank you
should fix it
Nice name
thanks ig
I didn’t even know discum even existed
not sure
Discum?
Dis what
Wtf is that name
does it matter
Do you guys host your discord bots off of your own pc or from a hosting service?
yes
Hosting service
24/7?
I host it off a virtual pc 24/7
I use JSON
What
That's bad
Yeah but idc
do you keep the pc on all night?
No
so not 24/7
The best I could do is Replit and the only good kinda-database I could use is JSON
Oh you mean the virtual pc
It’s impossible
Yeah ofcourse it's 24/7
Because you use replit and uptime robot
replit keeps it open for 30min
Yeah
Yeah but replit is the best IDE I can use
can someone help me or nagh
Uptime robot helps it be online
from discum import guilds
What's inside your json file?
dont have aa json sir
So it's a dict?
ye define
how do i fix it
Discum? Is that a new library or?
yes its a lib
It’s made by the amongus devs
Oh
its a selfbot lib
so yeah we can't help with that
ye i see
Anyone know why ```py
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content =='test':
await message.channel.send('tested successfully')```
breaks all my other client.command(s)
Or just do @bot.listen
maybe install flask
that's a self bot library 💀
or choose an interpreter
With pip install?
don't tell me you wanted to use flask but didn't even installed the module
I thought I did it
I did pip install flask and I supposed it installed
Also I use visual studio code
: (
try this though
what's this?
can someone give me a hand
🖐️
im getting an error here is my code
`import discum
bot = discum.Client(token="")
def close_after_fetching(resp, guild_id):
if bot.gateway.finishedMemberFetching(guild_id):
lenmembersfetched = len(bot.gateway.session.guild(guild_id).members)
print(str(lenmembersfetched) + ' members fetched')
bot.gateway.removeCommand({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.close()
def get_members(guild_id, channel_id):
bot.gateway.fetchMembers(guild_id, channel_id, keep='all', wait=1)
bot.gateway.command({'function': close_after_fetching, 'params': {'guild_id': guild_id}})
bot.gateway.run()
bot.gateway.resetSession()
return bot.gateway.session.guild(guild_id).members
members = get_members('897172510221672458', '897172510741782624')
memberslist = []
for memberID in members:
memberslist.append(memberID)
print(memberID)
f = open('users.txt', "a")
for element in memberslist:
f.write(element + '\n')
f.close()`
we will not help you
whats yo issue
since this is a selfbot library
how do i fix it then
🗿
read my message again
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
I have an question, in my discord server i cant see my offline members in the member list
is there an fix for that?
this is not the discord support server. If you need help make a post in r/discordapp or send an email to support@discord.com
how do i scrape member ids from a certain role
bro kenzo stop
🗿
ive seen you since like an hour ago asking for help for a self bot please stop the conversation or else i will ping mods we dont break tos here.
@vital steeple
this is a rule 5 violation. please don't ask again for help on self bots or other rule breaking code
#rules
thank you mina
Speaking of self bots, how does the discord api handle user tokens?
Like instead of a bot token
Because what's stopping them from doing a simple check and seeing if the token is a user token
Then they could eliminate self Botting
Or am I getting this completely wrong
I never said I wanted to self bot?
I'm literally just asking about how the discord api handles user tokens
?
Again, I never said I wanted to self bot
And I never asked about discord.py
I'm asking about the api
They handle a bot token and user token the exact same way?
Why though. Self Botting is against their tos so why would they allow people to do it?
They don't allow it, they just don't try way too hard to disallow it because otherwise they would end up breaking their official clients as well
What do you mean by breaking official clients?
how do you think that the web and desktop clients sends messages to discord?
spoiler alert: that's what the user token is for
Ah
So basically they can't stop it
They can't stop it but they can limit it
i.e as Name said not allowing commands
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'datetime.datetime' has no attribute 'datetime'```
reason?
@client.command()
async def Ping(ctx):
ping=round (client.latency * 100)
time = datetime.datetime.utcnow()
e=discord.Embed(title='**Pong, My Current Latency Is**', description=f'**`{ping}ms`**', colour=0x979c9f)
e.set_footer(text = ctx.author.name, icon_url = ctx.author.avatar_url)
await ctx.send(embed=e)```
you probably did from datetime import datetime, should be just import datetime
still same result
show your imports
import discord
import datetime
from datetime import datetime
from discord import embeds
from discord import guild
from discord import message
from discord import permissions
from discord import Member
from discord.ext.commands import has_permissions, MissingPermissions
import random
from multiprocessing.connection import Client
from discord.ext import commands```
remove from datetime import datetime this line
no error now but doesnt show the time in embed
can you show how the embed looks?
that's some good ping tho
just needs the date then it would be complete 🙂
uh it seems like there is a problem with you're embed
!d discord.Embed
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") for you.
Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
its missing py time = datetime.datetime.utcnow()
you didn't put time to the embed
should be 110 ms, as they're multiplying it by 100 not 1000
XD
he imported datetime only
thanks all
all users have there own token which is used for each request to the api
its 104ms quite bad for a bot?
I am trying to get the guild id of a list on a bulk delete
code; py @commands.Cog.listener() async def on_bulk_message_delete(self, messages:list): with open("./databases/auditLogChannel.json", "r") as f: auditLogJson = json.load(f) auditLogChan = auditLogJson[str(messages.guild.id)]['channel'] newLog = int(auditLogChan) if auditLogChan is None or auditLogChan == "" or auditLogChan == "\n" or auditLogChan == None: return else: channel = self.bot.get_channel(newLog) embed = nextcord.Embed( title="Bulk Message Delete", description=f"Bulk message delete in <#{messages.channel.id}>" ) fields = [("Messages Deleted: ", f"{len(messages)}", False)] for name, value, inline in fields: embed.add_field(name=name, value=value, inline=inline) await time.sleep(3) await channel.send(embed=embed)
error: py auditLogChan = auditLogJson[str(messages.guild.id)]['channel'] AttributeError: 'list' object has no attribute 'guild'
Messages is a list
So you cant use .guild
So how would I get the guild id? use a for loop in messages and get the loop variable.id?
So what is messages a list of? Are they all from the same guild?
Yep, the same guild.
I dont see any delay but apparently 104ms is bad that guy was saying but online 100-200ms is apparently good and under 100 is amazing
so py for message in messages: msgGuildId = message.guild.id
You can access an item wo using a loop lol
probs but I dont know how to lol
list[index]
where index is messages?
Index is a number
so list[1]
0->len(list)-1
Indices start at 0
right
so why not just do len(list[0])
That would apply the len func to the first item in the list
^
How long have you been using python btw?
len(list) - 1 gets the length of the last element iirc
aboutttttt 3 years but i never took a full course
The index of the last item
oh ok
Might wanna do that, or at least speed through one
Yep, for sure I have that planned because I need to learn more.
Not to be rude, but accessing items in a list isnt exactly expert tier
But anyways, the fix to ur problem would essentially be to add [0] after messages. Id recommend you look into a course tho
I know i knowww
Yep for sure, I was thinking about the MTA course, is that a good idea?
I havent used it. Personally i just used one from freeCodeCamp to get off the ground
Alright ty!
Np
by cog isn't being loaded likely with an error how do i see this error?
is this the correct way to unpin a message?
await discord.unpin_message(reaction.message)```
!d discord.Message.unpin
await unpin(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unpins the message.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to do this in a non-private channel context.
Why delete
reply ping
role = message.guild.get_role(943243423446605834)
for i in role.members:
user = i.userid
print(user)
im just tryna get the user id of all the users wit this role
how could i do this?
basically i is a discord.Member so use i.id
I have this respond trigger text command and how can i make it trigger the exact words only?
if message.content.startswith('hola'):
reply = [
f"Holaa {message.author.mention} !",
f"Bonjour {message.author.mention} !"
]
await message.channel.send(random.choice(reply))
m
if message.content == "hola":

👀
Hey I have this async function
async on_message(message):
#something here
#I wanna define a function here too with await message.channel.send but when I do that I recieve an error of defining await
How can I do that?
You're missing the def keyword
Just import them all in one line

What lib are you using?
i'm going thru the disnake guide docs
Make it async
Umm within the function?
I mean within the async have an async function?
of course
Aha it works!!Thanks ill try something and let you know if it works for what am trying to intiate
awesome, i remember my first slash command when they first released felt really good too
Slash commands are so nice with autocomplete
I did this do I need to pass the message clause too?
I mean param
Why would you need to?
Has the dev team ever came up with the idea of implementing a slash version of the pypi command that autocompletes with package names?
That's gonna make a lot of HTTP requests
Else it gives error
Have you tried d.py slash commands?
I even passed still gives error
no i haven't.. probably will at some point? i heard they were more complicated
how can i make a per send embed message it count? like this
btw no autocomplete for these?
Aye wait
typing inter.author
Can't attest to that, haven't used the other forks. Surprisingly similar to regular commands though
You need to typehint
typehint inter to discord.Interaction
pops up that way
or disnake.Interaction
yessss ty
so that's the case for all libraries i guess then, not just bot frameworks
hm
Save the count in a database everytime someone makes a confession
but i think i had autocomplete when using other libraries before i learned type hinting
Nah, python has no way of knowing that the decorator provides certain arguments. Would be a cool feature now that you bring it up
isn't it disnake.ApplicationCommandInteraction
the docs do say ApplicationCommandInteraction
Then typehint to that rather than interaction, ApplicationCommandInteraction probably has additional properties
It's discord.Interaction with discord slash commands
Use a database -> save the count
Are you talking with me?
Different implementation in all the forks
yes
Yeah she's using disnake so we're using those typehints
I have my personal server to host it am not using repl
My bad then 
Yea its just that I have white theme
We celebrate a ton of holidays
@client.event
async def on_message(message):
if message.author == client.user:
return
async def abc(clause):
await message.channel.send(clause)
if message.content == "abc":
abc("abc")
Something like that
Make sure to process commands!
RuntimeWarning: coroutine 'on_message.<locals>.abc' was never awaited
abc("abc")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
It gives me this error
Umm how to do that?
is abc a coro?
!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.
Umm wait I guess I got it let me try that one
Thanks a lot @sick birch @boreal ravine it worked!!
Means a lot thanks for helping me out!!
one question: how good are you with python?
Umm just started recently
Just a word of advice it's best not to nest functions inside of each other and in this case no need for a one line function
Umm the thing is I have to copy paste everytime am adding new commands so I thought better to add a function
Just change wherever needed
I just wanted to reduce some code
Hey
Can anyone tell me how to make this in infinite seconds
for testing i putted 300 but now i want to make it infinite
Reasonable but you're still typing the function name anyway
What to type for infinite
It's best to leave it as is
How would the user type infinite?
i mean the infinite seconds
like now at max you can put reminder of 300s
i want to make this 300s to infinite seconds
Umm yea but it will be called only when it satisfies given condition atleast it makes the code easy to read
like 21000 sec
30000
so why not leave it as is
Those are > 300 so just raise an error
Ok and than i have to remove this ig
Why? That's good as is
Ok
i will write 9999999999999999999999999999999999999 and remove 3 @sick birch

That number is greater than 300 so it will say "too long"
Ya it will say because for now it is 300
but if i remove 300 from there and write this number
and now i make a cog
it will take any digit below this
Well you can't have infinite you need a minimum and a maximum
So maybe minimum can be 0, max can be say 5000 if you want
Ya so i will put this number in place of 300
. this number
Disnake lets you do slash command cogs?
I mean sure but
Ya lets try
What's the command for?
Not that I'm aware of
timer/reminder
you can say anything
Oh that's annoying
Set a reasonable limit then. Like a month
i don't even really know what a cog is. but ^
actually it will count seconds in backward
like - 10
9
8
7
5
... so on
:(
And put it in chat?
Or just use asyncio.sleep()?
It was a example
it will edit the single message
Oh, yeah you're going to get ratelimited then
Ohh
Okay
Or like <t:1647576000:R>
omg mina using a dpy fork
def convert(time):
pos = ['s', 'm', 'h', 'd']
time_dict = {"s": 1, "m": 60, "h": 3600, "d": 3600*24}
unit = time[-1]
if unit not in pos:
return -1
try:
val = int(time[:-1])
except:
return -2
return val * time_dict[unit]
@sick birch i used this but it showed error 
helllyeah
What error?
wait lemme show u
You can think of those like command categories
Well, that's basically what Cogs are
is a "cog" a discord bot thing?
Yeah
thats awesome 
Yea
!d discord.ext.commands.Cog
class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.
A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.
When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
You can also think of them as Python classes but for commands, you can have a "moderation" cog with commands like: ban, unban, kick, mute, temp ban, etc
they are easy to make 
Yes, but they are used to basically make command categories
its just a class that works like a template which you then subclass
Ask me, I used to use cogs when I didn't know what are classes 
Sadge
imagine
The command
Slash commands are good but sometimes they are annoying
It should be async def, not def
The only downside is that their structure is weird, like interaction.response endpoint and stuff, and they take time to sync
Code
@client.command()
async def load(ctx, extension):
client.load_extension(f'cogs.{extension}')
@client.command()
async def unload(ctx, extension):
client.unload_extension(f'cogs.{extension}')```
Error I get ```py
Traceback (most recent call last):
File "C:\Users\Secret\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Secret\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Secret\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionNotLoaded: Extension 'cogs.ping22' has not been loaded.```
Yeah
Anyone know why first time using cogs
Use the load method first
Wym?
whats the purpose of that cmd?
Ooo
To test it before I put my real commands
make sure the functions work as intended
Ohh
Okkk 👍
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ExtensionNotFound: Extension 'cogs.ping22' could not be loaded.```
but just getting this error :p
when i try unload/load

indeed it is
wait u using visual code?
yeah
Im using VS Code
Ya ik i messed
Lol
im so lost on this.
c:\Users\thebe\Downloads\Mecha\src\main.py:100: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
bot.load_extension(f"cogs.{filename[:-3]}")
when i use await it just gives me more errors
im using dpy 2.0.0, ive only had this problem on my own pc. if i test using something like replit, its fine. any fixes?
what's the error when you await it?
if it only doesn't work in you're computer try using a virtual environment
replit uses d.py 1.7.3 by default




