#discord-bots
1 messages · Page 1132 of 1
👀
Oop
Well try it and see if what he suggested works'
Ok
@commands.has_role()
Try that?
Ok?
It's the same thing
nope
Last time I checked
O yea the update
When did they change it?
Not what I said
What did nextcord change it to
Oh
nothing, nextcord has its own application commands
I thought @commands.has_role() worked
🤦 should've told us there was another error
Ikr
your interaction variable is not an interaction
that is not a slash command
no, try replacing @bot.command with @bot.slash_command
why did you name it interaction
then use ctx
You still don't pass in interaction to that
and ctx.user doesn't exist, it's ctx.author
just change @bot.command to @bot.slash_command if you have that there
a context is passed for a command, and an interaction is passed for a slash command
why are they using application checks then
idfk
should be using commands.has_any_role as Jonathan said
app checks are for slash cmds
Nope
if you want these features just switch to slash commands
@shrewd apex can you exactly my tell me what type of genshin impact comamnd you are telling me
ok sry for ping...but uk u told me to use railway and im having trouble...and the support server aint responding
💀
================
Using Buildpacks
================
20: Pulling from heroku/buildpacks
Digest: sha256:7edcb894ad034887d876fb911768789105483edcabd7c609246412733abb8ad3
Status: Image is up to date for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
Digest: sha256:5cfc72ccdb10b0c0e877f1baa5d336042a134a1f50ff2aec11a8644c464e5113
Status: Image is up to date for heroku/heroku:20-cnb
Previous image with name "us-west1-docker.pkg.dev/railway-infra/railway-docker-users/project/08170e30-18c0-4da6-8746-ffc441708b82/service/799179a4-7ca1-4591-8c50-79591d23578e:d4ea14cf-b338-4d68-8254-b643f9c8bf1b" not found
===> DETECTING
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
ERROR: failed to build: executing lifecycle: failed with status code: 20
show your configurations?
what exactly does on_disconnect do.......like obv it cant send a msg aftr iz been disconnected so....waz da use?
like if you have some running tasks which interact with databases and stuff, you can safely close them in on_disconnect
there are more purposes
Hey @shell wing!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
now tht makes sense
cool, do you have a requirements.txt in your github?
i didnt made one...
high time u did
thats the issue, how would the deployment know what libraries you need, create a requirements.txt, add the libraries you pip installed there
i only installed discord cause this is like a test one
just to see the hosting site and all
discord.py
``` in your requirements.txt
it still isnt loading
heres the error
basicly
import requests
def get_inofs():
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36 OPR/80.0.4170.63"}
info = requests.get("https://fake-it.ws/de/", headers=headers).text
infonames = ["Name", "Address", "City", "Postcode", "Phone", "BIC", "IBAN"]
infos = []
for i in infonames:
rawinfo = info.split(f'row">{i}')[1].split('To Copy">')[1].split('<')[0]
infos.append(rawinfo)
return {
"Name": infos[0],
"Address": infos[1],
"City": infos[2],
"Postcode": infos[3],
"Phone": infos[4],
"BIC": infos[5],
"IBAN": infos[6]
}
is this a virus
or nah
this is not error, atleast read it,
its installing your libraries
whats the problem?
its interaction.response.send_message
if team2 in user.roles
is thing condition even true?
... your code wont execute if this is False
add some print statements inside that to check it
sry sry so itll work after some time or what ?
yes as soon as its installed you can check deploy logs to see if its working or not
great.
!d discord.ui.View the timeout kwarg
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.
Yep
everything for nextcord is the same as discord.py except slash commands
ImportError: cannot import name 'SelectOption' from 'discord.ext'
ImportError: cannot import name 'Select' from 'discord.ext'```
What to do?
Import from discord
!d discord.SelectOption
class discord.SelectOption(*, label, value=..., description=None, emoji=None, default=False)```
Represents a select menu’s option.
These can be created by users.
New in version 2.0.
What is team2 ?
Make a command that solves simple math equations like 2+2 or 4-2
Am i allowed to use any library?
The error told you that team2 is None.
No, just use discord.py
I would consider using another library cheating
Hmmm not possible without any library
it's possible 🤦
But NoneType has no attribute called name ?
Python can be used for addition subtraction multiplication and division not equations
well i guess you meant to use discord.Member maybe ?
!e
s = "2+2"
first_num = int(s[0])
op = s[1]
second_num = int(s[2])
if op == "+":
print(first_num + second_num)
@dusky pine :white_check_mark: Your eval job has completed with return code 0.
4
@robust fulcrum it's literally possible to make a calculator
@robust fulcrum i created a calculator before in GUI using only tkinter.
I thought you mean the big equation
Like 5+6+8-5
I said simple equations
u can try big equations if you want but simple is fine
in that case i guess that team2 = roles2[i] never assigned so it is None as you put before.
try using try-except statement so you can avoid error when the roles[i] is not exists.
try:
emoji2 = team2.name.replace(" ", "_")
except:
print ("Error")
sum() like: 🗿
just two numbers so it's fine
it would be easier to use ast to parse the equation and then get the output
Use eval to execute strings as code so you can create calculator that calculate anything.
no
Why little man ?
@dusky pine :white_check_mark: Your eval job has completed with return code 0.
4
don't recommend eval, it unsafe. you can execute any python command using that.
sys.exit() 
!e
print(eval("(1+1)/2"))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
1.0
!d ast.literal_eval
ast.literal_eval(node_or_string)```
Safely evaluate an expression node or a string containing a Python literal or container display. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, `None` and `Ellipsis`.
This can be used for safely evaluating strings containing Python values from untrusted sources without the need to parse the values oneself. It is not capable of evaluating arbitrarily complex expressions, for example involving operators or indexing.
it is 1+1 relax man.
they are taking input from the user, so i can just type a command to delete their local files and it will execute that and now their files are gone
⭐vulnerabilities⭐
do:
if '+' not in string and '-' not in string and '*' not in string and '/' not in string:
print ("Hey put some operators!")
or like: 🗿
(2+2, __import__("os").system("boom boom"))
or just use ast
Who the hell know about that ? they are only users btw
users can be py devs lol
being a programmer isnt something inclusive
you should never rule out possiblities
so do:
chars = ['a', 'b', ....]
if '+' not in string and '-' not in string and '*' not in string and '/' not in string:
for i in chars:
if i in string:
return
print ("Hey put some operators!")
then 2+2 wouldnt even work
^
If I want one select menu to show another select menu when a option is picked but the options from the second one are based on the first pick. How would I? I have more information in #help-chocolate
you would need to use or for that lol
see the edited
yeah
What do you mean?
that wasnt directed at you 😅
or right now: 🗿
so what is ast ?
abstract syntax tree, every python expression gets converted to a tree which shows the order of operation before getting converted to byte code
!e
import ast
print(ast.dump(ast.parse('1+1*(2*69)'), indent=4))
@paper sluice :white_check_mark: Your eval job has completed with return code 0.
001 | Module(
002 | body=[
003 | Expr(
004 | value=BinOp(
005 | left=Constant(value=1),
006 | op=Add(),
007 | right=BinOp(
008 | left=Constant(value=1),
009 | op=Mult(),
010 | right=BinOp(
011 | left=Constant(value=2),
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/edisiqifan.txt?noredirect
i think compiled is the better word over converted
compiled is usually used when code gets converted to machine code
cool
oh wait nvm, i didnt see that i used converted for byte code as well 😅
converted to byte code
did you ment when pythons interpreter compiles code to byte code and then executes it or?
misunderstand i see
Would anyone mind helping in #help-chocolate?
it actually does convert to byte code, then it compiles and executes line by line
you didnt answer my question🗿
you just enlightened my question
no it never really compiles, it just byte code ( which is not machine code ), then it that byte code is compiled to machine code line by line and executed
we say line by line, but its more like going thought each node one by one
well it really depends on the usage of compiled as people also refer to converting to byte code as compiled but its all word usage
¯_(ツ)_/¯
hmm yea, ig you can refer to that. I thought u said compiled to syntax tree b4 that so was a little confused
many websites also use compiled as sorta of an alias of convert lol
well it literally is an alias lmao
Sorry I keep asking, but @slate swan can I bother asking you to check #help-chocolate
Give any other command challenge like interesting
show the wikipedia page of someone/something
without any apis
Package?
huh?
Can I use Wikipedia library?
no
Then
aiohttp + bs4
Ok
Can I use requests?
well if you do use requests that would block your bot per each HTTP request it makes, no?
make an embed with 4 images
response = requests.get(url)
Is just
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
...
you can just use the request method the aiohttp object has
async with aiohttp.request("GET", "<endpointurl>", headers={}) as payload:
...
ah yea, you can do that as well
Has anyone done testing to figure out the best length of play/use time for a bot before you make them take a break and/or vote to continue?
@paper sluice can i try to get weather from google weather page?
Using bs4 and aiohttp
ya, i just gave a suggestion
Ok
Traceback (most recent call last):
File "main.py", line 13, in <module>
current_time = datetime.datetime.now()
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
code:
current_time = datetime.datetime.now()
@tasks.loop()
async def hello(hours=1):
channel = bot.get_channel(992456076136034344)
await channel.send("@shell wing The Current Time is =", current_time)
await asyncio.sleep(2)
print("loop started")
imports :
import discord
from discord.ext import commands ,tasks
import asyncio
import traceback
from datetime import datetime
Just current_time = datetime.now()
Hey, i wanna check in a on_message if a user has a specific role
So if he type Suggestion and has the role Member is send a message in channel……
but if he has role user it send the message to an other channel……
i hope you might can help me
!d discord.Member.roles
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.
These roles are sorted by their position in the role hierarchy.
is there discord.Member.roles.name ?
well the list object has no name attr
!e print([].name)
@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 | AttributeError: 'list' object has no attribute 'name'
i mean list of ids ? or names ?
wanna get that role name
its a list of role objects you can just do [role.id for role in Member.roles] or map(lambda role: role.id, Member.roles)
depends if you want a map/gen obj or a list etc
cool
So this is wrong, but how can i get a user role ?
role_de = get(guild.roles, id=role_id_de)
a user role?
a user is a user account in discord, member is a user account in a guild which a guild has roles so you ment member
!d discord.Member.get_role
get_role(role_id, /)```
Returns a role with the given ID from roles which the member has.
New in version 2.0.
öhm yes
thx
👍
Traceback (most recent call last):
File "/home/runner/stuff/venv/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
await self.coro(*args, **kwargs)
File "main.py", line 17, in hello
await channel.send("@shell wing The Current Time is =", current_time)
TypeError: send() takes from 1 to 2 positional arguments but 3 were given
use f strings
do
f"@shell wing The Current Time is = {current_time}"
alr ty its working
make a embed like this
baby yoda
Whats this
It's simple to make ig
I can easily make it use PIL
@tasks.loop()
async def hello(hours=1):
channel = bot.get_channel(992456076136034344)
await channel.send(f"@shell wing")
print("loop started")
``` why does it send 5 msgs in a go and wait for second and then send msgs again
PIL ?
na fam just discord api
Ok
Hi, I'm currently migrating everything from dpy 2.0 to disnake, as I just want to work with disnake. But for some reason my interaction_check isn't working anymore:
async def interaction_check(self, interaction: disnake.MessageInteraction):
if interaction.user.id in self.dropdownusers.author.id:
return True
await interaction.response.send_message(f'You cannot use this interaction.', ephemeral=True)
return False
``` According the docs I did everything right.
its interaction.author in disnake
!d disnake.Interaction.user
property user```
The user or member that sent the interaction. There is an alias for this named [`author`](https://docs.disnake.dev/en/latest/api.html#disnake.Interaction.author "disnake.Interaction.author").
ah sad
Interaction.author is just an alias lol
its on_interaction
That's not listed in the docs, are you 100% sure?
oki is always right
!d disnake.on_interaction
disnake.on_interaction(interaction)```
Called when an interaction happened.
This currently happens due to application command invocations or components being used.
Warning
This is a low level function that is not generally meant to be used.
New in version 2.0.
its just a namespace that gets called internally like on_ready
Ah, understood. Thank you
how can i make the bot use a slash command in discord?
youre welcome
which lib?
if were going by that point, youre smart, you cant disagree now

oki is always right about python*
(Ryuga:=type("MyQTRyuga", (), {})) is a qt
😳
😩
im not even sure if bots can invoke apps commands tbh
fr?
async def bump():
channel = bot.get_channel(992511703155740712)
await channel.send("/bump")
@bot.event
async def on_ready():
bump.start()```my current code
but it kinda doesnt work..
thats not how you invoke commands
what
app commands can't be invoked
if u want to invoke normal commands you do Context.invoke
!d nextcord.ext.commands.Context.invoke
await invoke(command, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Calls a command with the arguments given.
This is useful if you want to just call the callback that a [`Command`](https://nextcord.readthedocs.io/en/latest/ext/commands/api.html#nextcord.ext.commands.Command "nextcord.ext.commands.Command") holds internally.
Note
This does not handle converters, checks, cooldowns, pre-invoke, or after-invoke hooks in any matter. It calls the internal callback directly as-if it was a regular function.
You must take care in passing the proper arguments when using this function.
so instead of send you mean invoke?
you cant lol
invoke is used to invoke commands that use Context so commands that are made with the lib abstract of commands of nextcord and commands that are from your bot so no you cant use it and were talking about app commands so nope
and even if you send a message with a / i doubt it would register as your bot invoking a app command, ill probably just send the raw content or no /(slash)
because of you😔
sorry i didnt ment that
facereveal
Anyway don't shitpost
i think partly why they enforced slash was to stop people from grinding a bot using another
No most bots actually prevented bots from being grinded by other bots in the first place
The problem was self bots
Which is still a problem cuz self bots still can use slash commands
rip
not all tho but slash commands save a lot of trouble
especially on the user input part
Yea they've actually improved ever since they first came
how can i make that the bots use slash commands idk how?
wait what do you mean with self bots are agains discord tos
i dont understand, does that mean iam not allowed to create a bot?
anything you do with self bots is against tos
self bot means a user acting as a bot
like if i used my token instead of a bot token for running a bot
ty, i thought creating a bot was against tos. like if a no name creates a bot.
whats up with discord user links? if i access a link like https://discord.com/users/xxxx where xxxx is a user id, it works for ids of friends and people in servers that im in, but doesnt work for a user that i dont have any mutual servers with. is this intended behavior? if so, was it always like this, and is there a different way to create a public link to a discord account?
(this seemed like the best channel to put this)
Okay, so I'm following the docs
https://docs.disnake.dev/en/stable/api.html#disnake.InteractionMessage.author
But the problem is, there's not really anything to check who clicked an option in the dropdown menu?disnake.MessageInteraction.authoranddisnake.MessageInteraction.userare the same aren't they?
async def on_interaction(self, interaction: disnake.MessageInteraction):
if interaction.user.id is interaction.author.id:
await interaction.response.send_message(f'worked', ephemeral=True)
return True
await interaction.response.send_message(f'You cannot use this interaction.', ephemeral=True)
return False
``` now help me
i think that is the intended behavior
ya they are aliases, you can get the author who invoked the command and store their id somewhere and compare interaction.user with that
How do I get the author though?
343944376055103488
huh, i couldve sworn it used to be anyone could access a profile link. do you know of any other ways to provide a link to a discord account?
in the command before you call the view, just do interaction.user and store it somewhere
i dont really know, there could be a way but im not aware of it
alright, i'll just do without the link then. thanks for your input
Question, how can I only allow access to a prefix for one singular user?
you could use on_message and do something like if message.content.startswith('prefix') and message.author.id == someid
I don't really want to use on message for it though
Sorry, but once again I'm not sure how to do it lol, so yeah I think(?) I did everything right so far, but for some reason it's just not checking for the author.
class Dropdown(disnake.ui.Select):
def __init__(self, dropdownuser):
options = [
disnake.SelectOption(
label="🛑 - Blacklisted Words", description="Get infos about the blacklisted words."
),
disnake.SelectOption(
label="👀 - Staff", description="Get infos about staff."
),
disnake.SelectOption(
label="⚠️ - Modmail", description="Get infos about the modmail."
)
]
super().__init__(
placeholder="Select something",
options=options,
)
self.dropdownuser = dropdownuser
async def on_interaction(self, interaction: disnake.ApplicationCommandInteraction):
if interaction.user.id in self.dropdownuser.author.id:
await interaction.response.send_message(f'worked', ephemeral=True)
return True
await interaction.response.send_message(f'You cannot use this interaction.', ephemeral=True)
return False
Should've sent a link, sorry for the flood
yeah i get why, but i dont think discord.py or any other libraries allow that sort of per-prefix customization
if I do have to use it, what would even go after the if statement
any sort of code that you want to run when an authorized user sends a message with your chosen prefix
!d discord.ext.commands.Bot.get_prefix
await get_prefix(message, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the prefix the bot is listening to with the message as a context.
Changed in version 2.0: `message` parameter is now positional-only.
You can just pass command_prefix a function that returns the prefix
right, i forgot about that
What do you mean
in that case you can make a function that checks the user id, and if its an authorized user it will add your "special" prefix to the list of returned prefixes
def some_func(bot, message):
... # do stuff here
bot = commands.Bot(command_prefix=some_func)
How would this only allow one user though?
one sec, checking docs
Oh okay
async def custom_prefixes(bot: Bot, message: Message):
if message.author.id == some_user_id:
return ['default prefix', 'special prefix']
return ['default prefix']
That ^^
it has to be async?
can't I just make it a regular function and call it when I define the command_prefix ?
it doesn't iirc, the docs only says "a callable"
either async or regular function, doesnt matter
you dont call it, you pass the function itself to the Bot constructor, so that the bot instance itself calls the function for every message
so like, command_prefix=(custom_prefixes)
yeah, without the brackets
anywhere I put this wouldn't it always be undefined?
define it somewhere near the top of the file before you create the Bot instance
or in a separate file and import it
then the bot and message variable would be undefined no?
bot and message are parameters
What to do?
Bot and Message are the classes you get by from discord import Message and from discord.ext.commands import Bot
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
def weathers(city):
city = city.replace(" ", "+")
res = requests.get(
f'https://www.google.com/search?q={city}&oq={city}&aqs=chrome.0.35i39l2j0l4j46j69i60.6128j1j7&sourceid=chrome&ie=UTF-8', headers=headers)
print("Searching...\n")
soup = BeautifulSoup(res.text, 'html.parser')
location = soup.select('#wob_loc')[0].getText().strip()
time = soup.select('#wob_dts')[0].getText().strip()
info = soup.select('#wob_dc')[0].getText().strip()
weather = soup.select('#wob_tm')[0].getText().strip()
weather = (weather+"°C")
dict = [location,time,info,weather]
return dict
Here is function
@commands.command()
async def weather(self,ctx,city):
response = weathers(city)
location = response[0]
time = response[1]
info = response[2]
weather = response[3]
embed = discord.Embed(title="Weather", description=f"City: {city}",color=discord.Color.blue())
embed.add_field(name="location",value=location,inline=False)
embed.add_field(name="Time",value=time,inline=False)
embed.add_field(name="Info",value=info,inline=False)
embed.add_field(name="Weather",value=weather,inline=False)
await ctx.send(embed=embed)
I am getting error how to fix?
?
to clarify:
from discord import Message
from discord.ext.commands import Bot
def custom_prefix_func(bot: Bot, message: Message):
if message.user.id == 1234:
return ['default prefix', 'custom prefix']
return ['default prefix']
mybot = Bot(command_prefix=custom_prefix_func)
yeah I understood thanks 😄
👍
Pls help me
your bs4 parsing code isnt finding #wob_loc on the webpage
define it, songs = ..., the same applies to play_next_song
No there not problem with bs4 cause i tested the function first and then made comamnd there is error in comamdb ig
But i not able to find error
the traceback says list index out of range on soup.select('#wob_loc')[0]
which probably means soup.select('#wob_loc') is returning an empty list
and you can always use a weather API, no need to webscrape
Hmmm
which implies that the webpage content you received isnt exactly what you expect
Is there any way to fix it?
the solution to this problem is specific to the website youre scraping and what content youre parsing out
as xCirno said, its a much better idea to simply use a weather api thats meant to be used in code, rather than scraping a webpage meant for humans that can change its format at any time
try the first solution they have there, which actually uses the api. the scraping code is an alternative approach
But i wanted to use the scraping code
Pls help me if possible
i did fall in your rick roll link @mild lava
theres no point in scraping when an api is available
if you want to scrape something for the sake of learning, find something that doesnt have an api and doesnt change very often
I found the error
I did a wrong thing
i forgot to put
city = city+"weather"
why not just do city += "weather"
No prob both have same meaning
bitwise addition is faster iirc
bitwise? i dont think that applies here lol
Still better to be consistent and not ignore new other features
x += y is in-place modification while x = x + y is reassignment
same result anyway
+= is a bitwise operation isnt it?
but yes, += exists for a reason, and it is mostly used as a shorthand for x = x + y, plus it makes code a bit easier to understand. theres rarely a reason not to use it
@paper sluice challenge done
Hi all I wonder if anyone can help, I am just trying to build a basic reaction role atm (I am still learning), its of course not working... https://paste.pythondiscord.com/tagewuvaka
I am trying to send a specific message to a certain channel with the bot reacting first, and then when someone reacts to the message with the emoji they get the role assigned, the emoji, the channel id and role name is correct.
So I can only assume I am going wrong in my code, but as I am new to python I am not sure what I am now missing, I was wondering if someone could assist me a little or point me in the right direction? 🙂
how do i make the command available every 30 seconds?
i confused it with |=
I did the challenge 🙂
yes you just said that
I not used wearher api
Cause it have 1000 requests per day
But mine command unlimited
you can cache the results of requests if its some daily weather data, so if someone uses the command with same argument again the cache is utilised instead of making the request in that case
next challenge: Implement a cache
do you mean like the command can be used only once in 30 seconds?
A cache using Redis 🙂
heck no 
yes
what is it now 😩
redis is easy, just set and get
don't forget about the goofy ahh data structures
there's uhh... hashes?!
easy enough to just dump json data to a string & load it after
kekw
ohno
how can i make it?
big scary hashy bois 
just HGET and HSET
Hi vcokltfre
!d discord.ext.commands.cooldown use the decorator on your commands, ```py
@commands.command( rate, per, commands.BucketType.user)
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
hello
thanks
😔 why would you make a redis cache for it, its not even 1000 entries
and i doubt if people really use bots to check weather
because all hail our lord and saviour redis
le discord.py storing 50k members cache in a dictionary 🥂
Nextcord V3 will allow you to switch out the default cache for any protocol compliant one, including a custom redis cache 
Vcokltfre finally said hello back 
should my command look like @bot.command(per = 10)
that seems wrong
no, you use that as a decorator over your command, something like this
@commands.cooldown(rate, per, <your bucket>)
@bot.command()
async def foo(context):
...
``` NOTE: rate and per are required arguments
@commands.cooldown(1, 30)
bruh you have to buy a bucket if you want to have command cooldown?
is that enough?
this is why u should use hikari
I prefer disnake 
@dusky pine can you give a good challenge not any very complicated one
but how can i send a message when user tries to use command 2 times on the cooldown?
Why everyone gives example of foo here?
Whats foo
Make a command specific/ global error handler, compare the error Exception instance with commands.CommandOnCooldown and send a message if it is
these are terms which are normally used for examples
foo, bar, baz
The terms foobar (), foo, bar, baz, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept.
add 2 2
will return "4"
so basically add two numbers
Simple
Sarth you literally completed his challenge for him
def add(a,b):
return a+b
@bot.command()
async def add(ctx,num1,num2):
ans = add(num1,num2)
await ctx.send(ans)
👍
Wrong
Most likely won't work
And you're using + on strings
That too
So not that simple 
Oh i forgot to int
def add(a,b):
a = int(a)
b = int(b)
return a+b
@bot.command()
async def add(ctx,num1:int,num2:int):
ans = add(num1,num2)
await ctx.send(ans)
Even if you do it's still wrong
Whats wrong now
Why would you convert to an int again
No prob
You're basically converting an int to an int
Try it lmao

You can just directly send the addition
No need to overengineer and add another function
Otherwise you could add something like
def convertToInt(a):
return int(a)
I can make a AdditionFactoryBuilderFactory if you want :P
btw there's a sum function which does the same
floor division ig? try it and see
just puts to the closest number
either down, or up
!e
import math
print(math.ceil(300.16))
print(math.floor(300.16))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | 301
002 | 300
rounding
Oh floor means rounding to lowest
And ceil means rounding to highest
Floor is on down and ceil top
Hello! I have been in python for a relatively short time, could you tell me how to do a keyword search in a JSON table? I need to make it so that if a person enters for example "hamburger", then it gives out his price
If you give me documentation describing how to do this or similar, I will be even more grateful to you.
Tnx
congrats 🎉
@client.tree.command(description="Check the membercount")
@app_commands.checks.has_permissions(administrator = True)
async def membercount(inter: discord.Interaction):
em = discord.Embed(color=0x00FFFF, title="Members", description=f"{len(list(inter.guild.members))}", timestamp = datetime.datetime.utcnow())
await inter.response.send_message(embed = em)``` when i try do the command it doesnt return a error but it says interaction failed
So im making requirements.txt can i make it so that it installs all the modules im importing in main_imports.py like so that i dont have to write it separately
if your in a venv ( which you should be ) you can do pip freeze > requirements.txt it will put all the modules your environment has in requirements.txt
do you get any errors in your terminal?
making it for hosting and github
no
ERROR: Invalid requirement: 'pip freeze > requirements.txt' (from line 1 of /workspace/requirements.txt)
<@&831776746206265384> scam url
!mute 922380062307799131
:incoming_envelope: :ok_hand: applied mute to @split oracle until <t:1656765537:f> (59 minutes and 59 seconds).
try pip list --format=freeze > requirements.txt
do you have message_content intent enabled?
ERROR: Invalid requirement: pip list --format=freeze > requirements.txt
pip: error: no such option: --format
not sure why thats happening, try python -m pip freeze > requirements.txt
hm
try pip freeze | Add-Content -Path requirements.txt if you use powershell
role is None
make a getch
hm but that's a name
sheesh, double the check name or restart the bot
is there any reason that you are not using the role id but its name
im not...
instead make a getch
role = message.guild.get_role(role_id)
await member.add_roles(role)
yes it's the same?
oh wait, it's a guild method ig
tf
weird
guys help
i have a say cmd and i want it to delete cmd after sending the mesage real user said
but it have a eror when i type cmd in a server
async def say(self, ctx: commands.Context, *, message):
await ctx.delete_after(message)
await ctx.send(message)```
what i type : p!say hey
eror:
Ignoring exception in command say:
Traceback (most recent call last):
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/yoohooool/commands.py", line 28, in say
await ctx.delete_after(message)
AttributeError: 'Context' object has no attribute 'delete_after'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/yoohooool/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/yoohooool/venv/lib/python3.8/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: AttributeError: 'Context' object has no attribute 'delete_after'
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
Changed in version 2.0: `role_id` parameter is now positional-only.
do ctx.send(message, delete_after=enter-time-here)
oh wait i didn't read your original question
you can do await ctx.message.delete() to delete the user's message
bot doesn't get get_role Guild does
so you would probably do ctx.guild.get_role(id)
or member.guild in this case
member, there is no ctx here
^
ya should be good
if the role is not in the cache it will return None so you might have to fetch it
Next challenge suggest me any fun comamnd idea cause my bot have only 2 fun commands
Btw i want to ask one question
ouf
Is there any api or library that can convert a text into emoji?
Chess Bot.
I told for fun command not game
server cloner
Text flip + mirror text.
what is "fun comamnd" ? you mean like "broke server" command or something like that?
Like dank memer bot commands
Fun, try making economy features
then you can make Games to earn money
I need a db and my hand is tight at dbs
Can I suggest a stable, expandable, and simple bot infrastructure again…
I can use commands.guild_only to make commands only work in servers but how do I do this for events?
lmao same
@bot.command()
async def invert(ctx,text):
inverted = ''.join(reversed(text))
await ctx.send(inverted)
text[::-1]
No prob same meaning
@paper sluice
Can I ask something
you can check if the event channel is a DMChannel or not
Is it possible to make triggered command like dank memer bot in discord.py?
How do I check that?
I don't think bots can trigger commands for other bots\
Nop i not mean triggered that one
The fun image triggered one
That makes our avater look like we are triggered
like if you have an on_message event you can do
if isinstance(message.channel, discord.DMChannel):
return # to not respond to the dm things
or wait there is an intent which you can disable for the same
Like this
It's a .gif not .png
Gif not moving cause ss
Is it possible to make it?
you can disable Intents.dm_typing
hmm idk, search for some image manipulating module
not sure if PIL can make a gif
Add it with upside down
What will you do if upside down? 😕
PIL can't make .gif files ........
Well a text that's completly upsidedown
I not able to understand what you mean
to create gif you need multiple pictures (all different but kind of similar).
then maybe, there are some module that can create gif adding those different pictures.
- to view motion, pics MUST be different (you should know).
GIF is just a bunch of pictures together, so is every video 🙂
Is it possible to make a triggered gif comamnd?
If Dank Memer can, it's possible 😄
That's discord.js
Still you can do it
Idk java so useless for me
Python can do anything js can and in reverse.
TBH! discord.py module is deprecated! it's not maintained anymore.
Use alternatives if you like new updates. (nextcord, pycord, etc.)
You know nextcord and pycord are forks right..?
yes
Dpy is maintained.........
nextcord is alright but py-cord is just not so good.
its actually javascript, not java
No prob
Is dpy maintained?
yes?
^
I used both, and hardly found any difference... because the discord.py funcs are 90% similar on both the forks,
The newer feature implementations are different in them.
That's why I use dpy 2.0
its back in development
Don't believe everything you see on the web.
^
if u feel like it
Not much support for Hikari and more difficult.
I last modified my bots in January!. So, I was not sure if 2.0 was available back then! 🙂
I want to make a ai chat comamdb but idk how to make
Then I was using Disnake, since yeah the dev did quit for awhile.
that is what makes them forks
we got sarthak uwu
😴
too many cults in this server
Probably a warning but....if you cant use dpy then....
there's Rust, C and Hikari, what next, Golang?
all my homies hate golang
Me bored from dpy
Hikari is a library lol
i know
panda boomer 😔
tf hikari is not fun
Bruh i not talking about hikari
Grab random Memes from reddit or meme sites, then create a text channel where only the bot will mention a random member and post the meme every 1 hr. 🙂
hour?
10s seems good
Is there any way to make ai chat command?
😸
Ai chat will make mor annoying
there obv is
How?
N O
it will be too much annoying.
ping every 10s is too much
annoying.
who cares about the intensity
I do. 😛
learn ML
Machine learning hard like java
I'd use an API tbh
then you can't make it 🤷♂️
you got me
i can;t even see it lmao
That’s what you get for amoled mode
😔
😏 light theme be like
Right
Which api?
some random api
I have ti go school after 3 days and no discord bot coding 😭
manage time for that if you really like doing that.
you would need a message an a key query
they have a discord server, ask them how to get a key
Ok
More rea
lol
yes.
sarth's pupils are white
im trying to code a fight bot
i used that code i found from here:
@bot.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
msg = await bot.wait_for('message', check=check)
await channel.send(f'Hello {msg.author}!')```
i need to make the bot reply only when specified user writes hello
for example
when user writes
$greet @gusty shard
sorry i had to go
i want to make the bot reply when that specific user replies with hello
thats not i need
if message.content.startswith("hello"):
await message.channel.send(...)```
use the commands framework
"prefix-less"
oh
yeah this is what they wanted ig
why does no one use lambda for checks 😢
how to send a message in an interaction after defering it
i don't think interaction.response.send_message will work will it?
after doing interaction.response.defer()?
edit_message ;-;
i do

does followup work?
defer is your first response and you're editing it using edit_message
!d discord.InteractionResponse.edit_message
await edit_message(*, content=..., embed=..., embeds=..., attachments=..., view=..., allowed_mentions=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Responds to this interaction by editing the original message of a component or modal interaction.
@gusty shard ^
oh thanks
Hi all I wonder if anyone can help, I am just trying to build a basic reaction role atm (I am still learning), its of course not working... https://paste.pythondiscord.com/tagewuvaka
I am trying to send a set message to a certain channel with the bot reacting first, and then when someone reacts to the message with the emoji they get the role assigned. The emoji, the channel id and role name are correct.
So I can only assume I am going wrong in my code, but as I am new to python I am not sure what I am now missing, I was wondering if someone could assist me a little or point me in the right direction? 🙂
Intents is allowed for all, as the bot is just something I'll be using for myself and it has full admin rights too. I am not getting any errors, nor have I added any in as I am not sure where I would add error logging to my code to find out why its failing.
Also, while I am trying to use discord.py docs, is there any decent youtube/courses out there people would recommend?
looks like you're using outdated dpy docs
@paper sluice can you give any interesting challenge?
you done with the chatbot?
thenewboston is a pretty good yt channel
and be sure to use cogs they make life easier I THINk
bot.send_message, bot.add_roles, and bot.wait_for_reaction havent existed after the rewrite for a few years at least (interesting that wait_for_reaction was a thing), and on_reaction_add only takes (reaction, user) parameters
up-to-date documentation for 1.7.3 would be here: https://discordpy.readthedocs.io/en/stable/api.html (same link as in the channel topic)
also for a reaction role system its necessary to use on_raw_reaction_add(payload) since on_reaction_add is dependent on the message cache (after a bot restart, whatever message you have your reactions on won't be in the bot's cache so on_reaction_add won't fire when you want it to)
I not understood what to do
oh the github repo also has an example of reaction roles: https://github.com/Rapptz/discord.py/blob/v1.7.3/examples/reaction_roles.py
quiz bot? something like @lament depot 's .quiz
Ha, so I have written it in the old discord.py great, now to relearn everything 😐 hahah cheers for the advice, back to the drawing board I guess.....
I'll steal code 😂
Super star, I'll take a nosey over that and see if I can integrate it into my current code 🙂
it's not stealing it's learning from others
Sureeee
Sadly i don't found code of .quiz :(
many variables there are defined out of function scope, so don't forget to check them.
Very hard for kid like me
This comamnd not for noob like me
try making your own implementation of it, collect some quiz questions with 3-4 answers out of which 1 would be correct, send the questions along with answers and add buttons/ reactions for choosing the answer, the first user to select the correct reaction wins...
i use them even for longer ones rip py event: hikari.InteractionCreateEvent = await fun.bot.wait_for( hikari.InteractionCreateEvent, timeout=30, predicate=lambda inter: isinstance( inter.interaction, hikari.ComponentInteraction ) and inter.interaction.user.id==context.author.id and inter.interaction.message.id == msg.id and inter.interaction.component_type == hikari.ComponentType.SELECT_MENU, )
Sorry, just a quick question if you don't mind.
The example you've given you for the reaction role github page has in;
"client = MyClient(intents=intents)"
where as I use;
bot = commands.Bot(command_prefix='!', intents=intents)
so I don't think it will work for me. Would it just be I need to change the top part:
class MyClient(discord.Client):
to
class Bot(discord.Client):
everything you use in discord.Client works in commands.Bot too, since its just a subclass
so that won't be an issue.
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
async with x Asynchronously initialises the bot and automatically cleans up.
New in version 2.0.
This class is a subclass of discord.Client and as a result anything that you can do with a discord.Client you can do with this bot.
Collecting discord.py
Downloading discord.py-1.7.3-py3-none-any.whl (786 kB)
ERROR: Could not find a version that satisfies the requirement discord_slash (from versions: none)
ERROR: No matching distribution found for discord_slash
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51
``` eh how i fix it ?
there's no library called discord_slash on pypi
what do i do....then.
!pip discord-py-slash-command is the library name on pypi ig? also stop using it, its outdated
Fair enough, more learning to go do then. Thank you for the time guys, much appreciated. Long way to go for me 😄
yea ill soon switch to dpyv2
good luck with that!, feel free to bring your doubts here.
great, for now you can fix it by using the package-name i mentioned above, here's a guide for starting up with v2 application commands : https://gist.github.com/Ash-02014/b6f57065f394b54f43666037ade38d32
cool ty
put them in a new line easy
Hard for me 😢
you can atleast try, you would be able to make the bot send a random question with options if not the complete command :)
!kindle try to implement one of these projects in ur discord bot
Kindling Projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
codewars is a nice resource too
My Brian not big like your
you cannot use \n outside strings, so put them inside a string
atleast give it a try.
Sorry can't
everyone's brain size and mass is roughly same👀 what matters is how much u can use
- quotes
How to make an unban?
await unban(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unbans this member. Equivalent to [`Guild.unban()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.unban "discord.Guild.unban").
!d discord.Guild.unban , this exists too in case you don't wanna use an object but just the ID
await Guild.ban/unban(discord.Object(id=<the ID here>))
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/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
how can i send any message in any text channel ?
@client.command(aliases=["msg"])
async def announce(ctx, channel: discord.TextChannel, string):
await channel.send(string)
I am currently using this but it doesnt detect spaces between the text
try
async def announce(ctx, channel: discord.TextChannel, *, string):
thanks
File "main.py", line 3, in <module>
from dinteractions_Paginator import Paginator
ModuleNotFoundError: No module named 'dinteractions_Paginator'
Traceback (most recent call last):
File "main.py", line 3, in <module>
from dinteractions_Paginator import Paginator
ModuleNotFoundError: No module named 'dinteractions_Paginator'
i have it added in requirement.txt
Official interactions.py paginator
"official" like....heck
ehh
don't use external modules, discord.py already has paginator support, you can make your own ones as well
;-; thats not how you import it
from interactions.ext.paginator import Page, Paginator
Official interactions.py paginator
dont think they are using discod.py, if they are its a very bad idea to use another library's extension
oh, i didnt even notice its a full wrapper
alr
Traceback (most recent call last):
File "main.py", line 4, in <module>
from interactions.ext.paginator import Page, Paginator
ModuleNotFoundError: No module named 'interactions'
what do i write in requirements.txt though ?
what library are you using>
for ?
The bot does not have the applications.commands scope.
All you have to do is go to https://discord.com/developers/applications/ and follow steps shown below:
You do not have to kick your bot from the guild, just re-invite it with the generated URL.
to join discord.py server, but Im banned, does anyone know
how to get unbanned from it?
perfect
ok well my coding question is that
I dont know how to create select menus
in discord.py 2.0
using cogs?
!d discord.ui.Select
class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.
This is usually represented as a drop down menu.
In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Select.values "discord.ui.Select.values").
New in version 2.0.
ty
class discord.SelectOption(*, label, value=..., description=None, emoji=None, default=False)```
Represents a select menu’s option.
These can be created by users.
New in version 2.0.
Hello I don't really understand what went on with discord.py but I just know that it is coming back again as discord.py 2.0 .
I have used discord.py for all my bots so far and never bothered to switch to something like nextcord.
My questions are:
If I upgrade to discord.py 2.0 does this force me to use slash commands or can I still use regular any prefix commands?
Should I just stick with discord.py because I never switched out, not sure how different 2.0 is
ty
You can still use your regular prefix commands.
However, if you would like to add slash commands and use the interaction module, then you can do that as well, additionally.
I only switched to 2.0 because I wanted to use the interactions module, with buttons, slash commands, select menus, etc..
I think its better to switch though, so that you can use the new features that are constantly being added.
You will have to make some changes to your code though after switching.
I see, can I leave my old code to run on the old version of discord.py or will I need to update all of it to 2.0?
You can let it run, I mean nothing will change if you don't update it.
It will still work
I thought the reason 2.0 was being made is because discord is updating api so the old discord.py would no longer work?
discord API v8 is not deprecated yet, it still works
I mean I only switched to 2.0 like 2 weeks ago
I guess keyword is yet, not sure how much longer and if it will still work after a certain amount of time.
I assume I would have to update all the old code to 2.0? x.x
If you want to change to 2.0, your going to have to update some of it
Discord py 1.7 i will.be shifting to v2 soon
dpy doesn't have a v8 yet fyi
its barely few lines
guy is reading chem he got stuff mixed up
chemistry?
what
Eh ?
what exactly do you mean by dpy shifting versions
Like rn I'm not using dpyv2 but i will be pretty soon
Rn I'm using the dpyv1.7
it never will
*discord API v8
The one which doesn't have slash and all integrated into it.
I will*
its discord.py 2.0
are you aware how versions work?
they won't add new and breaking stuff to the same version.
for any change, a new version is created and uploaded to pypi
you can download any version.....even if newer versions are released on pypi
apologize
ik that 💀
I'm just telling cause then u all (not targeting) be like use the discord py2 cause it has slash and all
then what's your point with "dpy shifting versions"
you are the one shifting version
So I'm just telling u all in advance
😔 sowwie, i correct it later
I corrected it 😭 i had an typo
See ^^^
corrected*
🫂 focus on one thing, go study 😔 hffun
can someone review this?
https://gist.github.com/sarthhh/6377b5047a0a3055bc08208406fc35fe
good
cant, chemistry is just
with pleasure.
mutual feelings
So if I migrate to 2.0 I must use cogs? I'm not the best at coding so don't really understand classes as well
no its not important to migrate to cogs if you use 2.0
^^^
isnt dpy based on the principle of OOP 😔
.
download and install it uwu
python is OOP based lmao
Discord py 1.7
I did it already!
I know daddy
thats really cool
bot = hikari.GatewayBot(
"token",
intents=hikari.Intents(
hikari.Intents.ALL_UNPRIVILAGED | hikari.Intents.GUILD_MEMBERS
),
)
you can change it to this, i think it looks better
bot = hikari.GatewayBot(
"token",
intents=hikari.Intents(
hikari.Intents.ALL_UNPRIVILAGED | hikari.Intents.GUILD_MEMBERS
),
)
But it's still showing this
why are you using interactions.py extensions then
👀
oh yeah i added a tab by mistake maybe, thansk!
I can't find the different.....
I was using this first...
fml
the bracket in the last line
last closing paren
looks are important
thats what she said
^
PyCharm has has implemented linting in my blood
You even need meditation, Ryuga
do yoga
My parents say that as well
nvm
event that wont work, its an extension for completely different library.
there was a chance that it could work if it was some fork, but thats not the case
What do I do then ?
😔
for the first one... idk, check their description
bad english
i felt that it should be statically-typed
yea
why did I open pycharm to do rust 
typical british ppl
ill blame grammarly
I'm better than grammarly /s
continues making typos
hw two spel 
ash bill teach u
shouldn't it be "discord gateway" rather than "API" 😔 idk just seems better
nope
elaborate 😔
its required by the REST API too.
collectively both REST API and gateway
oh yeah forgot about the rest
i would really leave it in the dpy server if this was one for discord.py
critics there would figure out lots of mistakes
they only figure out mistakes when its not in their lib
I already have questions about the gist examples
sure
what is it
oh wait
I'm sorry if I'm annoying smh
😔 i misunderstood ig
"Basic Example"
no 😔
they will wonder what events are after seeing the example and right under that they will find the answer
I don't see an issue with it
am I the only one who doesn't plan future shit
thats literally how every library starts with its introduction...
sorry daddy 😔

my future plans for itself 😎
congrats, your life is now being run by stackoverflow
karen
😏
sarth sarth I got a question
yes what is it
can you access the in-built logger for hikari?
with some property etc, no
from the source code, forsure
hm, that's bad, thanks
there may be some private methods, ill check
yeah im doing that
thanks though
you should study
apologies for disturbing 😔
hikari/internal/ux.py line 62
def init_logging(```
You can but everyone’s levels will get reset to 0 when your bot goes offline
hi robin
So I suggest you either use a database or make sure you’ve covered every single error and handled it all perfectly
Hey
How else do you plan on saving persistent data in something as volatile as memory?
JSON is not a database and should not be used as such
json is not great for storing large amounts of data its not meant to be used as a db
just write on a paper manually
It’s a serialization format, not a database
i used to do that before i discovered excel
if you're free could you check this before i make a pr to the site's repo
https://gist.github.com/sarthhh/6377b5047a0a3055bc08208406fc35fe i feel that its ready but is there anything else you would suggest?
am I the only one who hasn't written anything with a pen for more than 2 years
😔
Go ahead and PR it, I can review it there
I’m also not home at the moment so it’ll be a while before I can do that
me too, let's exclude tests
ah then same
writing is so 2019 😳
wdym "with roles"?
add callbacks
when they select it, they get the role
why would you respond with a role?
you add role to the member who selected the option
role = guild.get_role(id) # define guild
await member.add_role(role)
imo py-cord is so godly that I'm forbidden to help
im pretty sure its add_roles
or does pycord change the name
you are probably right
no, you are always right
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
