#discord-bots
1 messages · Page 959 of 1
What didn't work
Bro change to ctx.interaction.original_message 🤦♂️
this is what they said
Sorry, I did not see interaction.
My bad
Why does this happen when it doesn't give any error?
your app didn't have a callback probably
for that command
Uh not sure, how do I do that?
Perhaps defer the command.
I heard that word so much I still don't get what it means.
await ctx.defer()
Where should that be?
Top of the command
And I randomly got this
by default, if an app doesn't respond within three seconds, discord says the app didn't respond. Deferring means that it tells discord this operation will take longer, and I AM RESPONDING, just a little while later.
Like that?
Ah okay
so yeah it's good to defer
ctx is an interaction or contextual....
huh, back to the docs
ctx is just the name of a variabel 
!d disnake.InteractionResponse.defer
await defer(*, ephemeral=False, with_message=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction response.
This is typically used when the interaction is acknowledged and a secondary action will be done later.
yeah, here ya go
I don't use disnake
!d disnake.Interaction.response
Returns an object responsible for handling responding to the interaction.
A response can only be done once. If secondary messages need to be sent, consider using followup instead.
doesn't matter, if it's not pycord you're good
you defer the response not interaction
It's pycord.
It seemed pretty easy for slash commands

pycord is the last thing i would try
disnake also works, smh
why not, its open for everybody
It just seemed easy, thought it was worth a try
I didn't know Blvck has a fiverr
well, I will ask that question now too
just that, pycord is the odd one out, some names in the documentation are different from disnake. so theoretically, if you were switching from dpy to disnake, you just change an import and you are good. But if you change to pycord, you need to changes references in the code as well. Much more annoying tbh
discord.commands 🏃♂️
Wait, people import stuff from other libs to use in a different lib? like py from disnake.ext import commands import discord?
i am the developer manager of an Italian server which sells services 
what's the point of doing that xd
some things may work, like enums
Oh nice. Is that your main job?
idk, im asking you since you did do that
where did I?

pycord uses the discord namespace
and also it's discord.ext.commands
another thing to hate about pycord
idk im just overall biased towards disnake as a better wrapper
reminds me of discord.Bot
Pycord is really criticized alot
Is Blvck italian?

With deferring it works, just getting this now
nope, i'm a junior dev and it is my first job, my contract expires in May but they already said that my contract is renewed ^_^
read the error
I did
you got an attribute that doesn't exist
an object was type NoneType and you tried to get an attribute from this
Doesn't timestamp=ctx.message.created_at work?
nope, remember it is an *interaction
there will be no message
with reasons.
Command interactions are not messages 
Ik
very well, the happiness when it is renewed is so overwhelming xD
🏃♂️ im not a fork fan so i dont really like any of them tbh
lets fucking go, my teacher just announced 3 days a row of no french period
choose one
Like that: ctx.interaction.created_at
So what about the discord.py then
So message is replaced with interaction
It's even worse
!d disnake.Interaction.created_at
property created_at```
Returns the interaction’s creation time in UTC.
yup
slashes are ew
😬
nice
agreed
Congrats, i always wanted to get paid for something i can do or make.
this is what im talking about
Couldn't get on fiverr though.
Upwork is kinda good but the fees are high
@unkempt canyon has only disnake and nextcord docs atm ( as discord.py forks)
lol tbh i achieved so much in those two years, from when i've started my last year at school until now, that i'm not surprised anymore 😆
Still getting this error.
huh
Welp
🗿 can't believe you said that
im not going in there
Back to finding where to start learning machine learning
Ping me when drama is here
🏃♂️ if you really find pycord bad, improve it by making prs
cool cool, work hard smart
light mode fie fie
that's not what the first argument in a slash command is ( in pycord)
they didn't even changed discord to pycord all their naming is a mess
why does pycord have to differ in references
every dev hates it, every beginner hates it, everyone hates it
i helped on a project back in school lol
it was a robot which could recognize different types of plastic and sort them out
So does anyone know how I can fix my error
controversial topic but, why does pycord exist?
yes, ctx.interaction.message.created_at
Oh nice
Light mode can be changed tho
🗿 because someone decided to not continue the development of dpy
I wished my school has coding classes
a capitalists' attempt at creating a monopoly in the discord python wrappers business
smh
I swear everywhere I read plastic, i read it as plastid
None of the schools i went to had coding classes
to torture people
One of my schools had like 30 computers in one room
No comments
...that was.....funny?
well, they added them last year in the curriculum, and they just search up 'coding for kids', click code.org and throw us on there for 40 minutes until we can do something more productive.
still this
send code

Tbh i think those PCs were for effects
is that the website where you drag and drop words?
Bro the message hasn't been sent yet
what are you trying to do?
yes
Do a slash command
Scratch 🗿
🤦♂️
well, there is also scratch and edublocks which are millions of times better compared to code.org
Just does this
reminds me of coding classes
because you deferred
Yeah?
and i asked for the code
Yes 1s
why you use pycord
because it's easy to do slash commands
he still tries to do a slash command for hours in pycord
very easy
Pog
🍋
it is easy dont be a boomer
just lemon, not a custom lemon, just lemon. You'll never know why i sent it
*seemed
the fact that noone here uses hikari makes me sad 😩
!paste
just stop dpy development
bro this is your last chance to turn back before you go too far, switch to disnake
I dont even code discord bots now
disnake cultgang
Erm I think I will xd
Srry wrong reply
the skills of the programmer is also important so yeah
wait......you cant defer the interaction of an interaction
but the f..fo.rks 🥺
As I'm saying, the message hasn't been sent yet so you can't access it
that's what I got told
come on
So what does the defer needs to be then
also, why people use ctx on interactions
it gets confused, it's common sense
embed = discord.Embed(colour=member.color, timestamp=ctx.interaction.message.created_at)
Interactions aren't message objects 
ctx.response.defer()```
its valid in their case, since ctx there is a ApplicationContext class, py-cord moment
huh?
cursed
@junior verge why don't you just use datetime.datetime.now() for the timestamp
bruh
remove message
I love how py-cord is so cool, ||a million uwus for py-cord||
Lmfao
import discord
from discord.ext import commands
from discord.commands import(slash_command)
from datetime import datetime
class Whois(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print(f"{self.__class__.__name__} Cog has been loaded\n-----")
@slash_command(name="whois",aliases=['userinfo'],description="Gives info about a user",guild_ids=[867086205182017536])
async def whois(self, ctx, member: discord.Member = None):
await ctx.interaction.response.defer()
if member is None:
member = ctx.author
member = ctx.author if not member else member
roles = [role for role in member.roles]
embed = discord.Embed(colour=member.color, timestamp=ctx.interaction.message.created_at)
embed.set_author(name=f"User Info - {member}")
embed.set_thumbnail(url=member.avatar_url)
embed.set_footer(text=f"Requested by {ctx.author} - https://daxbot.net", icon_url=ctx.author.avatar_url)
embed.add_field(name="ID:", value=member.id)
embed.add_field(name="User name:", value=member.display_name)
embed.add_field(name="Created at:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name="Joined at:", value=member.joined_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"))
embed.add_field(name=f"Roles ({len(roles)})", value=" ".join([role.mention for role in roles]))
embed.add_field(name="Top role:", value=member.top_role.mention)
await ctx.respond(embed=embed)
def setup(client):
client.add_cog(Whois(client))```
why cant you just datetime.now() instead of checking when the interaction was created, waste of time.
there you go
👀
That's what I said
datetime.datetime.now()*
why member is set to None in a slash command 
idk
lol dude just make it a mandatory arg
Default? Maybe?
he's handling it afterwards
true, thanks 😈 but you'd never be able to use it as datetime.datetime.now() straightaway
Like optional arg
inarguable
oh, yeah!
Still doesn't work tho with what you said
i love how pycord didn't write type-hints on slash command docs
there's no point in doing it with slash commands, with classic prefix ones, maybe, but with slash... bruh
!e from datetime import datetime
from time import sleep
t1 = datetime.now()
sleep(2)
print(datetime.now() - t1)
@quaint epoch :white_check_mark: Your eval job has completed with return code 0.
0:00:02.008814
uwus reminds me of someone
lmao
you would probably want the utc time
....well
why use slash commands? there is no real incentive. If discord wants you to migrate to slash, just provide free hosting, great incentive.
also why creating a cog just for whois
man i can't take it anymore
ic
!src bm
Unable to convert 'bm' to valid command, tag, or Cog.
!src bookmark
Unable to convert 'bookmark' to valid command, tag, or Cog.
tf
its a command for @lament depot
@junior verge ||just ignore if you think people are making fun of you||
.src bm
.src bookmark
OH I FINALLY FOUND IT
I know, happens a lot
!d pycord.ApplicationContext
I think i will just go away
it has no message attribute
🗿 It's not making fun of anyone, just damn common sense, there's stuff you just don't do, one of them is using pycord
cya
lets leave it to that
man now do a favor to everyone, burn your pc with pycord, buy a new one and install disnake
or just uninstall pycord and install disnake. let the pc stay safe

nope the pc is contaminated 
but that has already been infected
when i think about that i almost installed pycord damn but it was a last moment decision to try disnake first
i used nextcord for a while but then i became a good developer
thank god i did pip install pycord instead of pip install py-cord 
I've seen that nextcord is the most respected fork
well, people here are completely based on disnake
well when i moved to disnake nextcord hadn't had slash commands yet
😔
Why is it saying invalid syntax when there is not supposed to be a comma?
lambda
no, thats not a capital i
right
well yeah, since Lambda is a class and lambda is a keyword, so well.
ah no probs
Bro, #bot-commands exists @slate swan
;-;
what if i want to show
hunter pops up randomly hi tho
!pastebin
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.
Hi
that's the new trend to #bot-commands people?
ask hunter
he just randomly came and pinged me
100% chat snipe
Hi
Was just lurking here for a bit 🤷♂️
🗿
it should...

ur using it wrong
!d discord.Emoji
class discord.Emoji```
Represents a custom emoji.
Depending on the way this object was created, some of the attributes can have a value of `None`...
open the link
nope
custom emojis are sent by <:emoji_name:id>
then something is wrong 
means nothing, there are some checks that you can do to find what is the problem. first of all you have to retrieve the emoji object with:
emoji = await ctx.guild.fetch_emoji(emoji_id)
Don't forget ```py
else:
print('Ignoring exception in command {}:'.format(ctx.command), file=sys.stderr)
traceback.print_exception(type(error), error, error.traceback, file=sys.stderr)
then there are some methods and parameters that you can use to check what is wrong like:
Emoji.require_colons -> equals true if colons are requires to use this emoji in the client (:PJSalt: vs PJSalt)
Emoji.available -> whether the emoji is available for use
Emoji.is_usable() -> whether the bot can use this emoji
those returns all True or False
ok np
Code
view = RPS()
you need to create an instance of the components class
RPS = class itself
RPS() = class instance
You should at least pass the choice to the view
class Reminder(discord.ui.Button):
def __init__(self):
super().__init__(label="Get Notification", style=discord.ButtonStyle.grey, emoji="")
self.value = None
self.disabled = False
async def callback(self, interaction: Interaction) -> None:
self.value = "getNotification"
await interaction.response.send_message(
f" I'll remind **{interaction.user}** once this server can be bumped again.",
ephemeral=True)
main = sqlite3.connect('main.sqlite')
cursor = main.cursor()
sql = (
"INSERT INTO nextBumpReminder(start, time, user_id, channel_id, guild_id) "
"VALUES(?,?,?,?,?)")
val = (
datetime.datetime.now(), 21600, interaction.user.id, interaction.channel.id, interaction.guild.id
)
cursor.execute(sql, val)
main.commit()
self.disabled = True```
```py
embed = discord.Embed(
description=f"Bumped in **{i}** Servers!\n"
f"React on  to get the Notification about next bump time.",
color=0xffffff)
embed.set_author(name='Successfully',
icon_url='https://cdn.discordapp.com/emojis/905158482884452452.png?size=128')
embed.timestamp = datetime.datetime.utcnow()
view = View()
view.add_item(Reminder())
await interaction.edit_original_message(
embed=embed,
view=view
)``` why is the button not disabled?
https://cdn.discordapp.com/attachments/381965515721146390/961265195324424212/unknown.png
You're aware sqlite3 is blocking?
He already gets what the bot is doing in the command he should pass that to the view or move it to the view
no?
maybe the view is just a couple buttons?
deciding to start another game
rps = rock peper scisor
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
!d discord.Colour.green
classmethod green()```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour") with a value of `0x2ecc71`.
lemme guess botchoose undefined
see the pic
whats the error?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: to_components() missing 1 required positional argument: 'self'
...
where
send full code
where should i add
!pastebin
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.
can you send a traceback too?
me?
ye
are you inside a cog?
nop
my new bot so no cogs
if u need traceback tell but ill need to blot out name so idk
?
Well, you should be using a non-blocking connector such as aiosqlite
^ it does make a difference, trust me
ashley is still right, you've defined view = RPS where RPS is the class, but what dpy needs is an instance of that view
wdym
Hi, i have a dropdown menu atm, but i need to make it create a channel for every option that is selected. For example. I chose order, so it needs to create a channel. But i dont know how to detect when an option is clicked.
its fundamental OOP, a class is a blueprint whereas an instance is a physical thing made from that blueprint
what-
class Reminder(discord.ui.Button):
def __init__(self):
super().__init__(label="Get Notification", style=discord.ButtonStyle.grey, emoji="")
self.value = None
self.disabled = False
async def callback(self, interaction: Interaction) -> None:
self.value = "getNotification"
await interaction.response.send_message(
f" I'll remind **{interaction.user}** once this server can be bumped again.",
ephemeral=True)
db = await aiosqlite.connect("main.sqlite")
await db.execute(
"INSERT into 'nextBumpReminder' (start, time, channel_id, user_id, guild_id) values(?,?,?,?,?)",
(
datetime.datetime.now(), 21600, interaction.user.id, interaction.channel.id, interaction.guild.id)
)
await db.commit()
self.disabled = True``` done
Anyone can help me?
Much better. But you should connect to your database on startup
Can we see your code?
guild = client.get_guild(959432789164437604)
@client.command()
async def ticketmenu(ctx):
ticket_channel=client.get_channel(959432789772619791)
embed = discord.Embed(title="🎫〡Tickets", color=0x93FF90, description="To create a ticket, please choose your category below.\n\n**__THIS IS NOT TO CREATE A SUPPORT TICKET__**")
embed.set_footer(text="© SuperSupport")
embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/960115497830068234/960116218759626792/nobackgr7627411_app_communication_phone_call_conversation_icon.png")
await ticket_channel.send(embed=embed)
print ("Embed gemaakt")
msg = await ticket_channel.send(components=[SelectMenu(custom_id="test", placeholder="Choose you ticket category", max_values=1, options=[SelectOption("💳〡Order", "value 1"), SelectOption("❓〡Questions", "value 2"), SelectOption("👮〡Complaints", "value 3")])])
h?
but the button is still not disabled
Because self.disabled = True doesn't actually disable it on discord
ok
Can this maybe help for me?
what is type
any good resources to get started on bot dev?
wait a sec
oki
oh and how can i disable the button on dc?
dont send picture of code, send code in text form please
Im not aware of that being an event dispatched by the gateway. What library are you using?
You need to edit the message with the new view
@client.event
async def on_select_option(interaction):
if interaction.message.id == 961260048112308344:
await interaction.respond(type=6)
if interaction.values[0] == "value 1":
await interaction.author.send("Menu 1")
elif interaction.values[0] == "value 2":
await interaction.author.send("Menu 2")
better (still dunno lol)
embed = discord.Embed(
description=f"Bumped in **{i}** Servers!\n"
f"React on  to get the Notification about next bump time.",
olor=0xffffff)
embed.set_author(name='Successfully',
icon_url='https://cdn.discordapp.com/emojis/905158482884452452.png?size=128')
embed.timestamp = datetime.datetime.utcnow()
view = View()
view.add_item(Reminder())
await interaction.edit_original_message(
embed=embed,
view=view
)
await view.wait()
await interaction.edit_original_message(
view=view
)```
?
@slate swan where you gone?
That's hard to read
cause of the indents
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
tyty
better?
i cant find
that's not dpy is it?
i think it is
sry i was finding my msg
Check which library you're using. Check your imports
@serene jay got it
https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
why are you using dislash and dpy?
idk
just use the master branch of dpy
im lazy
bc it works 
why not?
discord.py 2.0
nextcord?
AH yes
show ur button
interaction.author
title = f"{interaction.author}'s Game!",
AttributeError: 'Interaction' object has no attribute 'author'
what?
what
wait
k
uh
uh?
try interaction.name
ok
does anyone know about hikari-lightbulb here?
@maiden fable
nop
wait
Hm?
i use dpy it works fine
he is looking for a person who know hikari
Idk
bruh
what um
I'm kind of stuck on an error handler.
exception lightbulb.errors.NotEnoughArguments(*args: t.Any, missing: t.Sequence[commands.base.OptionLike])```
idk
bru hok thanks tho
code?
TY interaction.user.name wrks
thanks
are you using discord components
Oh wait idk how to do that with discord.py 1.7v
Nope
message has been deleted
..
yes u can ask about every lib using python
..
Wait nvm😭😭😭😭
..
Ahem
Try printjng the interaction and remove "await interaction.send"
select = await bot.wait_for("select_option")
print(select)
label = select.value[0]
print(label)```
somethjng like dat
bruv
that is not how you use bot.wait_for
lemme show
He's using 1.7v
Mhm
update dpy mg
I think so

but anyway
try:
thing = await bot.wait_for(event=str, timeout=int, check=lambda)
# "thing" would be the object returned for the event specified
except asyncio.exceptions.TimeoutError: # this code runs when the timeout runs out
pass
else: # this code runs when the check is met before timeout runs out
pass
I fixed the thing. I looped trough it
still the same as this. This "wait_for" doesnt have "timeout" or "check".
it is
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://docs.disnake.dev/en/latest/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
read the docs
What event?
it raises an exception if the timeout runs out, since most people use a timeout, it makes most sense to put it in a try/except block
select_option
picture from the docs-
That was available in the 1.7v
what library?
Dpy
disnake
!d discord.ext.commands.Bot.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
I mean the 1.7v supports other libraries to use interactions. So it had "button" and "select_option"
they said they were using discord-components
Ye
that lib monkey-patches dpy to add components= and those events
Is there a reason my bot can only be in a voice channel on 1 server?
it wouldn't make sense for a member to be in multiple voice channels in one server wouldn't it
not in that way
i meant on different servers
is it not able to be in a voice channel on different servers
it is
For some reason mine will only be in 1 server
Probably something to do with your code, bots can join a voice channel in multiple servers at the same time
How can i make tickets via a dropdown menu?
One question at a time please.
Do you have a ticket system?
I'm sorry sir, I just need to know how to make: when someone clicks on "order" then a new channel gets created. I cant find it anywhere on the internet
i tought: async def on_select_option but that doesnt work
on_select_option?
What library are you working with?
probably not a good idea to mix two monkeypatching libraries together
Yeah i know
but i searched on the internet for an option to create channel on click button and didnt find anything
I have never worked with dislash or discord_components sorry
dpy 2.0 and forks like disnake implement buttons using Views
It's not very difficult using d.py or its forks
please teach me how to do it 😇
The examples on d.py under the views/ folder are very helpful
rapptz has made a dir full of examples
they're often much easier to work with (especially with state) since you essentially write the functions for each component, and dpy figures out which button is clicked and calls the correct function for you
I made a few too :)
Nice tough I'd only take them as examples. So don't copy them.
Still using heavy OOP and super to use View is making it kind of difficult.
I get the error ui and select dont exist
Make sure you're on discord.py v2.0.0
i am a noob, how do i check it?
if you go for dpy 2.0 the docs for these views are here https://discordpy.readthedocs.io/en/master/interactions/api.html#bot-ui-kit
im so sorry for asking
you're probably on dpy 1.7.3
py -m pip install git+https://github.com/Rapptz/discord.py
2.0.0 will be released soon 🥳
install git
you will need to download the repo and install it manually then
just note that whatever lib you choose will have a bunch of breaking changes you need to migrate to
and how do i do that? 😂
restart your console so the PATH gets updated
close and open cmd again
a list of those changes are documented here https://discordpy.readthedocs.io/en/master/migrating.html
yes
make sure you fix any breaking changes
ImportError: cannot import name 'InvalidArgument' from 'discord'
can you show the full traceback
he is doing discord.InvalidArgument
or if its in your import statements remove it from there
like my terminal, or?
so if i add discord.ext.commands on top of my script, that should help?
InvalidArgument was removed in 2.0 https://discordpy.readthedocs.io/en/master/migrating.html?highlight=invalidargument#removal-of-invalidargument-exception
still can you show the entire error message
ah
there ya go, discord-components is incompatible with 2.0
How do i fix that?
uninstall it and never use it again.
the 2.0 i just installed?
nah discord-components i mean
🗿 lmao
where should that be located in my files?
you jsut pip/pip3 uninstall
you remember how you installed it with pip? do the reverse with pip uninstall
yea, with discord-components as the package
any previous code you had with it (also dislash, that is most likely incompatible too), you can comment those out for now
just remove them from my script?
you probably want to remember what you wrote before so you can reimplement them with dpy
lol rip bozo
is there an error above that one?
nah jk bro
nope
just trying to learn
Do you got cogs?
its a windows bug but it usually doesnt have any effect
ik im sorry i was just messin w ya
cogs?
!paste your code here
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.
website blocked by antivirus
No decorator in client event
import nextcord isn't used
You are connecting the db in on_ready
That would make all the sense
Yeah it worked now 😶
Cannot believe I forgot that
Anyone know how I can get an invite link from a discord server that my bot is in
i dont think thats something u should be doing
Me?
Shouldn't be doing that in on_ready
Especially not without an IF NOT EXISTS clause
Ah looks like you already have one
yeah usually getting invites from a server ur bot is in is not good
You'e still making a new connection every time on_ready is called, which can happen for seemingly no reason at all
not related but make the types BIGINT
I would remove that
But I needed to make one
A new connection?
No
You should only have one global connection and derive cursors from there
It's all fixed tho
I am learning sqlite3...
Yes
What if its a private server @formal basin
Oh
you can't say it's illegal or something, after all, the admin adding the bot will see what perms give to the bot
it's kinda unethical
@hushed galleon I still have these errors
that's not an error
how do i fix those? Script wont work
show
^^
sqlite doesn't have a BIGINT datatype
you either use disnake or discord, never both.
you try to use a library you don't have installed ?
wich one?
well, you should say, i don't see your code
what line do i need to show u
yes, but SQL does
sure
That’s a terrible idea
well, when you have a big code, it takes time, the easiest solution is that
technically sure, but SQLite is compatible with BIGINT columns since it gets interpreted as INTEGER affinity which can store between 0-8 bytes
(that does also mean INTEGER and BIGINT in sqlite are equivalent)
That’s why find and replace exists
and tbh, i don't see how is a terrible idea as long as you don't have discord installed
how do i downgrade back to 1.7.3??
also boaz your error is probably a symptom of another bug / breaking change, hence why pasting your code would be a good idea
pip install discord == 1.7.3 maybe
right
pip install --upgrade discord.py==1.7.3
Any recommendations for hosting a bot? New to this side of things. Was looking at heroku but saw the pin warning against it
just uninstall it and install it back again using pip
probably the easiest way
why cross out the text???
people typically recommend a paid VPS for hosting like digital ocean or ovhcloud
Need to run your bot 24/7? Get a cheap VPS.
https://www.scaleway.com/ EU https://www.linode.com/ US/EU/Asia
https://www.digitalocean.com/ US https://www.vultr.com/ US
https://www.ovh.co.uk/ EU/Canada https://www.hetzner.com/ Germany/US
https://www.time4vps.eu/ Lithuania.
Self-hosting: Free hosting: Kinda free:
Any computer. No. Not even heroku. GCP, AWS have one year free micros.
dont mind the formatting
just copy pasted it
why installing 1.7.3 tho
🗿 he asked to downgrade
w o w
replit, keep_alive script & uptimerobot: 🗿
Bro, replit isn't meant to keep yr bot alive
uptimerobot banned replit.

join replit
spam discord API
everyone gets rate limited
No thanks
🏃♂️ proceeds with hacker plan
I hate those people ngl
Might as well get the free Oracle VPS
yea
I cannot get this to work, it's givin me interaction failed every time
for a bot which does nothing but eval 😔 no
wow wonderful amazing
async def cmd(...):
view = ui.View()
view.add_item(Button(...))
await ctx.send("Hi", view=view)
I see. I was looking at a gist and they said that was an inefficient way to do it.
tbh🗿 i hate Oracle, i tried to get free VPS i tried with all my credit cards and still raising random gay errors like "unexpected error. . ." and i was just "ok fuck off, i don't need your vps anyway"
But if it works
Hahaha
Well for some reason dpy wants everyone to go for the "better OOP" approach and instead subclass ui.View for whatever reasons
yeah
Their expectations from us devs are weird 🤷
It seems strange
Like, make a subclass for every time you want a different button with a different response?
devs
class MyView(discord.ui.View):
@discord.ui.button(...)
async def button_callback(self, button: discord.ui.Button, interaction: discord.Interaction) -> None:
...
``` is the suggested way to use a view
with all the kwargs in the button decorator
ikr
Would you have to create a new one of those every time you wanted to create a button that did something different?
Just go with whatever u feel comfortable with. No need to subclass the whole ui.View class just to send a simple "Hi" message on button click lmao
That's what I'm thinking
you're not being forced to do that
I remember doing that
Nothing more than an overkill
You are an exception, so won't really say anything
Isn't that suggested though? Do people do that?
lmaooo
View subclasses are good when your components are more complex, e.g. requiring several variables and having interconnected functionality of components (think of a paginator), so offloading the state management to a view usually simplifies your command
Totally depends. Not everyone likes/wants to subclass everything
that just makes things easier, like the button callback saves you from using a listener to make a response or do other stuff when the button/item is clicked
Like if this is the case, why not subclass commands.Bot for an on_ready and other events lmao
subclassing is better though
sometimes, subclassing is just useless 🏃♂️
who's stopping you
like for a url button
right
class Buttons(discord.ui.View):
def __init__(self, *, timeout=180):
super().__init__(timeout=timeout)
@discord.ui.button(label="Confirm Button", style=discord.ButtonStyle.green)
async def green_button(self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.edit_message(embed=success_embed)
await user.update_balance(amount * 5000)
await user.update_coconuts(-amount)
@discord.ui.button(label="Cancel Button", style=discord.ButtonStyle.red)
async def red_button(self, button: discord.Interaction, interaction: discord.Interaction):
await interaction.response.edit_message(message=timeout_embed, view=self)
await ctx.send(embed=confirm_embed, view=Buttons())
url button is probably the only case where you dont need a subclass of any button or view
how can i check if a message is mentioning a user, if i only have the user's username, tag and id?
on_message commands devs 
Ofc, even when u just gotta send a simple message for button click, right?
When I do this, and I click the button, it keeps saying "Button" has no attribute "response"
Like, interaction is coming through as Button
stop it
I'mma just delete that message
if you're on dpy 2.0 the decorator button parameters got flipped around so its (self, interaction, button) instead
I wish dpy passed the params according to the typehints instead of the position 😔
Would have been fun
Nobody told you to do that for simplicity's sake
Perfect. Thanks @hushed galleon
for a button that sends a message on click, you’d only need one button subclass and a parameter that takes the message you want for it to be reusable anywhere
🗿 i mean technically you are still correct, we are bot developers, bad or good bots, we still develop them, therefore we are developers
what if i dont even develop bots
My mind nowadays whenever I think smth like this:
class Developers:
. . .
class BotDevelopers(Developers):
. . .
class GoodBotDevelopers(BotDevelopers):
. . .
class BadBotDevelopers(BotDevelopers):
. . .
Lmao for some reason I always think in classes, even in irl situations
you're not a bot developer then 
True for me
lemme guess, you've been using java these days?
Nope
that was meant for the comment above your answer 🗿
Ik but I am just saying that its true for me too
I am just too obsessed with Python haha
haha nice
schizophrenia?
Don't make me hate English more with that long word
And nah, I ain't got schizophrenia or smth lmao
how accurate is this after you guys
c++ aint that hard...
Let's move to #ot2-never-nester’s-nightmare
just asked since that seemed weird
Prolly, just helps my brain build logic for the code I work on
assembly?
you can go through the message's list of .mentions and find the first user in there with the matching id or name (discord.utils.get would be handy for this)
alternatively if you have the discord.User object you can use user.mentioned_in(message) instead
You should try binary
never tried that, so wont say a word for that
I wonder do people in this server think about code all day
Do you have to write code to make the button one time use?
Cause I can just keep clickin it 😦
using created_at and expires_at?
nope, subclass 👀
oh
Mhm
Pls help me
Pls give the code and problem
Code:
main.py
import os
from discord.ext import commands
import obsidian
client = commands.Bot(command_prefix='+',help_command=None,activity=discord.Game('Дристаю толчёк 24/7'))
cogs = [obsidian]
for i in range(len(cogs)):
cogs[i].setup(client)
@client.event
async def on_ready():
print("Bot turned on")
client.run(os.environ["Token"])```
obsidian.py
```import discord
from discord.ext import commands
class Radio(commands.Cog):
def __init__(self, client):
self.client = client
commands.command()
async def join(self, ctx):
if ctx.author.voice is None:
embed = discord.Embed(title="Error! Pls,join to voice channel!")
await ctx.send(embed=embed)
if ctx.voice_client is None:
channel = ctx.author.voice.channel
embed1 = discord.Embed(title="Successful!Bot joined to voice channel!")
await channel.connect()
await ctx.send(embed1=embed1)
def setup(client):
client.add_cog(Radio(client))```
Error
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
What do you mean by subclassing?
how would I disable it after one usage? There's no Interaction attribute that makes it one time use?
!customhelp has a good subclassing guide which can get u started
Custom help commands in discord.py
To learn more about how to create custom help commands in discord.py by subclassing the help command, please see this tutorial by Stella#2000
How do you get the unix timestamps in discord.py with datetime? Like for example when a user joined
!d datetime.datetime.timestamp
datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time").
Naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.
For aware [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:
```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
``` New in version 3.3.
Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
Then how do you get it to like <t:...:D>
can you edit an embed?
Can you edit a message?
yes
Yes you can !
Using string format to put it there.
you can use Discohook
!d discord.Member.joined_at
An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.
A what?
it's a website
but you could also use the message link
and then resend the message inside the message sent
If it's Discord.py related
We also got #❓|how-to-get-help and by discord.py i mean everything regarding the Discord api
a message on discord has a link
a url, so if you use that url you can edit a message, embed or not
I don't see why you would need an url to edit an embed.
I'm just giving a solution
If you'd use the raw api i guess but that's a bit much.
if you don't know what message to edit then how are you supposed to edit it
Just use the message id.
I'm pretty sure that does the same
Only you are suggesting raw posts where of I'm suggesting using a wrapper.
Okay and 99% of the people here don't make raw requests.
chill a bit mate
..? 
idk you seem tense
I'm just suggesting something and you kinda sound passive aggressive
@storm cairn you do this with asyncio.sleep
Checked it out, just to let you know we code bots here.
send has a delete_after kwarg
if it's ticketmenu try putting the print before and see and if it's on_select_option print what interaction is giving before checking it
the last thing that prints is: "part 1 done"
Any idea why i keep getting these messages?
RuntimeWarning: coroutine 'Command.call' was never awaited
print('Channel Name_After:- ' + channel_name_reset)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
I am trying to print within a function which executes fine except for the print part
never calling the msg
do so it's not msg = await tick_channel.send()...
to await ticket_channel.send()...
I'm lost with disabling a button after its clicked.
Can I just remove the buttons after they're clicked? I feel like reactions are way better for me because I'm stupid
put await in front
but actually thats not the problem
like await print.....?
everything goes perfect until @client.event
if you have asyncio imported you can do
it looks like your never calling it thou, I might be wrong
you can disable the button with children and just disable it and yes you can remove buttons
!d disnake.ui.View.children
The list of children attached to this view.
!d discord.ui.Button.disabled
Sorry, I don't know how to use children
Or what they do. I'm not that advanced yet in my learning 😭
!d discord.ui.Button.disabled
property disabled```
Whether the button is disabled or not.
and just set the propery to False to disabled it and to enable it just set it to True
if i create a channel via discords api how would i return that id?
of ther chaannel i created
the method to creating channels returns a channel obj probably
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
I hate to keep asking, but I printed the list of children, i'm not sure how to change one of them
.replace / .remove?
yup it returns the obj
change by?
is there a way to get the id via the obj?
I'm trying to change disabled to True
The channel ID.
I can print the list of children
you index the list
!e
children = ["component0","component"]
print(children[0])
example on how children works
@slate swan :white_check_mark: Your eval job has completed with return code 0.
component0
are they strings? when I printed the list, it looked like they weren't separated by commas
[<Button style=<ButtonStyle.success: 3> url=None disabled=False label='Confirm Button' emoji=None row=None>, <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Cancel Button' emoji=None row=None>]
nah theyre not strings theyre objects its just an example
how to delete an embed?
This is what I got when I printed self.children
just delete the message or are you editing a message because if youre just dont give anything to the embed kwarg since its an optional kwarg
read above!
because you only have 2 components which are 2 buttons
if its the second button yes
then how do i access disabled?
self.children[1].disabled = True
you index children which it returns an obj which then you use the property to set a bool value
show
error? or warning
Ok, because when I did it, it deleted the message which executed the command
just ignore it
I can still click the button
await interaction.response.edit_message(embed=success_embed, view=self)
yep!
ok let me try
What scopes are we supposed to set for bot invites?
the scopes your bot needs!
It worked. Thanks once again
I put the commands one. It's giving me errors about needing another one.
it ran fine before tho. I'll invite him back properly
I didn't realize they were objects
Anytime
well you should read up on the docs as they show return types and can be quite useful
I've never used children before, so I was just goin in blind
Plus the docs for the children doesn't say anything
other than it's a list
i mean it does show what it would return you just need to check what obj it returns to apply methods etc
and if the docs arent clear read src 
src = source code?
yes!
if you try to load a cog that already has been loaded it raises an error so just catch it
yes?
just catch the error and do something on it
no
is statement is used for comparing objects/entities which the if statement would return False
!d is
!e
print(0 == False, 0 is False)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | <string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
002 | True False
== operator compares values while is compares entities
So its the bot and aplications.command scope?
if your bot uses slash commands yes
I see. And if I clear the list of children, it just removes the buttons!
Ah
if you send an empty view it removes all buttons
is one more efficient than the other?
my method is more efficient yes.
anyone know what are these and how to do them in discord.py? I couldnt find anything online and as far as I know theyre called "providers"
hahah yes master

those are buttons
they just have an emoji with a url
how to do them
theres examplea in repo so just check them out
https://github.com/Rapptz/discord.py just check the example folder
ok thanks 😄

im making discord bot for a friend 😄 so far its going kinda good. but the thing is most of the stuff In that code I couldnt remember so like 80% of the code is just stackoverflow

like its just me not remembering the syntax because when I see the code most of the times I understand it
lol
if you understand it thats great if you dont remember the exact syntax its fine were all humans!
:d

hey um.
I cant find the buttons example in the repo
https://github.com/Rapptz/discord.py/blob/master/examples/views/confirm.py
Here is an example
oh thanks 😄
No problemo 
ok I see it thanks so much! 😄
krypton how you doing? long time no see
how did the bot can know if someone on an other server used the same command?
I want to make a crossplay minigame
hey i tried to make an event that when you send an message with "sus" it mutes you how do i make it ? i tried everything but nothing worked