#discord-bots
1 messages · Page 49 of 1
@slate swan i'll have to use a setup hook right (for persistence)
how would that work when views are being created dynamically?
this might explain it better
hm, how can a view be persistent if it's dynamic lol
i want the second description to ping the reaction user, not author
by persistent i mean button still working even when bot is restarted
what's holding you back, ping the user then 
I know?
so thats not possible if buttons are being dynamically added/removed?
oh so is the persistence on views only for static ones?
i need the bot to ping the user who reacted. inside the embed in description= 😔
I'm dumb, I got no clue on this one
you're using a wait_for?
allg thanks ❤️
return user == ctx.message.author and str(reaction.emoji) == '✅'
await bot.wait_for('reaction_add', check=check)
embed = Embed(color=discord.Color.dark_green(), title="?", description="<@{}> Has accepted".format(ctx.author.id))
embed.set_footer(text="Game has been accepted")
embed.set_thumbnail(url=ctx.author.avatar_url)
embed.add_field(name="?", value="?", inline=True)
embed.add_field(name="?", value="?", inline=True)
confirmationMessage = await ctx.message.channel.send(embed=embed)
await confirmationMessage.edit(embed=embed)
await confirmationMessage.clear_reactions()```
wait_for returns the reaction and user
@slate swan my guy
^
we literally went through this 😭
OH
ignore my dumbness lmao
thanks!
❤️
[2022-08-21 16:07:05] [ERROR ] discord.ui.view: Ignoring exception in view <ModalView timeout=180.0 children=1> for item <ModalButton style=<ButtonStyle.primary: 1> url=None disabled=False label='ΑΞΙΟΛΟΓΗΣΕ' emoji=None row=None>
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ui\view.py", line 412, in _scheduled_task
await item.callback(interaction)
File "ticket.py", line 70, in callback
await interaction.response.send_modal(whitelist_collector)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\interactions.py", line 842, in send_modal
await adapter.create_interaction_response(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\webhook\async_.py", line 221, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0: Value of field "type" must be one of (4,).
how can i check if the command used in dms?
isinstance(ctx.channel, discord.DMChannel)?
or ctx.guild is None
yeah that also
if message.guild != None means the command used in a server, isnt it?
yes
not sure what to do here
this line worked befor the discord.py update, but now it must be returning something different?
messages = await channel.history(limit=1000).flatten()
error:
File "main.py", line 1165, in on_message
messages = await channel.history(limit=1000).flatten()
AttributeError: 'async_generator' object has no attribute 'flatten'
okay thanks alot 🙂
"titles":[{"type":"Default","title":"Horimiya"},{"type":"Synonym","title":"Hori-san and Miyamura-kun"},{"type":"Japanese","title":"\u30db\u30ea\u30df\u30e4"}
this is a part in the api and idk how to only get the title "titles":[{"type":"Default","title":"Horimiya"} pls tell me how to do it
value = dict[key]
resp["titles"][0]["title"]
How do I make multiple on_message listener events?
he ment the route
So I can keep code clean
thx man
that's for him to figure out, not us
make them in cogs
ok
he's never going to learn how to do it himself otherwise
@commands.Cog.listener()
So can I have another on_message function in a different cog
i know about this bruh
then why did you ask here? You could've easily figured it out on your own
noid left a " at last for him to figure out so he can't copy paste 
parsing is hard😳
i didnt know how to skip stuff in between
what skip stuff
i wanted to skip type and only get title
so you wanted to get the value at title key??
^^
Can you add on_message listener event in multiple cogs?
yes
very cool kanye
!d nextcord.ui.button
nextcord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`nextcord.ui.View`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.ui.View "nextcord.ui.View"), the [`nextcord.ui.Button`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.ui.Button "nextcord.ui.Button") being pressed and the [`nextcord.Interaction`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Interaction "nextcord.Interaction") you receive.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.ui.Button "nextcord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
how to use discord emojis in python ? like when i copy them they come as :emoji_name: and not as an emoji. i wanna use them to make my bot add reaction but they dont work
@commands.command()
async def anime(self, ctx, *, message):
async with aiohttp.ClientSession() as cs:
async with cs.get(f"https://api.jikan.moe/v4/anime?q={message}") as r:
res = await r.json()
em = discord.Embed(url = {res['url']},
color = h(),
timestamp = ctx.message.created_at,
title = f"{res['titles'][0]['title']}",
description = f"{res['synopsis']}\n\n\nSynonyms:{res['titles'][0][0][0]['title']}\n\nEpisodes: {res['episodes']}\n\nAired: {res['aired']['string']}\n\nDuration: {res['duration']}\n\nStatus: {res['status']}\n\nRating: {res['rating']}\n\nRating: {res['score']}\n\nSeason: {res['season']}\nTrialer: {res['embed_url']}")
em.set_thumbnail(url = f"{res['images']['image_url']}")
em.set_footer(text=f"Requested by {ctx.author.name}", icon_url=ctx.author.avatar.url)
await ctx.send(embed=em)
I am trying to get info about anime and this is the address https://api.jikan.moe/v4/anime?q=horimiya, it is showing that keyerror and i dont know what to do, i think theres some mistake in taking the info from the api but idk so can anyone pls tell me what i can do to fix it?
can somebody help me please
you need to give the complete path to it
there isn't a "url" key
hbdc is the folder its in?
yes
wdym? this api is free
{
"pagination": {}, // 4 items
"data": [] // 1 item
}
``` is the response
what?
try ./hbdc/userdata.json
what do you mean by key?
dictionary key?
``` like that?
yeah something like that
got it, i will try
that won't work
those paths don't use dot notation like that
ever since the new discord.py update i havent been able to use tasks.loop 😦
anyone know how i can get them to work again
example
@tasks.loop(seconds=60)
async def reminder():
id = #number
await client.fetch_channel(id)
await channel.send("it has been 60 seconds!")
error i keep getting when i try to start it
File "main.py", line 1227, in <module>
reminder.start()
line 398, in start
self._task = asyncio.create_task(self._loop(*args, **kwargs))
File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/tasks.py", line 381, in create_task
loop = events.get_running_loop()
RuntimeError: no running event loop
yeah that'll work as long as there is a file existent in the hbdc directory named userdata.jsonuserdata.json
where are you starting the loop
just befor i start the client
getting this error now
.
i think zeffo had a point
reminder.start()
client.run(TOKEN)
yh ik lol
hm, try usinhg start instead of run
okay
the "data" key points to a list
that list contains multiple dicts which have a url key
same error, regardless if its client.start or client.run
that's weird
this only happend after the new update
so idk if it has something to do with the new intentions thing
nvm got it
start the tasks in setup_hook
or make task
what is setup_hook?
its a namespace thats the first thing to get called when your bot runs and gets called only once
could i get docs or an example of how to use this?
!d discord.ext.commands.Bot.setup_hook
await setup_hook()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A coroutine to be called to setup the bot, by default this is blank.
To perform asynchronous setup after the bot is logged in but before it has connected to the Websocket, overwrite this coroutine.
This is only called once, in [`login()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.login "discord.ext.commands.Bot.login"), and will be called before any events are dispatched, making it a better solution than doing such setup in the [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready") event.
Warning
Since this is called *before* the websocket connection is made therefore anything that waits for the websocket will deadlock, this includes things like [`wait_for()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.wait_for "discord.ext.commands.Bot.wait_for") and [`wait_until_ready()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.wait_until_ready "discord.ext.commands.Bot.wait_until_ready")...
thx
!d nextcord.Interaction.edit
await edit(*args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This is a shorthand function for helping in editing messages in response to a component or modal submit interaction. If the interaction has not been responded to, [`InteractionResponse.edit_message()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.InteractionResponse.edit_message "nextcord.InteractionResponse.edit_message") is used. If the response [`is_done()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.InteractionResponse.is_done "nextcord.InteractionResponse.is_done") then the message is edited via the [`Interaction.message`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Interaction.message "nextcord.Interaction.message") using [`Message.edit()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.Message.edit "nextcord.Message.edit") instead.
tysm it works 🙂
cheers
Hi guys, I have read that discord.py was non-existent for a while due to the restructuring of discord and slash commands. My plan is to start with python and I would like to start with a bot as a first project. Which python wrapper is currently the best and most up to date? I am migrating my discord.js bot, which python wrapper is on the same current state?
for 6 months until it goes brrr
I highly don't recommend starting learning python from a discord bot
Unless you know programming like very well
Had an argument with some guy I was working on a bit with, he asked to switch to discord.js because it’s more up to date but I screamed at him
kek
I learnt from books 
Write a discord bot in JDA I dare you
ok ty
Also discord.py as well as nextcord fall then with me into the closer selection. Which of the two has the larger community and what are the differences? Or the respective advantages.
Tf is JDA
EW
how do i copy discord emojis which are not on google to copy like 🇩 ,🇮 ,🇱 and all ? when i copy them they come like :emoji_name: and i cant use them in my command here in python
its not my first language all fine thanks
Ok
So discord.py or nextcord what would you recommend?
discord.py has the larger community for sure
ok
I'd say go with discord.py since more people know about it in general but it's ultimately up to you
Tbh I would make my own lib with JDA as a core dependency handling all the internal stuff but make the lib itself user-friendly
Because java networking is true hell
try networking in cpp 😄
Oh mo
u can use letters as like reigonal_indicator_a
!charinfo 🇦
\U0001f1e6: REGIONAL INDICATOR SYMBOL LETTER A - 🇦

Yes larger community means I find more on stackoverflow and co. so discord.py. Thank you for the thought
ohh thankyou so much 😭
Anyone knows how slash commands work ?
Tree
click on this
Traceback (most recent call last):
File "smth\slash-commands.py", line 2, in <module>
from discord import app_commands
ImportError: cannot import name 'app_commands' from 'discord' (smth\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord_init_.py)
I get this error @slate swan
Asher directing innocent people to malicious links 
Ok
How can I make it so if the ```py
data = requests.get(f"https://eu.mc-api.net/v3/server/ping/{serverdata}").json()
ping takes too much (more than 3 secs, meaning server not is down) I would get a print of `server offline` or something ?
*if the server is offline my bot is remains stuck on that line and does not update the embed with `Server is offline` as it should
finally some real help (discord.py server is a scam)
yea u get better help here
indeed
requests kek
i got banned cuz i asked for help like what the heck ?
timeout=3
ive never entered the server and i got banned :kek:
lel
thx
seems to work with requests
Aiohttp is better
requests is blocking
Because it’s asynchronous or smth
aiohttp is async, and discord.py is async
when something takes long to eval, you need async
oh..only tested in a non-async enviroment, using prints
not always the case
for something like sending requests, yes
making a request doesnt take long depending
nor was your point directed at making a requests
just set the timeout to 1, that will do it lol
you can't depend on the request taking a very short amount of time
the issue with blocking code in asyncio is that your bot cant multitask during that process
the best practice for dpy, is async
your code should be non-blocking as much as possible
this is more descriptive
imagine just 10 users trying to use commands, and one of those commands holds up the bot for a second or two
the whole point is to use asynchronous libraries to reach concurrency lmao
mhm
hey, this code worked once but is not working now and is showing error, whats the issue do you know ?
i want these codes, how can i get them ? should i invite this bot in my server then get those codes there or is there a channel in this server where i can get these codes ?
“\xxxxxxx” I think
meaning ?
What is the question your asking 😭
you cant invite @unkempt canyon as hes an exclusive bot for this server, you can use the command in #bot-commands for personal use
!src
oh ok thankyou so much
all the bots here are open source (except black knight, but that didn't stop me) so you can fork the repos, adjust it and deploy
im pretty sure theres others as well
yup
I still wonder why is black knight's source closed
read it's bio
@inland quail why are you not open sourced?
"nature of functions" tf this means
oh yeah, i got a few leaks fmor staff
im very convincing
staff said that black knight was used for raid mitigation and handling
Its not open sourced because it would be more vulnerable to exploits, TL;DR security
might be scanning on all users on join
Raid prevention? It shouldn't be too hard to implement
Understandable
by leaking this information, i've put myself at risk of being silenced by the orange role
i must leave
it never said it was used for "Raid prevention" so it probably has more than that
maybe it uses machine learning
Open source for me 😉
Watch robin get banned
!d discord.Client.application_id or smth
property application_id```
The client’s application ID.
If this is not passed via `__init__` then this is retrieved through the gateway when an event contains the data or after a call to [`login()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.login "discord.Client.login"). Usually after [`on_connect()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_connect "discord.on_connect") is called.
New in version 2.0.
For bots it is the same with bot's ID so you can just use this
How can i set those to default?
hyped
Or bot.user.id
Nice, thank you
Just don't provide them lmao
i did not... that error popped up
I mean don't provide them at all
Looks like its required to provide them once the guild feature community is being enabled
boutta remotely connect to your computer to gain access to the repos. purely to review it's contents so i can perform further, general leaks on the nature and use of @inland quail as to gain popularity
No, if you don't provide anything they don't get edited
Hey @cerulean shale!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
but i have to set the community to True lol
for all i know bots in the server are selling my data to zuck
they wouldnt/cant sell useless data
await after.edit(community=True) and that's it
if this makes more sense tho. My bad for sending just the last line of the error
To enable community you have to define the rules channel and public updates channel too
If community is not enabled there's no default value at all
Exactly. How can i define it to create default channels for it?
One sec
oh
!d discord.Guild.edit
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., afk_channel=..., owner=..., afk_timeout=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the guild.
You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to edit the guild.
Changed in version 1.4: The `rules_channel` and `public_updates_channel` keyword parameters were added.
Changed in version 2.0: The `discovery_splash` and community keyword parameters were added.
Changed in version 2.0: The newly updated guild is returned...
if "COMMUNITY" in set(before.features).symmetric_difference(after.features):
if "COMMUNITY" in before.features:
#await after.ban(i.user, reason="Anti-Nuke: Managed guild community")
await after.edit(community=True, rules_channel=)
here is more of the code. Im checking if there is being a change made using `symmetric_difference``
@dry kelp try setting them to None and see if it works
Otherwise I think you might have to create the channels by yourself first
pretty sure. because you cannot set a none value when turning on community manually
There's no mention about that thing in docs
i want to get image_url from images dict which is in data dict, how can i do it? i tried f"{res['data'][0]['images'][0]['image_url']}" i copied the data and formatted it a bit as it was clumsy, any ideas?
let me try using it none...
How do I make it so multiple roles can be assigned to use a specific command in cogs?
It doesnt accept lists though D:
@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.
Similar to [`has_role()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.
This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
It accepts arglist
You can provide a common list by putting an asterisk before it
your_roles = [1, 2, 3]
@commands.has_any_role(*your_roles)
...```
I will try after the rain stops x)
You're an absolute gem, tysm
anyone? ;-;
@vale wing Currently at my gradma. Internet is really bad, will be a pain to test lol
Same for every seq
author=message.author
guild=message.guild
async with self.bot.db.cursor() as cursor:
await cursor.execute('SELECT xp FROM levels WHERE user = ? AND guild = ?',(author.id,guild.id))
xp=await cursor.fetchone()
await cursor.execute('SELECT level FROM levels WHERE user = ? AND guild = ?',(author.id,guild.id))
level=await cursor.fetchone()
await cursor.execute('SELECT ssc FROM levels WHERE user = ? AND guild = ?',(author.id,guild.id))
ssc=await cursor.fetchone()
if not xp or not level or not ssc:
await cursor.execute('INSERT INTO levels (level, xp, ssc, user, guild VALUES (?,?,?,?,?)',(0,0,0, author.id, guild.id))
can someone help me with my leveling code please?
data 0 images jpg imageurl
You forgot a closing bracket before VALUES
Ight
just make default values when creating the table
who inserts default stuff 😔
oh i almost forgot about the error close the bracket after guild)
then VALUES
How to add a reaction
I’m currently using
my_msg = await interaction.response.send_message(embed=embed1)
await my_msg.add_reaction(“. . .”)
Error:
Command ‘gcreate’ raised an exception: AttributeError: ‘NoneType’ object has no attribute ‘add_reaction’
the video is from youtube tho
https://www.youtube.com/embed/42LiC4xY8YE?enablejsapi=1&wmode=opaque&autoplay=1
thank you!!!!!!!!!!!
and you too!!
np u can use it
Any help?
because the method doesnt return a message obj like Context.send
So what should I do?
!d discord.Interaction.original_response
await original_response()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Fetches the original interaction response message associated with the interaction.
If the interaction response was a newly created message (i.e. through [`InteractionResponse.send_message()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionResponse.send_message "discord.InteractionResponse.send_message") or [`InteractionResponse.defer()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionResponse.defer "discord.InteractionResponse.defer"), where `thinking` is `True`) then this returns the message that was sent using that response. Otherwise, this returns the message that triggered the interaction (i.e. through a component).
Repeated calls to this will return a cached value.
found it lol
it aint working
strange it works for me how are u settings the url
also is the url valid
em.set_image(url = f"{res['data'][0]['trailer']['url']}")
https://www.youtube.com/watch?v=42LiC4xY8YE this is the link
this isnt supported so i am taking other link
await something.add_reaction(“. . . “)```
hmm remove those queries after ? mark maybe
that is correct
k
remove the ? mark also
The error is quite explanatory?
no column reason in the table
drop it and make the table again
kek
i think u made the table first and then edited the code later and the table was never updated
drop the table 🗿
is connection corruption posible in aiomysql?
should be but gonna be a very rare case
in sqlite it always happens if you never close a connection, which makes troubleshooting hard sometimes
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
i don't use aiomysql or aiosqlite just use pgsql never happened there
How to like show role list when user select an option in slash command?
asyncpg 👍
I looked it up and it seems that only gifs and images can be embedded, videos can't be embedded 🥲
autocomplete in options for the command?
dont you need a server to host the pg engine?
oh ok rip sed
yeah i use railway or heroku
I mean it gives the list of roles to choose from
cant you use docker as well?
typehint it as a discord.Role?
use app_commands.Choice and autocomplete
project is local running on vps the db is hosted
yes, but i mean can you use something like docker compose to have everything localized
rpi so i don't wanna keep the db local in case i somehow corrupt the sd card
yeah u can
lol
i mean the sd has a lock mode where it locks itself to prevent writes in case it reaches beyond its limits but don't wanna take the risk
how can I remove a reaction from a specific user?
!d discord.Message.remove_reaction
await remove_reaction(emoji, member)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Emoji "discord.Emoji").
If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.
The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.

i wanna use this
Just how 💀
💀
yk why?
@glad cradle
relatable
using the str class to convert an int into a string in an f string, kek
me after breaking arch
Any fix?
as a seasoned windows user, when your installation crashes for the 8th time in 30 seconds, you don't need to panic. but when your default browser changes? now thats~ r e a l f e a r
average windows experience
there is no more orange in ubuntu 20.04((((
sadge:( i cannot eat orange anymore
what do i do(((
i managed to corrupt the theme files once no gui for 6 hrs after till i fixed it somehow
ive managed to corrupt a game 3 times already lol
bro can u fix this error
2022-08-21 08:50:13 ERROR discord.ext.commands.bot Ignoring exception in command steal
Traceback (most recent call last):
File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 195, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\8ster\OneDrive\Desktop\projects\Discord Bots\Novicookies\main.py", line 48, in steal
random_steal = random.randrange(0, member_cookies_amt, -1)
File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\random.py", line 363, in randrange
raise ValueError("empty range for randrange()")
ValueError: empty range for randrange()
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1330, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 991, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 204, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: empty range for randrange()```
lemme send the code
kek
import discord
from discord.ext import commands
import json
import random
bot = commands.Bot(command_prefix='>', intents=discord.Intents.all())
@bot.event
async def on_ready():
print("Bot is Now Online")
@bot.event
async def on_message(message):
user_id = str(message.author.id)
with open("jar.json", "r+") as file:
jar = json.load(file)
if not user_id in jar:
jar[user_id] = {}
jar[user_id]["cookies"] = 5
jar[user_id]["cookies"] += 5
with open("jar.json", "w") as file:
json.dump(jar, file)
await bot.process_commands(message)
@bot.command()
async def jar(ctx):
user_id = ctx.author.id
user=ctx.author
with open("jar.json") as f:
data = json.load(f)
cookies_amt=data[str(user_id)]["cookies"]
await user.send(f"You currently have **{cookies_amt}** cookies in you jar.")
@bot.command()
async def steal(ctx, member : discord.Member):
with open("jar.json", "r+") as file:
jar = json.load(file)
member_id = member.id
member_cookies_amt=int(jar[str(member_id)]["cookies"])
random_steal = random.randrange(0, member_cookies_amt, -1)
user_id = str(ctx.author.id)
if not user_id in jar:
jar[user_id] = {}
jar[user_id]["cookies"] = 5
if not member_id in jar:
jar[member_id] = {}
jar[member_id]["cookies"] = 5
member_cookies_amt=jar[str(member_id)]["cookies"]
random_steal = random.randrange(0, member_cookies_amt, -1)
jar[user_id]["cookies"] += random_steal
jar[member_id]["cookies"] -= random_steal
member_cookies_amt=jar[str(member_id)]["cookies"]
random_steal = random.randrange(0, member_cookies_amt, -1)
jar[user_id]["cookies"] += random_steal
jar[member_id]["cookies"] -= random_steal
with open("jar.json", "w") as file:
json.dump(jar, file)
bot.run(<token!!!!!!!!!!>)
blockingio kek
again the whole code
;\
@bot.command()
async def steal(ctx, member : discord.Member):
with open("jar.json", "r+") as file:
jar = json.load(file)
member_id = member.id
member_cookies_amt=int(jar[str(member_id)]["cookies"])
random_steal = random.randrange(0, member_cookies_amt, -1)
user_id = str(ctx.author.id)
do print(member_cookies_amt) to make sure who are they, and are they supposed to be negative?
this is where the error occurs
@silk fulcrum
me
im blue in this message
it is printing some random number. However there is not data currently in the jar.json
should I start over the steal command?
@silk fulcrum
do you mean remake it from 0?
yes remake a the steal command from 0
a bunch of hot🥵 errors
probably yes, btw it's better to consider using aiofiles instead of that with open(...):
so now I need to read the documentation
uhm, no idea what is that, make sure your aiohttp is up to date
what is better in ur opinion json or aiofiles
with open won't hurt too much until it isn't a quite big bot, you can switch to aiofiles now or later
what are the benifits of it?
concurrency
aiofiles ofc, btw it still uses json, problem is that with open is not async
noid can explain further, he's very exhaustive about it
wtf did i say exhaustive about it
yeah
i think you ment extensive?
maybe I should learn more engilsh
kek
nah I meant like... picky, exacting
but exhaustive is literally not what describes those words
hmmmmmyo aiofiles in preety simple
with open is synchronize and runs on bare python, while aiofiles uses the abstraction of an event loop and schedules the task to the event loop to manage it, to reach concurrency over running it in order of calls/bare python
hehe
it is
but I don't care, I just use with open because I use it very rare :fricc:
you mean precise?
yeah probably

meticulous :lmao:
Any help
Cause I don’t get any errors
is there anyway to have tickets/buttons to stay open even after restarting the bot?
i have made this ticketing system but when restarting bot, the interaction command becomes inactive
if you are using discord.py 👇
add_view(view, *, message_id=None)```
Registers a [`View`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View "discord.ui.View") for persistent listening.
This method should be used for when a view is comprised of components that last longer than the lifecycle of the program.
New in version 2.0.
oh right, thanks
if req not in interaction.user.roles:
msg = await interaction.original_response()
await msg.remove_reaction(":giveaways:", interaction.user)
Reaction is not removed
Role is this
role: discord.Role
Sorry I mean req: discord.Role
@slate swan
you mean is in it?
oh bruh

my eyes are dying
bruh....
dying
33's week in this year is almost gone
for someone already gone
and that's the problem
my brain bruhed outsideness, so...
your check is if req NOT in ...roles: @slate swan
and my brain bruhed again
kill me pls
no idea what is the problem
Then it should remove my reaction
and better not ask me ig, my brain is dead, it's not enough power to understand basic if conditions
@primal token go help, your brain and blockingio are not dead
kek
kek
kek
was trying to find some reminder app for Ubuntu
but find only trash
interesting
and one app that looked good, but no idea how to make a repeating task in it (every day)
intents are now required, kek
intents are now required since discord.py 2.0 (https://discordpy.readthedocs.io/en/latest/migrating.html#intents-are-now-required)
:waiting:
All intents are on
check the link I sent
In your application, you never passed the intent abstraction of dpy, to connect to the gateway and identify which gateway events you shall receive
@silk fulcrum
what:(
do watch hikaru's bongcloud speedrun
not simple at all
how do i make my discord bot automatically send a message as soon as a ticket is made by ticket tool?
docs kek
who reads them right
can someone help me make this command?
i make them
By another bot?
what
bruh, you are making a useless thing
TicketTool is a bot
yes
they are not clear enough 😦
i want my bot that im making to send a message as soon as ticket tool makes a ticket
I wanna make a currency bot
I mean if you wanted to you could just set up an auto-responder
soo...
its literally the same syntax but with async and await syntax lol
sooo?
!d discord.on_guild_message_create listen for this and check if that's the correct channel. I'd recommend setting up tickettool to use certain category for tickets and in your code you could just compare category id
No documentation found for the requested symbol.
!d discord.on_guild_channel_create
discord.on_guild_channel_delete(channel)``````py
discord.on_guild_channel_create(channel)```
Called whenever a guild channel is deleted or created.
Note that you can get the guild from [`guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.guild "discord.abc.GuildChannel.guild").
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
Use on_message event
a db is what you would use to store large data and to do CRUD operations
you want to use db instead of json? @pulsar solstice
No idea why I wrote on_guild_message_create wtf
I wanna store a number in a veriable kind of thing
yeah?
kek
json is also a db right?
no?
No
KEK
and aiofiles is also a db?
BRUH
💀
.txt files is best db
wym
can u explain in dms
cause I use them as a db it not my fault
aiofiles is a library to do file operations asynchronously
I remember reading somewhere that it's pointless
But it is.......
because something can hold data doesnt make it automatically a database
Not sure why but they said like "I/O operations are CPU blocking anyway"
bruh pls just tell me where I can learn in depth about it?
I don't understand asyncio principles that well so not gonna argue or smth
RDanny uses Config class, it's reading a JSON file and using it like a small db connection iirc
!pypi aiosqlite | to use an SQL based db and to learn SQL use https://sqlbolt.com
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
can someone help me make this
Created an embed with 3 fields
Make exactly what
if its for parsing small data its good and if its static uppon run time even better
so should I learn sql Instead?
what it says and the layout and the server name and icon
okkay
yes
okay I hope it's worthed
it is, SQL is quite good and simple and is used for many dbs that are based uppon the language, e.g postgresql is used in production level
!d discord.Guild.members -- Users
property members```
A list of members that belong to this guild.
iterate through members and check if they're bots or not -- Humans + Bots
!d discord.Guild.icon.url -- server icon url
property icon```
Returns the guild’s icon asset, if available.
@slate swift
thats confusing
kek
kwek
e.g
humans = [h for h in ctx.guild.members if not h.bot]
see not that hard
async def mc()``` ok but where do I go on from here
kek
pass ctx since it's required....
master can help you with that hes smart
async def whois(ctx,user:discord.Member=None):
if user==None:
user=ctx.author
rlist = []
for role in user.roles:
if role.name !="@everyone":
rlist.append(role.mention)
b = ','.join(rlist)
embed = discord.Embed(color=user.color,timestamp=ctx.message.created_at)
embed.set_author(name=f"User Info - {user}")
embed.set_thumbnail(url=user.avatar_url),
embed.set_footer(text=f'Requested by - {ctx.author}',
icon_url=ctx.author.avatar_url)
embed.add_field(name='ID',value=user.id,inline=False)
embed.add_field(name='Name:',value=user.display_name,inline=False)
embed.add_field(name='**Dates**',value=user.created_at,inline=False)
embed.add_field(name='**Created**:',value=user.created_at,inline=False)
embed.add_field(name='**Joined**:',value=user.joined_at,inline=False)
embed.add_field(name='Bot?',value=user.bot,inline=False)
embed.add_field(name=f'Roles:({len(rlist)})',value=''.join([b]),inline=False)
embed.add_field(name=f'Top Role:',value=user.top_role.mention,inline=False)
await ctx.send(embed=embed) ``` can someone tell me why this command doesnt work
an error?
bruh @sick birch is there a doesn't work paragraph somewhere on the website? it's so required
I might have to fuck it and just PR a tag honestly
PR? waht does that mean?
pull request on GitHub
ohkay
well at least there is this https://pythondiscord.com/pages/asking-good-questions/ @slate swift you should check it
Who and why are they asking this question lol
Lol
mh?
im terrified of my computer
del sys32
ps: not a windows user
rm bin
just throw the PC out the window
i did
why all that
sudo rm -rf / --no-preserve-root
Can I use int() on app_commands.Command?
yes just put it inside a try/except and dont return the value
lmao
or just add an __int__ method to that class
im guessing i have to but hoping i dont - if i pass a class instance to another module do i have to pass it back if i make changes to an attribute
like you're importing the object variable from file1 to file2 and making changes to it in file2?
Classes are mutable, so no
i have problem with pil
Bot = running
Ignoring exception in on_member_join
Traceback (most recent call last):
File "/home/runner/swpmdcdc12345/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 53, in on_member_join
draw.text(text, (257, 169, 245), font=font, align="center")
File "/home/runner/swpmdcdc12345/venv/lib/python3.8/site-packages/PIL/ImageDraw.py", line 463, in text
draw_text(ink)
File "/home/runner/swpmdcdc12345/venv/lib/python3.8/site-packages/PIL/ImageDraw.py", line 408, indraw_text
mask, offset = font.getmask2(
File "/home/runner/swpmdcdc12345/venv/lib/python3.8/site-packages/PIL/ImageFont.py", line 669, in getmask2
size, offset = self.font.getsize(
TypeError: expected string
if thats the case, you don't need to
Although that design choice is questionable at best
using the class instance as an argument in a function then changing an attribute's value 
yeah that will work too
okay thanks
Weird, doesn't look like people in dpy server wrote that. They would not have said that if someone asked the question in a help channel
😂 get ?tag lped
cannot import name 'RequestWebhookAdapter' from 'discord'
why am i getting this error in my script
was there a change is discord.py 2.0
Ikr lmao
hey anyone help me pls
you asked a question that's not related to this channel
you sent the error, that's good
but the lines of code you sent are random
that's my bot codes
and add role
ok wait me check again
here
nothing wrong
i want to draw the text welcome in my image
so i use that
anything wrong?
if anyone join my server bot say that in log console
not an expert of this lib
Assuming you're using ImageDraw, take another look at the order of arguments
https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html?highlight=text(#PIL.ImageDraw.ImageDraw.text
as far as I know font is also supposed to be just the filename
is font also a string?
@leaden cosmos
uhh ok i'll read
uhh anything wrong?
i check and nothing bad happened
im using replit to host my discord bot but it keeps saying errors that im not getting when i run my bot script on python
replit sucks
The first argument of text is xy, which should be the coordinates on the image where you want to draw the text. You are missing that
oh right
so what i need to do
provide that xy argument
There's some examples of how to draw text if you need them
https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html?highlight=text(#example-draw-partial-opacity-text
can we still use align?
im using replit to host my discord bot but it keeps saying errors that im not getting when i run my bot script on python
can anyone help
I don't see why not
Which errors are you getting?
Ratelimits, maybe?
limited so we need to wait hours or a day so it'll work again
no bro it says i have errors and wont execute the script but when i launch it on python it works fine
yeah, what errors?
if you're only getting errors on replit, the IP your bot is running on probably got ratelimited or blocked
show image about error
or token wrong too
bot run good but when change token bot = offline
Oh yeah because it’s 2.0
Ah yes, 2.0
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
intents=discord.Intents.all()
what do you mean
use intents=discord.Intents.all() # faster and easier
it was working like 7 days ago fine on replit
In discord.py 2.0 they made it so you have to provide the intents kwarg, like show in the embed above
client = commands.Bot(command_prefix = "prefix", intents=discord.Intents.all())
It probably only works on your computer and not replit because you still have 1.7.3 installed on your computer, and replit installed 2.0
oh thats why my codes had a stroke
add intents=discord.Intents.all() in commands.Bot
shall i just copy and paste that?
of course
Usually you should only enable the intents that you want or need to use
less your script has to process
what if you don't want all intents
Robin flexing reaction perms
😭
fr
i don't care about that
just install what discord py needing to run bot
if you want to use
intents = Intents.default()
intents.members = True
so still nothing wrong just it's longer only
ratio
counter ratio
I can't event thumbs up or thumbs down to either of those messages
ok sure
- -RAM
you'll have to start thinking about that when you have more limitations
just some hours so i don't care a lot
leave that problem
just some hours so i don't need to know a lot
oh hours of learning
you'll get to it 👍
and also if i get it but i still want fast way
if i really need so i'll change
but not at all so still no need
izs there any documentation on bump for disboard
What is draw defined as?
ayo anyway thanks
i fixed and working
👍
izs there any documentation on bump for disboard
what do you mean documentation
like how to do it
like logs?
i want a auto bump command
for my bot
like every 120 mins it bumps the server disboard
hmm bot can't use command
and also bot = bot so can't use bump on disboard
no
i can use /bump
but bot can't use them
wdym
bot can't bump and also no bump command for bots
just user can bump only (real person)
bot = can't
then why can carl bot do it
where
i heard carl bot could do it
prove it
i don't trust you
just give me proof
if you have proof so i lost
if you don't have so i win and also bot can't bump
if you want i know a way
but i don't know how to do it
i only tell you a way and you will need to learn it
wdym by that
i mean i don't know codes
but you need to learn it so you can do it
i only tell you how
ok?
first you need to learn c++
then use discord rich rpc and then make you as a user bot
then c++ will auto send bump when 120 minutes
read
yeah i am not doing that
that's only one way
but then how does disboard bot do it
what
where
yeah, that is against the discord tos 🗿
my friend use that
self botting is against the discord tos
auto 24/24
what is self botting
i told you use c++
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
hello everyone

now stop asking about that now
if you want so go learn c++
we're talking about py
hi
i am trying to make a bot using pyton
if discord ban you so good luck
not so good at it
oh what's wrong?
i can help
making discord bots is quite easy but still not really beginner friendly, so make sure you know some basics of python, OOP is also pretty required, but not for small bots
try remove the pratenthis
Did you save the file?
ye
client = commands.Bot(command_prefix = "prefix", intents=discord.Intents.all())
if man want's a client why refuse them to make it :lmao:
try remove the pratenthis
r u taking part in pyweek?
waht is even pratenthis
()
maybe idk about that
i dont know how to spell
no? what is that? I never took part in any py events?
i never use os before so idk
now we're talking about py so no ask about bumping bot
ok
Will take a look a bit later, why do you want me to participate?
if you want to get ban forever from discord so do it yourself
i was looking to form a team👀
hmmm interesting
team
taking a 13 year-old that only knows how to make bots in the team... interesting
well ofc I know python at all too but not as much as discord.py
u are one of the ppl ik in this server well enough to invite u
what is ppl
discord py same as py but some modules different...
people
it's a lib...
imagine no one care about robot
ayo idk how to call it
just i'm stupid at english
my grandma for last week started really worrying about who I talk to for some reason. Like there are different people and like... you know... safety...
🗿
well anyways I won't tell her about pyweek and you... she won't even understand
@shrewd apex Well, I don't mind at all, but I don't know almost anything about game dev in python 
so do you accept me to be your teammate? 👉 👈 @shrewd apex
yeah of course🫂
🫂
hmm so fun
imagine robot sad
wow that's first time I participate in online event, english online event, in team and in english team
all that for first time
uhh
imagine robot sad more
😭
dude i'm crying not you
why am I not crying???!?!?!
me too !!
you cannot defer my crying
because no one want me and also i did my best in 4 days joined this server
you not sad
i'm sad not you
hmm how about adding picture
picture of what !
@shrewd apex you were typing something I saw
i will add picture of papaya
of me crying
uhh
imagine sad more because the cat want to make me mad
what? I don't want to make you mad.
I'm just very excited
of what happened right now
dragon fruit doesn't taste good 😔
you can see that from my file names:(
dw i made one already
just a tutorial
@shrewd apex do i register on that site and join the team?
class ticket_launcher(discord.ui.View):
def __init__(sellf) ->None:
super().__init__(timeout = None)
@discord.ui.button(label = "Sipariş oluştur", style = discord.ButtonStyle.blurple, custom_id = "ticket_button")
async def ticket(self, interaction: discord.Interaction, button: discord.ui.Button):
ticket = utils.get(interaction.guild.text_channels, name = f"{interaction.user.name}-{interaction.user.discriminator} için bir sipariş")
if ticket is not None: await interaction.response.send_message(f"Zaten bir siparişin var! {ticket.mention}", ephemeral = True)
else:
overwrites = {
interaction.guild.default_role: discord.PermissionOverwrite(view_channel = False),
interaction.user: discord.PermissionOverwrite(view_channel = True, send_messages = True, attach_files = True, embed_links = True),
interaction.guild.me: discord.PermissionOverwrite(view_channel = True, send_messages = True, read_message_history = True)
}
channel = await interaction.guild.create_text_channel(name = f"{interaction.user.name}-{interaction.user.discriminator}nin-siparişi", overwrites = overwrites, reason =
f"{interaction.user} sipariş açtı")
await channel.send(f"{interaction.user.mention} Bir sipariş Oluşturdu!")
await interaction.response.send_message(f"Senin için bir sipariş odası oluşturdum. Gitmek istersen {channel.mention}", ephermal = True)
tree = app_commands.CommandTree(bot)
@tree.command(guild = discord.Object(id=1010669233954365461))
async def ticketing(interaction: discord.Interaction):
embed = discord.Embed(title = "Eğer sipariş vermek istiyorsan Aşağıdaki buton tıkla yakın zamanda yardım edilecektir!", color = discord.Colour.blue())
await interaction.channel.send(embed = embed, view = (ticket_launcher))
this is my code
Traceback (most recent call last):
File "main.py", line 222, in <module>
tree = app_commands.CommandTree(bot)
File "C:\Users\tekno\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\app_commands\tree.py", line 134, in __init__
raise ClientException('This client already has an associated command tree.')
discord.errors.ClientException: This client already has an associated command tree.```
this is my error
how can i fix
sent a request @shrewd apex
That is a papayaya
that is not how getting a tree works
you just do @bot.tree.command() instead of all that
que
oh yeah
yellow dragon fruit is fire
and how can i open the / commands
just type / and it'll bring up a menu
idm papaya it's manageable
what do you mean "open" the / commands in code
i made a / command but dont work without any error
oh you want to sync them
whats problem (disnake)
Missing Permissions
really? no way
i knoow the bot has admin perms so how can there be missing permissions !!
move up the bot role in role hierarchy
trouble maker has come 😳
I dont understand can tell me more info
we also cannot get more info
It’s like if I tried to ban joe
Missing permissions
Joe can ban me no problem
let's just kick lemon
I’m telling
So what i havr to do if i allow this button interaction for everyone?
are you a hecker?😰
imagine allowing everyone to ban joe and kick lemon 💀
you're trying to add role(s) to someone who you cannot add said role(s) to
lemonoid invasion
how do I fix this
@bot.command()
async def test2(ctx, emojis):
message = await ctx.reply("--- - --- - ---")
for emoji in emojis:
await message.add_reaction(emoji)
the emojis
how can i reset cooldown
!d discord.app_commands.Cooldown.reset
reset()```
Reset the cooldown to its initial state.
finally
do you have same question? why is it app_commands.Cooldown?
just why.... commands.Command.cooldown = app_commands.Cooldown
wth
yes it's weird
send the code
class ticket_launcher(discord.ui.View):
def __init__(sellf) ->None:
super().__init__(timeout = None)
@discord.ui.button(label = "Sipariş oluştur", style = discord.ButtonStyle.blurple, custom_id = "ticket_button")
async def ticket(self, interaction: discord.Interaction, button: discord.ui.Button):
ticket = utils.get(interaction.guild.text_channels, name = f"{interaction.user.name}-{interaction.user.discriminator} için bir sipariş")
if ticket is not None: await interaction.response.send_message(f"Zaten bir siparişin var! {ticket.mention}", ephemeral = True)
else:
overwrites = {
interaction.guild.default_role: discord.PermissionOverwrite(view_channel = False),
interaction.user: discord.PermissionOverwrite(view_channel = True, send_messages = True, attach_files = True, embed_links = True),
interaction.guild.me: discord.PermissionOverwrite(view_channel = True, send_messages = True, read_message_history = True)
}
channel = await interaction.guild.create_text_channel(name = f"{interaction.user.name}-{interaction.user.discriminator}nin-siparişi", overwrites = overwrites, reason =
f"{interaction.user} sipariş açtı")
await channel.send(f"{interaction.user.mention} Bir sipariş Oluşturdu!")
await interaction.response.send_message(f"Senin için bir sipariş odası oluşturdum. Gitmek istersen {channel.mention}", ephermal = True)
@bot.tree.command(guild = discord.Object(id=1010669233954365461))
async def ticketing(interaction: discord.Interaction):
embed = discord.Embed(title = "Eğer sipariş vermek istiyorsan Aşağıdaki buton tıkla yakın zamanda yardım edilecektir!", color = discord.Colour.blue())
await interaction.channel.send(embed = embed, view = (ticket_launcher))```
await interaction.response.send_message("Sipariş sistemi çalıştı", ephermal = True)```
spell error on __init__ sellf
still dont work
got my blackjack minigame on my bot down to 117 lines of code including all the image drawing and buttons 
kill 1 in shell iirc
idek how you open it
still dont work
@slate swan where are you
Imma search
yes bring him to me
not okimii lmao
oh :((
...
why unexpected indent ?
sure

help me with this bj
How can i check if 'COMMUNITY' is in before guild features but not in after guild features
where is it saying the unexpected indent is
you can add a check at the start of group command. like this:
@bot.group(name="antinuke", description="A beautiful group.", invoke_without_command=True)
async def antinuke(ctx):
# Checking if subcommand is not None and is not in our subcommands list
if ctx.invoked_subcommand and ctx.invoked_subcommand not in ["whitelist", "blacklist"]:
return
# Send an antinuke embed
await ctx.send("Never gonna give you up")
@antinuke.command()
async def whitelist(ctx, something):
...
@antinuke.command()
async def blacklist(ctx, something):
...```
bruh no need to repeat
^
can i change a subclassed view's interaction check to only server mods if i do this? or do i have to check for it inside button callback?
async def interaction_check(self, interaction):
return interaction.user if "manage_guild" in [key for key, value in (dict(interaction.user.guild_permissions)).items() if value == True]```
check if 'COMMUNITY' in before_guild_features and 'COMMUNITY' not in after_guild_features
ah
oh wait nvm im just stupid
if ctx.invoked_subcommand is None then it's either no subcommand executed or wrong name
but how do you check if a user provided something as a subcommand..
actually I have no idea how to properly do it
I just know that ctx.invoked_subcommand will return None if the subcommand is not given or given wrong
why not?
try it and see?
cannot, it's like 3rd nested interaction
what
because discord.Forbidden
tried that too
and what?
console also shows discord.errors.Forbidden
not handled
show error and code?
sounds weird
well discord.py also raises commands.errors.CommandInvokeError
but you use isinstance(error, commands.CommandInvokeError)
if you make error handler ofc
try:
await bot.get_channel(714960348435709988).send(f"{message.author.mention} en figyelmeztettelek")
await asyncio.sleep(300)
await message.author.remove_roles(message.guild.get_role(1011009261352013845))
except discord.errors.Forbidden:
await bot.get_channel(714960348435709988).send(f"nincs jogom lenemitani teged de csibesz vagy {message.author.mention}")
looks like you should you handle commands.MissingPermissions instead
that's a good idea
or not
looking at the error again nah
the error below is also bullshit
that has a try except too
except discord.Forbidden doesnt work 100%?
btw wth is that error below
intents are now required since discord.py 2.0, info here: https://discordpy.readthedocs.io/en/latest/migrating.html#intents-are-now-required
see !intents to view more info on how to enable them
what is wrong?
and?
.
see link I sent
and !intents in #bot-commands to get more help on how to enable intents
Send ur question
is there a command in terminal i can do to check my discord.py version
pip show <package>
ah ok
why am i getting this error File "c:\Users\user\Desktop\Tools\Luna Tools\DisBot\main.py", line 61, in <module> Luna = discord.Client() TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'
why does literally everybody redefine their bot variable???
get rid of Luna = discord.Client()
lmao aesthetically pleasing
Union[Member, ClientUser]: Similar to Guild.me except it may return the ClientUser in private message contexts.
Pep8 is even more aesthetically pleasing
Could a really tech savvy guy dm me so I can quote a code to you. There’s 2 problems I don’t know how to change (still learning discord bots) 😆
fr
what is an easy way i could get a users cooldown for a certain command when mentioning them? because i have a command involving 2 users and if one of the users is on cooldown i want my bot to send an error msg
You need to have 2FA enabled, as the message says
whatever action is trying to be performed
on servers that require 2FA for moderation actions (deleting a message is that) you must have 2FA enabled for your bots to perform those actions
a
Ask here, much better to get help
Luna = discord.Client(intents=intents)
lmao it wasn’t that
just because discord.py 2.0 doesn’t have all that stuff
the thing i made was with discord 1.7.3
had to downgrade to get it working
im so used to working with pycord and other forks of discord.py at this point....
You're not alone. Most people have, which gave the other forks a standing chance at being competitors now. Before, discord.py basically had a monopoly
i've used discord.py when i was first learning how to program discord bots like 1 year ago, and when discord.py stopped being maintained for like 6 months, i ended up learning pycord
🤔 though I hear pycord isn't all that good
it's fine for me tbh. haven't rlly learned any of the other forks yet
I went through the pychord source and it's... something
^ UX might not differ for many but they’re certainly different
Afaik they gave up on typehinting at all at some point
#bot-commands tp
afaik its not that convenient to get cooldowns for other users due to their implementation, but for prefix/hybrid commands you can use the Command.is_on_cooldown(ctx) with a mocked context to check
if you're wondering what attributes you need to include, see the get_key() method defined in cooldowns.py, near the top of the file
https://github.com/Rapptz/discord.py/blob/master/discord/ext/commands/cooldowns.py
first time?
Oh I remember my first time
Basic question
Could someone refer me to where I could read up on adding tags or whatever the term is to users?
Tags, or values
Like if I wanted to assign a.. 'is_muted' tag to a user so a section of code would only trigger on it
E.g.
If user.get_value 'is_muted'
Do stuff
the bot doesnt want to reload farm 💀
no error in console
on_member_update is most likely what you're looking for
it's an event
How would that help adding a tag?
Quite new to python so you may have to dumb it down
well, what should happen? your bot does respond once by telling you it reloaded...?
@commands.command()
async def reload(self, ctx, arg):
try:
if ctx.author.id == 757508305256972338:
await self.bot.reload_extension(f'commando.{arg}')
await ctx.send(f'**{arg}** is reloaded')
except commands.ExtensionNotLoaded:
await ctx.send(f'**{arg}** is not loaded')
except commands.ExtensionNotFound:
await ctx.send(f'**{arg}** is not found')
it reloads reload but not farm
addo,g a tag.