#discord-bots
1 messages Β· Page 776 of 1
ty
so I have this dice/gamble command, where you guess a number the dice is going to land on and how much u bet it will land on that number.
but it doesnt really work anymore, it worked before tho. The problem is that on line 56, the bot is supposed to send the embed called message but never sends it. I have no idea why and have no errors
here is the code https://paste.pythondiscord.com/wikixosili.py
variable naming smh
if u meant that to me, then no. I didnt name any variable wrong what I can see at least
So in vs code it is telling me that INSERT INTO and Welcome are not defined and statements have to sperated by new lines or semi colons
yes you did namw vars wrong
okimii
and member when it is
what else do you suggest i add to the debug menu
you name an embed a msg yes its an instance but its an embed obj
You named your variables very wrong
what do i need to import?
let me see it again
oh... I did...
@slate swan
Can we see the code?
vs code it is telling me that INSERT INTO and Welcome are not defined and statements have to sperated by new lines or semi colons
one sec
And are you just jumping straight in to sqlite3 without learning at all?
this screenshotter is whack af
its going through discord
bro what
its not recognising discord as a window
Imagine windows
maybe add a settings button which you can edit anything like guild perms and member perms or more
im on linux 
Imagine linux lmao
let me see
i was thinking that but thats not really bot-staff orientated, thats more like bot perms abuse
aiosqlite
good point i maybe check a users account like what date it was created
async def on_guild_join(self, ctx):
Insert INTO Welcome
Values(self.member.guild.id)```
done that
bruh
@slate swan
ah nice
what
yeah i saw it
read the docs
SQLBolt provides a set of interactive lessons and exercises to help you learn SQL
i did staight from it
i ment aiosqlite docs
where the docs all i see is https://pypi.org/project/aiosqlite/
also i installed it but vs code can't find the module do i need to restart it?
you arent doing it right
what do i put in the three dots?
your file path to your db file
maybe in the footers when changes are made show how many changes have been made and make a confirm or cancel changes button
wut
theres a confirm and cancel button, ill think about how to do the show how many changes thing
do i put the file path al the way from the drive letter or the folder it is in?
im taking screenshots of it rn for examples
alright nice
the whole file path
of where the db file is in
just change the \ to / so it doesn't think its built ins
aont?
typo
ok also do i put welcome.json or just welcome for the table
table as text
I'm still working on my wallpaper command
loll
I need to figure out how to create a "paginator" with buttons
lol
What
also when i insert the table do i add the values to the command or how do i add them the docs are the best to read
you dont insert tables?
Do buttons have to have labels?
im not sure if you know sql you should learn it first
Or can I just use the emoji kwarg
you can use the emoji kwarg
added images
nice
But its not related to development with discord.py or any relevant library
the code really isnt in dpy
Therefore, go to #python-discussion
INSERT INTO
where is the query
what are you trying to do with query
Uhm
aiosqlite
π
i think i fucked something
You trying to insert or get data(
maskuh i suggest you actually learn sql
^
and not read through it you actually need to know what each statement does
you still need to know sql triggers and things like that
SELECT statements, INSERT INTO, etc
^
i do though i just don't understand it very well
you know but you dont know what?
lmao
If you don't understand it well then you don't know it
select is for colloms from is from the table
you need 2fa but your trying to do the action without turning it off huh
gl with that lol
yeah cuz its my bot
its for selecting data from a column from a table
Bot's inherit 2FA from the bot owner's account
hi andy
Therefor, if the owner of the bot has 2FA on, the bot will be allowed to do 2FA required actions
Andy!
i have 2fa on
Why does this not exist
and i have specified my owner_id
Why is there no blue button style
no such color
I know but why
@echo wasp read up on sql statements and clauses
Why wouldn't there be a blue color
ahhhhhhh
red, gray, green, blurple
Can I add in my own hex?
no
;-;
afaik no
Then it should allow the bot to do the action, not sure why it isn't though
that would be cool tho
Why is there such a little selection of colors?
discord hasnt added more colors
π
bruh
Do you mean discord.py
cause discord supports basically all the colours except for transparent ones
does discord have end points
really?
Yes
disnake add the endpoints now
For an example, when building an embed you can pass color into your dict (payload)
Then give it an int value, being the colour itself
ik
Eg 0x1031031
ive worked with it
So only having 4 button styles is a disnake limitation?
aka discordheximals
ohh you mean styles
yes
Yeah
I'm not talking about button styles, I'm talking about colours in itself
I have these buttons right here and I don't like how the background doesn't blend in
which i assumed discord doesnt have endpoints for such colors
Yea, no you don't have any custom coloured buttons
You can only use the 6 button styles
yeah lol
nice what was it?
Disnake only has 4 styles? ποΈποΈ
i think so yes
if im not missing other colors
i was using a .txt to store the version which is a bit weird when using pypi packages
They aren't supporting 2 of the styles available then
so ive reverted back to manually entering the version into 2 different files
yeah it should be in setup file
What are the available styles?
yeah but i also need version in files in the disnake-deubg
Oh, disnake supports those. I was talking about colors
they have them all
Oh
@final iron what are you talking about a buttons colors right
yeah iirc only 4 options
You can also just person the version inside of your namespace pacakge
rin/__init__.py line 1
__version__ = "0.1.1-alpha"```
What is the max file upload size for bots?
you released rin alpha right?
they have nitro lol
i think theres up to 100mb im not sure how much nitro offers
Yea, second release onto pypi
yo Andy u gotta notify me when your wrapper can be used
I think its 8
if I get off my ass I'll get it done in like a week or two
nice what have you implemented
π , I'm very very lazy though
they are treated the same way users are, can exceed in boosted servers
default is 8
Oh wait pog
no bot accs have nitro perms
nice look at me lol
but do they have nitro upload limits?
not sure on that
@pliant gulch you arent gonna make a run method?
just raw asyncio.run
I am aware that this year discord.py will be losing support, does this mean it's going to be rug pulled entirely? or will it still work just not receive anymore updates.
its not being maintained so no updates
so just use a fork
hmmmmmm, I might force start as it looks and feels better in my opinion! But if people want a run method I will give it to them
yes pls and btw whats a heart beat ive heard it before but im not quite sure what it means
When you connect to the gateway you need to send heartbeats, this tells the gateway to keep you connected and that you aren't to be considered "dead"
If you don't send a heartbeat within a certain timeframe you will be disconnected
ah ic so it wont disconnect for inactivity
Yep
If somebody uses a command are they the only ones who can use the buttons or will I have to add a check for that?
You have to add a check
can i not set a usage attibute for slash commands?
you can use interaction_check
!d disnake.ui.View.interaction_check
await interaction_check(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.
This is useful to override if, for example, you want to ensure that the interaction author is a given user.
The default implementation of this returns `True`.
Note
If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.View.on_error "disnake.ui.View.on_error") is called.
^
ive got 15 of those in disnake-debug lol
just check the inter author with the ctx author which can be passed withing the view subclass
i should just subclass a view with it
Guess I'll write a run method right now, got nothing else 2 do might as well make my daily commit
relatable π
thx
commit to what?
How would I implement this?
youβre thanking andy for committing to his own repo?
yeah
i honestly cba to type it out on mobile so ill just link to my code
π€
i gaved him a suggestion so if he accepted that benefits me
exactly 
@manic wing https://github.com/an-dyy/Rin
My room is actually freezing
disnake-debug/debug.py line 29
async def interaction_check(self, interaction: MessageInteraction) -> bool:```
@manic wing
what?
ok wait go to jarvide server
okimii cant relate
I still don't get it
So I just add it and it will work?
yes
youre overwriting the default interaction_check method
Oh
everytime a button/item is clicked it calls interaction_check
async def interaction_check():
if interaction.author.id == ctx.author.id:
return True
return False
by returning bool it determines whether or not it responds
just pass the ctx author to the class
self, interaction and self.ctx
ποΈ ποΈ
The thing is, ctx isn't defined
pass it
how do i do that
to the class
Oh
view=ViewSubclass(ctx.author)
and just make a param for an author and typehint it to a member
lol
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="β
Support Server",url="e")
button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="π Website",url="e")
view.add_item(button)
view.add_item(button2)
await ctx.send(embed=embed, view=view)
why does this work as a normal command but not as slash command?
it says application did noy respond when i make it as slash command
ok
interaction: disnake.MessageInteraction
isnt it weird how people type hint interactions and not context
Wait, you can create buttons like that?
you add the items lol
I type hint everything
its better to just subclass it for better handling
i di coreectly tho
same
yo why does this edit the embed every time and not add a field to it? like when they react it doesn't add the new message to the prexisting embed just makes a new one without it ```py
if str(payload.emoji) == "π©οΈ":
selectedSlot.append("Power of Thor")
for x in selectedSlot:
if x in slotDict[18]["Slot"]:
xe = slotDict[18]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "π«":
selectedSlot.append("Wanted dead or alive")
for x in selectedSlot:
if x in slotDict[19]["Slot"]:
xe = slotDict[19]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "π₯":
selectedSlot.append("Wild West Gold")
for x in selectedSlot:
if x in slotDict[20]["Slot"]:
xe = slotDict[20]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "β":
selectedSlot.append("Super X")
for x in selectedSlot:
if x in slotDict[21]["Slot"]:
xe = slotDict[21]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "π":
selectedSlot.append("Spartan King")
for x in selectedSlot:
if x in slotDict[22]["Slot"]:
xe = slotDict[22]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "πΈ":
selectedSlot.append("Fire Hopper")
for x in selectedSlot:
if x in slotDict[23]["Slot"]:
xe = slotDict[23]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)```
damn
class MyButton(disnake.ui.View):
def __init__(self):
super().__init__()
button = disnake.ui.Button(label='Click Me', style=disnake.ButtonStyle.url, url='https://discord.com')
self.add_item(button)
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(inter: AppCmdInter):
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = MyButton()
await inter.send(embed=embed, view=button)
i also teried this but it doesnt work
Whats the point of type hinting something to typing.Any
more typehinted examples in disnake Β―_(γ)_/Β―
what exactly didn't work
fax
well when i do the slash command it also just says application did not respond
i don't get it
u name your class button and pass the view
why subclass view and adding a button just add the component?
How would I use get_context in a dropdown callback?
Would I just pass bot in to my __init__ method?
how to fix it
pass ctx into init so that you can do ctx.bot
I have a problem, no error, nothing happens
@client.command()
async def kick(ctx, member: discord.Member, *, reason=None):
await member.kick(reason=reason)
await ctx.send(f'User {member} has kicked.')```
!d disnake.ext.commands.Context.bot
The bot that contains the command being executed.
Alright
you can do ctx.bot but not bot.ctx, so you pass ctx to get both
you can also do self.ctx = ctx to make the interaction_check
ty for giving vague error where you await multiple things
Imma just post it on stack overflow
did you save and reload your bot
do you have a whack error handler
Yea
I use replit
are you sure
Yea a few times
Imma even try again
But I'm sure I did brb
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="β
Support Server",url="e")
button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="π Website",url="e")
view.add_item(button)
view.add_item(button2)
await ctx.send(embed=embed, view=view)
why does this work as a normal command but not as slash command?
it says application did noy respond when i make it as slash command
use the bot on ur pc befoe replit
Yea but I use replit bc of database
And I have a few other commands with the same exact error
Yup
I've been using replit for a few years now and never had any problems except now
ho wto fix this```py
@client.slash_command(description="Shows Bot Info.")
async def BotInfo(ctx):
view = disnake.ui.View()
embed=disnake.Embed(color=0x8400a8, title="PexiBot Invite Link!", description="Join Our Support server and report bugs!")
button = disnake.ui.Button(style=disnake.ButtonStyle.url,label="β
Support Server",url="e")
button2 = disnake.ui.Button(style=disnake.ButtonStyle.url,label="π Website",url="e")
view.add_item(button)
view.add_item(button2)
await ctx.send(embed=embed, view=view)
why does this work as a normal command but not as slash command?
it says application did noy respond when i make it as slash command
do you happen to have made an on_message event recently?
try other commands; do they work?
dude noone is helping you because a) we cant be fucked b) you dont listen when we say shit c) your naming conventions are fucked, along with the entire code d) you dont know enough basic python to subclass view like a normal person so we dont help you
ok sorry
stop spamming the same error in chat, weve seen it, weve just exhausted our patience
yo why does this edit the embed every time and not add a field to it? like when they react it doesn't add the new message to the prexisting embed just makes a new one without it ```py
if str(payload.emoji) == "π©οΈ":
selectedSlot.append("Power of Thor")
for x in selectedSlot:
if x in slotDict[18]["Slot"]:
xe = slotDict[18]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "π«":
selectedSlot.append("Wanted dead or alive")
for x in selectedSlot:
if x in slotDict[19]["Slot"]:
xe = slotDict[19]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "π₯":
selectedSlot.append("Wild West Gold")
for x in selectedSlot:
if x in slotDict[20]["Slot"]:
xe = slotDict[20]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "β":
selectedSlot.append("Super X")
for x in selectedSlot:
if x in slotDict[21]["Slot"]:
xe = slotDict[21]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "π":
selectedSlot.append("Spartan King")
for x in selectedSlot:
if x in slotDict[22]["Slot"]:
xe = slotDict[22]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == "πΈ":
selectedSlot.append("Fire Hopper")
for x in selectedSlot:
if x in slotDict[23]["Slot"]:
xe = slotDict[23]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)```
perhaps you channel.purge'd it?
It should
add a thing to the embed then
wait I can just edit the embed
good idea
na I want it to
and I can't edit a field that doesn't exist
I need to add the field and it just doesn't
Am i right in thinking that this will check if the role id of the after role is in my list of level_rewards but will only start checking from the third item in the list? ```py
level_reward_role = discord.utils.get(after.guild.roles, id = [id for id in self.bot.config.level_rewards[2:]])
haven't you asked this like 2 days ago?
reletable
yo why does this edit the embed every time and not add a field to it? like when they react it doesn't add the new message to the prexisting embed just makes a new one without it
if str(payload.emoji) == ":cloud_lightning:":
selectedSlot.append("Power of Thor")
for x in selectedSlot:
if x in slotDict[18]["Slot"]:
xe = slotDict[18]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == ":gun:":
selectedSlot.append("Wanted dead or alive")
for x in selectedSlot:
if x in slotDict[19]["Slot"]:
xe = slotDict[19]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == ":first_place:":
selectedSlot.append("Wild West Gold")
for x in selectedSlot:
if x in slotDict[20]["Slot"]:
xe = slotDict[20]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == ":x:":
selectedSlot.append("Super X")
for x in selectedSlot:
if x in slotDict[21]["Slot"]:
xe = slotDict[21]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == ":crown:":
selectedSlot.append("Spartan King")
for x in selectedSlot:
if x in slotDict[22]["Slot"]:
xe = slotDict[22]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)
if str(payload.emoji) == ":frog:":
selectedSlot.append("Fire Hopper")
for x in selectedSlot:
if x in slotDict[23]["Slot"]:
xe = slotDict[23]["Symbol"]
casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
await channel.purge(limit=1)
msg = await channel.send(embed=casinoMessageReaction)``` Anyone got a solution? it doesn't add the updates to the main message
it's because you channel.send, not message.edit
So I currently have this code, https://paste.pythondiscord.com/upaqatonex.rb. In my WallpaperDropdown class I have a variable called wallpaper_image. How could I access this in my Confirm class?
I add the field here? casinoMessageReaction.add_field(name = str(x), value = str(xe), inline=True)
it should stay no?
you want to access a class method from another class without having to create an object of it?
I'm fine with creating another object if I can get all the code working
can you first of all use elif pls
havent tried await WallpaperDropdown(view,ctx).return_image_link(your_atrributes) before?
shouldn't matter
I thought it would throw an error but I guess I can try
true, but the code is very hard to debug since I have no idea what your emoji is etc, you just showed some code and I have to guess which if statement is true, what casinoMessageReaction is, ...
huh? why would this matter
Ill send a gif
for repro purposes
yeah lol, i don't remember seeing a response tho, i probs just missed it
I'd say, you can always ctrl+f to your previous messages and look for a possible response first
yeah just done that, got no response other than someone saying it is a self bot -.-;
I hope this answers your question
>>> a = [1,2,3,4]
>>> a[2:]
[3, 4]```
it does, thank you very much. I just wanted a sanity check bc I don't often work with lists in this way
you guys see any errors
homebaseHeaders = {"Authorization": f"bearer {b[1]}", "Content-Type": "application/json"}
reqGetHomebaseName = requestText(session.post(links.profileRequest.format(account_id, "QueryProfile"), headers=homebaseHeaders, data="{}"))
reqSetHomebaseName = requestText(session.post(links.profileRequest.format(account_id, "SetHomebaseName"), headers=homebaseHeaders, json={"homebaseName": b[2]}))
oldHomebaseName, newHomebaseName = [reqGetHomebaseName['profileChanges'][0]['profile']['stats']['attributes']['homebase_name'], reqSetHomebaseName['profileChanges'][0]['profile']['stats']['attributes']['homebase_name']]
im getting error discord.ext.commands.errors.CommandInvokeError
good example but the terminal should look like
001 | a = [1, 2, 3, 4]
002 | print(a[2:])
>>> [3, 4]
I'm using a python shell
π
noticed that the Python discord icon is animated?
yeah the icon is usually animated
it's very subtle this time
yeah its old lol
always is
How can I make my bot send βPushin π ΏοΈβ every time someone says ?
use the on_message event for this
first thing you check in that event:
if the author isn't a bot
second thing
if the message content is equal to ?
lastly
send in message channel pushing π
ΏοΈ
How do i get the bot to send a message on the ctx.author can see
that's called an ephemeral message
^
Thank you
depending on what library you have, this is supported
most libs have it as a kwarg in the send method
thx
I thought that was only available for interactions
can't say, I don't use them
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://docs.disnake.dev/en/latest/api.html#disnake.File "disnake.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://docs.disnake.dev/en/latest/api.html#disnake.File "disnake.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed "disnake.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed "disnake.Embed") objects. **Specifying both parameters will lead to an exception**.
await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=False, delete_after=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
If the interaction hasnβt been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
Note
This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.MessageInteraction.original_message "disnake.MessageInteraction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if youβre sending a followup message.
ephemeral kwarg
I said the send method, didn't mention from which class π
lmaooo
but yeah, the interaction seems like the most logic class
My brain actually fucking hurts right now
oof
oop
how does save() work
!d disnake.MessageInteraction.send
await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=False, delete_after=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message using either [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message") or [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
If the interaction hasnβt been responded to yet, this method will call [`response.send_message`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionResponse.send_message "disnake.InteractionResponse.send_message"). Otherwise, it will call [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send").
Note
This method does not return a [`Message`](https://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") object. If you need a message object, use [`original_message()`](https://docs.disnake.dev/en/latest/api.html#disnake.MessageInteraction.original_message "disnake.MessageInteraction.original_message") to fetch it, or use [`followup.send`](https://docs.disnake.dev/en/latest/api.html#disnake.Webhook.send "disnake.Webhook.send") directly instead of this method if youβre sending a followup message.
for what class?
Ah thats why I was getting a NoneType error
the heck is save
.
from where is that
docs
the discordpy docs
attachment
idk lmao

!d discord.Attachment.save
await save(fp, *, seek_begin=True, use_cached=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Saves this attachment into a file-like object.
This seems to be with an interaction π Is there a way for it to send it after i use like a clear command and it sends it say "cleared Messages"
No
damn
Thats why I sent the docs
you cant send a ephemeral msg if its not on an interaction
To show its only available for interactions
Ahh ok
So disnake.MessageInteraction.channel.send doesn't return anything
the return type tells you
How would the message object?
there isn't one => None
?
saddening but thank you
it shows in docs
I don't understand it
just look down and it will say Return Type
thats what the coro returns
It doesn't return anything
This method does not return a Message object. If you need a message object, use original_message() to fetch it, or use followup.send directly instead of this method if youβre sending a followup message.
Which is the issue. How would I get the message object of the message I sent because I need to edit it later
what are you trying to do?
Trying to edit a message (triggered by button click) which the bot sent when a user picked an option from a menu
How to bot remove reaction in discord.py?
So to edit the message I would need a message object
Which is very convenient because disnake.MessageInteraction.channel.send doesn't return anything
he probably wants to do this
message = await channel.send("shit")
await message.edit("fart")```
but for an interaction
Basically yes
msg = await interaction.channel.send(embed=embed, view=Confirm(self.ctx))
await msg.edit(content="sus")
^ This is what im trying to do in a nutshell
ngl I'm kinda scared for anyone to see the code because its actual hell
poop
view = MyView()
view.message = await channel.send('...', view=view)```
Okay, I think I need to rework all my code
no need
ctrl + a del
handles that for you
This is currently what I have
Very, very bad
Since my brain is being fried, how would I "fix" this
I need to rework all of it
.
Because the way its structured makes everything complicated
I need to rework it, not delete all of it
I just have no idea how I would do that
me neither, I'm excited for you
by using examples in the docs
dpy has great examples on the gh
that way, you know for sure you're not implementing a shit method
My idea is I have a drop down menu filled with image sizes. When a user picks an image size it sends an embed with the image of the correct size and deletes the message with the image. Then user can then use the buttons to go back and forth to generate new images and go back to their old ones
@final iron
after you edit a msg aka respond to the interaction you cannot edit it again as a response and you must use edit_original_message to edit the msg
Any idea how I could achieve this?
So basically I fuck myself over by deleting the original message?
Can we see the code?
go to sleep
It happens when the discord bot starts
thats what you should do
Its only 8pm
cant even understand my msgπ
idc go to sleep
I'm completely new to buttons
And views
And selects
Basically everything to do with ui
read the msg i wont explain it again lol
happens when the api cant connect with the client
Thats not my problem. My problem is the way my code is structured
Okk either it's token issue or connection issue ?
Or when it's wrong token it says wrong token in error
how is it
connection
if the token is wrong it will give you a nonetype error
and as you can see you got the 503 http status code
Because interaction is not defined
boi wut
what params does it take?
self
just self?
I sent my code here if you want to look at it
Yes
lol
I have no clue how. Can I get some help with that?
This is what I'm trying to do
So its basically like a paginator
Except having a menu in there makes this so much harder
im not sure im not really familiar with paginators i suggest you check out disnakes git that might help
I'm looking here
And theres no pagination
Actually nvm
Welp, time to scrap 3+ hours of work
https://github.com/an-dyy/0x42/blob/master/src/utils/hyperview.py Heres an example of pagination
A discord bot focused on clean code and utility. Using the discord.py library - 0x42/hyperview.py at master Β· an-dyy/0x42
Quite old though so there is probably an issue somewhere
https://github.com/an-dyy/0x42/blob/a69d77e3acb901e317f1ec4f476c7992be7e0347/src/utils/hyperview.py#L30-L32 One here off the bat, I never returned False for some reason after sending the message
src/utils/hyperview.py lines 30 to 32
await interaction.response.send_message(
"You cannot interact with other peoples menu", ephemeral=True
)```
How to store a comment in a variable
like this?
x = # comment
yoou would still have to have a value for the variable
since comments do not count as code
they can count as string
is it discord.py ?
Is what discord.py?
idk if you quite understand
lmao
https://gist.github.com/an-dyy/d79d80b7debac17f3bae035fb8bccb4a Some cool stuff
nice
How would I make a enable/disable command for my discord bot welcome message
!d discord.Guild
class discord.Guild```
Represents a Discord guild.
This is referred to as a βserverβ in the official Discord UI.
x == y Checks if two guilds are equal.
x != y Checks if two guilds are not equal.
hash(x) Returns the guildβs hash.
str(x) Returns the guildβs name.
I bet I will need a database
YT

A database connection which saves which guild has them enabled and id of the channel to send welcome message in
Yes
That's the last place I'll go to
is it true that discord.py is being discontinued
its been discontinued
you can still use it, but it's no longer maintained so it wont get new features
i would use disnake, or nextcord
!pypi nextcord\
A Python wrapper for the Discord API forked from discord.py
!pypi disnake
ok
!d zip
zip(*iterables, strict=False)```
Iterate over several iterables in parallel, producing tuples with an item from each one.
Example:
```py
>>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):
... print(item)
...
(1, 'sugar')
(2, 'spice')
(3, 'everything nice')
```...
How do we make a bots' reply have emojis in them, in the embed
use the escaped name of the emoji ( if custom )
else you just use normal name like :star:
but if its a custom emoji you'll be using \emoji and getting the escaped name
It's custom
Kk thanks
Okay so I got the buttons working
I can now cycle back and forth through the images
I just need to add a menu
Which is going to be a pain in the ass
!pip pyaudio
hi anyone building a discord bot lemme know i wanna work with you
Knew it lol
A lot of things in discord bots require databases
is there anything wrong with this script? im trying to make my bot upload an edited picture that edited using PIL/Pillow
if msg.startswith("!stage"):
img = Image.open('panggung.jpg')
draw = ImageDraw.Draw(img)
font = ImageFont.truetype('impact.ttf', 20)
text = username
draw.text((420, 272), text, font = font, align ="middle")
img.save('meme.png')
await channel.send(file=discord.File("meme.png"))
if i input "!stage" in a chat channel there will be no output
and the Log will show me this
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 110, in on_message
await channel.send(file=discord.File("meme.png"))
AttributeError: 'str' object has no attribute 'send'
dont use on_message to make commands.
use the command framework already , or you'll keep facing such issues
Do u even sleep @slate swan
i do , 4 hrs daily 
hmmm ok then thx for the idea , ill try using commands
@slate swan
yes?
Lmao
@slate swan do bot these days use slash commands instead of prefix?
How do I make a slash command
um its like , message commands wont work without message intents , so for them slash commands is a must
library?
ooh okok, thx againπ
You can't
Use a library with slash command support like disnake
!pypi disnake
discord.py does not have slash command
you may use a fork like disnake , nextcord etc
You don't need the intent for message commands...
π i mean ,once they get verified and dont have the message intents..
Still no
That would force message commands to be prefixed by the bot's mention
yea
Ok
Wait you mean prefix commands?
using disnake
yep
do people use this handler discord-py-slash-command
ive not seen any "good" project using it
use some fork instead of a 3rd party library
So you mean my bot ain't good π₯Ί
π hunAI uses it?
Idk
Facts
Indexing
!index
!e print([1,2,3][0]) # list indexing

@slate swan :white_check_mark: Your eval job has completed with return code 0.
1
Learn Python 
Nvmd j understnad
great
But ppl use variable smh
Don't blame me I haven't opened the bot source since months days
!e ```py
var = [1,3,4]
print(var[1])
Ok
its same , i use one liners wherever possible
aw come here, hug hug
I know this but in some code i didnt understand
I got a point on this line for you but nvm
I'mma pass
Ik 80%
If you don't know indexing I doubt that
Do u know about classes?
So I keep hearing about how discord.py is about to be unsupported or something to that context. Can someone elaborate on this?
Its an extremely beginner topic
i mean , idm if you point something out
Am I so ugly
welp okay fine, you continue copying
No...
Not that point
Never said you are ugly
Nobody is working on it now so new features won't be supported
U got me....
Yes it is
80% doesnt even include indexing for you, whats the 80%?
ow ok , uwu
Stop noooo
Im sorry i mean 10%
Hunter uwu
I only know print
So eventually the module will not work at all because of the current api? Is that correct?
-_-
print() isn't even 1%
Cool
danny just stopped working on it , its not related to the "current" API
you can still use maintained forks
Stop!!!!
Well yeah, discord will bring changes and nobody would implement them in dpy so it will stop working eventually
I know everything in python im INSANE!!!
Ping the entire moderation team if you actually believe you are being bullied
I will get muted
Lol
They literally say to ping the entire team instead of 1 person
now you did a ghost ping , they have message logs though π
Ok bye π
Imagine if people wouldnt argue for no reason 
Iβm trying to determine if I should finish building a bot with the discord.py module or to create my own websocket.
@slate swan i have created a dc bot ..
I'll never understand people like you
I started it 3 days ago
Building your own lib will be pain in the ass if you are just trying to write a bot
Use some other bot lib
..
ill just suggest to use some of fork or any other library ( like hikari )
but yea if you are really interested and capable of bulding your own wrapper , best of luck with it ! 
Learn python and save yourself further humiliation
Thats my advice
Its completely upto you
Already learned
never ignore advices from ashley
Lol that emoji
uw~
Ask some questions
Is that hun-
yes
1+1=
Understood, thanks you guys
Error
whats 0.2+0.7
Cutie
+1
0.9
!e print(0.2+0.7)
Thats dumb, but oki, i'll let you pass
@slate swan :white_check_mark: Your eval job has completed with return code 0.
0.8999999999999999

I mean python questions***
!ot
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
;-;
1+1 in python is 11 if string data types are added
;-; you clearly dont know python, you can stop arguing
Im being rate limited
do u tell its a python questions , did u tell that the int is str...
Anyways, I'm out, dont eat my brain
Demotivated
idk if its a good way of doing stuff but py welcome_message = (message .replace('$usermention' , str(event.member.mention)) .replace('$userid' , str(event.member.id)) .replace('$username' , str(event.member.username)) .replace('$userdiscriminator' , str(event.member.discriminator)) .replace('$userdiscrim' , str(event.member.discriminator)) .replace('$user' , str(event.member) )
i use this to replace welcome variables in welcome messages
any better method than using .replace ?
nvm too long
Hot
Satisfaction. Amen
rule_7..
^
no
rule_7 = "Nevermind"
no other choices that using replace ?
You could just format
@slate swan where can I get
;-; nvm why do people expect help if they behave like this
I hope someone helps you, thanku for the rule warning
ApplicationCommandInteraction in disnake
Look at their github repo
!e ```py
a = "so like this ? {name}".format(name="andy")
print(a)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
so like this ? andy
alright makes sense
Sure, you can also use f-strings too
f string
Im sorry if i didnt behave good next time ill be better.
format is shit
can you send the link
OG Β―\_(γ)_/Β―

actually , the $variable etc inputs is saved in a database which i get for users
like someone uses !welcome message $user welcome to $server so i dont think i'd be able to use f strings there
I'm on phone, cant
Lol
Ok
!d disnake.ApplicationCommandInteraction
class disnake.ApplicationCommandInteraction```
Represents an interaction with an application command.
Current examples are slash commands, user commands and message commands.
New in version 2.1.
What!???????
Ok thanks
um , its for a welcome command.
Ok..
Good luck, kakashi 
"Pain"
You have some nerve to write code the 4th time smhh
Use a function broo.
Woah, god-like
..
!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.
Trolling is against the server rules
I just want you to keep that in mind
Ok lemee see
Smexy
He just doesnt know python, what can we do ;-;
Imagine telling the God to use function
its kindof outdated since i made it in hikari when discord.py was not even discontinued
I mean, when someone is having an issue that I can't solve I don't try to give help and end up giving bad advice
imagine not being a hunter worshipper
I just don't say anything or say that I don't know
Totally me
Hmm, you could also make it an anonymous function
ofcourse
Yeah
!e ```py
welcome_message = lambda: f"Welcome to the guild {user}!"
user = "Andy"
print(welcome_message())
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
Welcome to the guild Andy!
Same ngl
What even is an anonymous function
Those people dont have the right to life Β―\_(γ)_/Β―
Exactly what the name suggests, it's an anonymous function
that surely works , but fails with the intents of custom welcome messages
That's why I don't have a life
i sec brb
How can a function be anonymous if its in the code?
U don't understand the meaning of an anonymous function
Ok seen
pat pat
Not talking about the dictionary meaning
If my username wasn't "andy" would you know what my name was?
Lmao
Levi's brother
Just saw yea
Who's Levi now
Really cool so far, look at this cool low-level stuff https://gist.github.com/an-dyy/d79d80b7debac17f3bae035fb8bccb4a
so like , i have this command which allows user to configure there welcome messages , like $user replacing the user tag when the welcome message is sent
that was the point of using replace there
Ackerman? Nvm, there are too many to get a good name
What's a custom message?
What's Ackerman?
A custom Message object
Just a proof-of-concept for custom classes when dispatching

In my example (the gist), I hook onto the MESSAGE_CREATE event basically
My My, stop lol
when its a hackerman , but its hunter
Not kidding, I seriously don't know any of them
Anyone here know how I can add the discord bot to github and host it using heroku?
Idk
Thats so uwu
yes
Yeah
I just wanna be able to run the bot while being able to use the github features
||anything related to hunter is uwu||
My depression too
||and hunter himself||
I got a feeling Novia is gonna run the ot command soon
The issue is?
PoV: He doesn't know where to start
How do I connect my github rep of my bot to my heroku to deploy it
thats why you should sleep at nights instead of studying economics
Yea
Heroku provides git command for its shell so idk try using git pull
true true
there are several ways Β―\_(γ)_/Β―
If I don't study, I'll fail, and I ain't kidding
which is the easiest one
I only do that when I get annoyed by ot talk here
please get annoyed by them uwuing me
While creating the bot app? Thats the one I use, create an app and scroll down, connect to github
also I guess
This is not the right channel to ask about heroku hosting
I already am 
Yay
Okeh
Welp
?
Thats too deep to understand, can we get a simpler explanation of your symbol, Lord
Ok I'm out
uw-
anyways , back to work
gib command ideas
Hmm, make a grammar check command
id correct mine if i knew how to make one
@slate swan I seriously got the best command idea ever
preach
A command to give more command ideas π₯Ί
Stop making fun of yourself
And those uwu eyes-
that's actually just a public !suggest command
see how the suggestions get flooded
hunter add a suggest feature in hunai , and we'll uwu you
Facts
π
Isn't this the reason I ain't adding one? Lol
Lol
lets see what hunAI responds with on Uwus
Sure
@maiden fable Do you understand their language lol

No
until hunter did something like ```py
@HunAI.event
async def on_message(message):
if 'uwu' in message.content.lower(): return
await HunAI.process_commands(message)
yea but cogs wont override the bot's prefix commands like an event does
I would delete the msg 
this will make any content with uwu un processable
i'd add an admin role named "Hunter worshipper" instead
I would just ban the person if my bot have the perms
~~ π no thats illegal , we cannot let that happen to a god~~
I dont want to be the bad "guy" here but.....
Bruh, I'm out
!ot
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
ashley being hunter
drops another codeblock , so noone actually moves to the ot channel
cof cof
π someone was just accused for being my alt in #ot2-never-nesterβs-nightmare lol
Β―_(γ)_/Β―
.topic
Suggest more topics here!
a suggest feature
you are a bot developer too
i already have that in bot's trash.py
oh btw ,
lol
lmaoooooooooooooooooooo
h
currently the thing i need most is a better on_guild_add event
π i dont want my bot to exist in servers with like 90% bots
does anyone know how you could see a message's amount of reactions (like what emoji and how much people reacted with that emoji)
!d discord.Message.reactions
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
oh so for example
this = await ctx.send("hello world")
print(this.reactions)
right?
Verifying bots is too overrated
Sure
oh yeha and how do you edit an embed
!d discord.Message.embeds
A list of embeds the message has.
uh
You won't get the reactions that fast ig maybe try to sleep π΄
Inb4 it's targeted and causes your bot to get flagged for in-organic growth, thus making you unable to verify
embed = message.embeds[0]
embed.title = "Why not change the title"
yeah i will do that lol
oh lol
My bot was mostly in servers with more bots and less people lmao
@maiden fable Your status made me sad π’π
Idk how discord verified it lmao
if a bot's guilds have too many common owners or mostly bot accounts in the .users , it may get blacklisted from verification with a reason : "inorganic growth"
Made*
See the point π , I really am
#697236247739105340 message for someone who is in the discord developers server
Hmm I still haven't watched NWH
π¬ π¬
ikr , everyone wants that
sadly we dont get the badge anymore
tell them, thats how we grew up
Ikrrr
π , look at the little guys falling victim to discord! Giving personal identification away to verify a bot
how would you get how much people reacted on a specific emoji btw
Ikr ;-;
once the bot is blacklisted , there's nothing you can do
π
In case someone's not in there
!d discord.Reaction
class discord.Reaction```
Represents a reaction to a message.
Depending on the way this object was created, some of the attributes can have a value of `None`.
x == y Checks if two reactions are equal. This works by checking if the emoji is the same. So two messages with the same reaction will be considered βequalβ.
x != y Checks if two reactions are not equal.
hash(x) Returns the reactionβs hash.
str(x) Returns the string form of the reactionβs emoji.
pogg
Read the docs 
???
Your data is probably in some data brokers hand now lol
Ik, but can't really help it. They deleted the ID Proof after an year after u delete your verified bots
What are your profit margins like with hosting the bot and gaining from it
Or are you losing money
Anyways, it was my old ID Proof with the old pic, address and stuff, so I don't care that much
You don't have to answer it
I am neither gaining, nor losing money. It is more of a hobby project, hosted on a friend's VPS
Haha yups
not everyone is a god like hunter
friends affected by uwuness too
is it?
Suggest more topics here!
YES
Β―_(γ)_/Β―
π let me not say that
ok so how do i write a privacy policy and tos now
privacy policy is a privacy policy

