#discord-bots
1 messages · Page 95 of 1
put the emoji in chat box and put a \ before it
then send in chat
like
yeah your just using the name
lol use need id too
or not
or their bot is not on the server where that emoji is
or it doesnt exist
he already clarified it is
\:FlashWhiteHeart: = :FlashWhiteHeart:```
also
w the id but it turns to that
!kekw
your not doing it right lmao
💀
u dumass how dare u dont use python but use vscode when running python code
:lmaoXX2:
check from here for more fun
who is that meme man? @honest shoal
still doesnt work
is he like 9 y/o?
@silk fulcrum
yeah the bot does not have access to the emoji
cool'
how do i put access
add it to the server where that emoji is
did you provide the emoji that is in your server?
I mean you can do \:socoolemoji:
which will be the emoji from that server
ill try now
and you can do \:socoolemojionmyserver: which is on your server
💀
wtf is this xd
a school project
Hahaha
starts from here
ends nowhere
blocked him
waiting
for him to come here
next time that guy will come with a huge site written on Laravel that has 49654577654875 dependencies and requirements and ask for us to run it on PHP
HTTP only discord?
Speaking of cool projects, I made this | Discord bot Discord B)
Y can log in as bot and do stuff
it's system only discord
authors are same as text
Bro Im still learning Css lmaoi
5 days into that project
xd
forget what i said
what
it's python only discord
it reminds me of widgetbot, which embeds discord server on website
chat using webhooks
So you're basically making a discord bot with a ui?
Chat using Gateaway and websockets
token gra...
5 elur!
Yeah youre just making a discord bot with a GUI kek
Yep :d
no
if that is a bot then it doesnt
you're doing the same when making api requests via code
I doubt it, you're just making a discord bot and making a GUI with its payloads etc, a self bot is using your token with automation
maybe
☝️
@tidal hawk btw, these are nice https://github.com/skyra-project/discord-components
what? how is that gud
Oh okay, welp I'll torture myself and try to make them myself xd
@tidal hawk can i contribute to the project?
because they look realistic
I only work with back-end for your information
oh my god! I found such an amazing tool: google drive, I'll 100% use it instead of git
Sure :D
I'm fairly new to web development, so you're gonnaa find some funny stuff probably
You should also set up docker
I wont even be looking at front end code, i hate front end
xD
yay
Bruh I only used it bcs it shows instantly when somethings wrong
What's wrong with that?
Nothing, i just mainly like working with python backend
😡
I tried getting into Django, flask etc, but js frameworks seemed more reliable xd
yeah
You gave me an idea, making a discord bot CLI with ascii
ill probably do it after i make my lang for thought
Nice idea :D
why tho
I don't like js that much
like you have to make slash commands in seperate files
I think itäs way more complicated to make a bot than in python
cogs
no doubt
Imagine you have a bot without prefix based commands
then how will you use cogs
I use disnake
Or i can make a CLI domain language so then i can write the discord bot CLI in that domain language😳
disnake best lib imo
he's really innocent
Yeah, i personally love old codebase
better than dogshit dpy with their tree shit lmao
i thought u was being saracastic
Never said i wasnt being sarcastic neither did i say i was being sarcastic
That's funny af
posting dead end in #ot0-psvm’s-eternal-disapproval
i'm trying to create a bot to learn some python, but i'm new to reading documentation, and i feel like the discord documentation is a bit overwhelming. i just can't seem to figure out how a lot of the stuff works, and a lot of the guides/youtube tutorials i find seem to be out of date.
how can i get the name of the voice channel i'm in? i'm trying:
async def chan(self, ctx, user: discord.Member = commands.Author):
channel = user.voice.channel
await ctx.send(channel)```
but i'm pretty clueless. feel like an idiot trying to figure this stuff out :\
by new to documentation i mean i've mostly used the standard libraries before. and if i've used others, i've managed to find most of the info i need by googling
Discord.py pretty complex lib so understandable that ur confused
That's pretty much it. What's wrong with the code?
Also, if you're just starting to learn Python, discord.py isn't the best beginner-friendly project to start with
i don't know... it wont send the channel name to the chat when i use the command :S
I would say you just learn OOP in python (classes and objects and the like) and then you'll be able to read documentation
What is = commands.Author supposed to do? That not a thing
channel might be None then. Member.voice can optionally return channel
Defaults to the user who invoked the command. It's the same as doing ```py
@commands.command()
async def chan(self, ctx: Context, user: Optional[Member] = None):
user = user or ctx.author
But why isn't it documented
discord.ext.commands.Author```
A default [`Parameter`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Parameter "discord.ext.commands.Parameter") which returns the [`author`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Context.author "discord.ext.commands.Context.author") for this context.
New in version 2.0.


yeah, i was told to use commands.Author the other day, as thats how its done in new version
i've made sure i'm in a voice channel when i tried the command
so shouldn't it return something then?
Make sure u join it after running bot
that didn't help, unfortunately
can you show code
fml
spent friggin hours troubleshooting
sometimes programming is just the worst 😛 thanks for trying to help though 😉
https://gist.github.com/jegfish/cfc7b22e72426f5ced6f87caa6920fd6
saw this method to use postgres
seems a bit complicated, isnt it possible to make the connection to the database at the beginning of the script so I only use 1?
if anyone can show some of their own code it would help to make me see how to use this, im replacing aiosqlite
if you're not subclassing Bot, you can use bot vars to achieve the same thing
from discord.ext import commands
bot = commands.Bot(...)
bot.something = "stuff"
then, inside a cog for example
@commands.command()
async def command(ctx: Context, ...):
stuff = ctx.bot.something # evaluates to "stuff"
you can implement this same concept with your database connection
be careful what you name your variables though, otherwise you might override something
Try py -m pip
how do i and where can I learn about responding to slash commands using http?
make sure that user_input is an str
hmm ok
im guessing u dont have a error
nope
what is "user_input"?
is this code in a subroutine / function, make sure ur passing in the ver
okay tysm for help
np
are there any free 24/7 hosts i can use to make my discord bot run all the time
i use replit, i just use a separate python file to give it requests so it doesnt shut off though, there is some issues with replit
idk
https://uptimerobot.com/ use this to send replit requests
or do i need the pro thingy
https
use this code
from flask import Flask
from threading import Thread
app = Flask("")
@app.route("/")
def home():
return "Hello. I am alive!"
def run():
app.run(host="0.0.0.0",port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
put this in a different file e.g
then in ur main program put:
ooh ok
then before u do client.run put this
soo keep_alive() before client.run?
get a url from Webview and put it into uptime robot
yes or before u start ur bot bascily
whats web view ahaha
have u added this code to a separate file @slate swan
yeah but i get so many errors on replit
screenshot?
ill give u the way i did it
aight
from discord import Intents
Intents.message_content = True
client = discord.Client(intents = Intents.all())
let me see ur code
alr
use oracle cloud
they have an insane free tier, you get a vps and just use pm2 to keep the bot running.
I'm trying to make a bunch of one time use invite links, I found this code on stackoverflow, I tried editing it, but I am not getting the results I want
also I don't think you should be using abc classes for creating things?
I'm just copying the code, I am in over my head, I've only ever worked with python once back in 2016
I'm trying to get this intent
the invite_create
use Intents.default then
also, you'll need instances, not classes (looking at discord.abc.GuildChannel...)
you need to enable the intents inside of dev portal pretty sure you also need guild intent to create invites .
it might work but it isn't really the way you do things, they are meant to be used by other dpy classes as a sort of base
Those intents are enabled by default in d.py, they aren’t privileged
Don’t confuse intents for permissions, they are two different things
that's just the events you receive from the gateway, should be part of Intents.default anyways
he doesn't have them enabled in dev portal lol look at the error
That could be any of the privileged intents, since they’re using Intents.all()
Ah okay, yea that was the issue, so it got passed that, but yea now I'm stuck on the abc class thing of it
you need an actually channel object
just use the actual object rather than doing it through abc
you're calling it by passing in the instance as the fist variable manually, you could just call it by doing
await c.invites()
await c.create_invite(...)
so c.invites() rather than discord.abc.GuildChannel.invites(c), that way you ensure that not only you get the complete (and correct) implementation for your specific channel (might not matter here but does in other methods) but it's also a lot nicer
don't do stuff it on ready either
Your terms arent correct, he's using an actual class object, you ment using an actual instance
Strange that you exit your script after going through on_ready
Segfault moment
I am just taking what was in the stack overflow
and trying to make it work
lmao
is technically correct but yeah should have been more specific
Not exactly
the thread they're going over seems to be pretty outdated so yeah
yea it doesn't even have intents in it
That's why I was trying to get help for it to be used with current changes in discord.py
An object can refer to an instance, for example 20 is technically an instance of int and is also an object. Unless object "blueprints" (classes) are also objects themselves, it should be enough info to infer that I'm referring to c (an object or an instance of a class)
*just verified the "unless" clause, classes are themselves objects too
I'm really dumb, is there anyone willing to help me in dm's so I don't clog this channel?
You could open a help channel, and people could help there #❓|how-to-get-help
there's really nothing else happening in this channel right now, so you're fine to do that anyway
Alright, so I changed it to the c.invite and c.create_invite but it just made it an error, what did I change wrong
why are you doing c.invites(c)
Don't pass in c to either of them.
what is the meaning behind that lol
now we're here
That one is because you're calling exit()
ye I removed that after I posted it
now it's just printing "Finished. Exiting soon..."
It does this by raising the SystemExit exception, which discord.py probably picks up and raises
My point is a class object is the actual object that can have multiple instances from it, so polymorphism comes in play, while an instance is an object from a class, they arent the same thing, they are mostly distinguished as, a class being class object while an instance is an object of a class
I feel like there is an easier way to create multiple single use invite codes, that I can send to different people at will
But I can't wrap my head around it
Couldn't you just create a new one when you need one?
Also keep in mind invites is always going to be less than 75 so you should have an infinite loop
well I have a paid subscription service to enter the server, and I need to make say 48 invite links to send out, but I can only make one link at a time through discord, then once they use it, only then can I make a new link
so I was trying to find a way where I can make 48 or however many sing use, permanent invite links to my server, without having to do it one by one after each person joins
fair enough
I changed it to not re-asign i, but I'm not quite sure what you mean
new_invite = await c.create_invite(...)
here new_invite is your invite instance
Ah I see, well now I'm here
someone mentioned on_ready being a problem earlier, is this what is affecting ti
no, it is an issue but it shouldn't affect that error
c.invites() does not take any arguments, so c.invites(75) will error
So I'm pretty sure the code I got was just hog wash then no? Or is it just because it was outdated
pretty much
yea because no form of editing this creates any shape or form of a discord link invite
all it does is print, well, what's in print
yeah probably better to start new
!d discord.TextChannel.create_invite
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") to do this.
create_invite should make you an invite but probably better to just start over
oracle cloud free tier is really annoying
I don't know if this is just me or what, but I can't find anywhere that I change the info I put into it like my email, phone, etc.
They keep sending me emails and calling me too
what is result1[0]
Alright my friend sent me this, it is supposed to make a CSV file with invite links, but I think I'm doing something wrong
If its an int why is it in an f string?
And you're probably showing the wrong part of the code
i have a command in my bot that creates a channel and overwrites permissions for that channel so only the user/bots/admins can see it. I want a way to be able to 'invite' people to be able to view that channel (i was thinking of using mentions and a keyword ie &invite, then pull the mentions and add them somehow).
The issue is im not sure how to give select other users the perms to see it. Ive thought about custom server roles, but i dont know how to make it so the person granted x role cant see all other open chatrooms.
You could think of this as a way to have dms on a server, or in my case, this is to allow people to be invited to join a game run in an otherwise private channel.
perhaps theres a way for the bot to create a temporary role, and set the channel to need the matching role to see it?
Then delete the role once a certain time has passed or some such
here is an example.
async def inviter(self, interaction, member: disnake.Member):
overwrites = {
member: disnake.PermissionOverwrite(
view_channel=True, send_messages=True,
),
}
interaction.channel.edit(overwrites=overwrites)
in this where would i define the one who's perms im editing tho
ah i havent dabbled in slash commands
ahhhh
you can still do the same with chat cmds
i havent used them tho lmao so i wouldn't know how, but you can just get the person mention in the chat cmd
im just not clear where to input that mention into this
the overwrites
unless im not understanding part of how its working lol
overwrites = {
member: disnake.PermissionOverwrite(
view_channel=True, send_messages=True,
),
}
then you edit the channel with those overwrites
i understand how the overwrites work
just not where the code gets who im actually mentioning; i would think i would need to replace something with a var
and add the mentioned user to that var
wait dont use overwrites cause i think it will get rid of the original you can use this instead so it only changes for that user.
await channel.set_permissions(member, read_messages=True,
send_messages=False)
with member being the var ?
mhm
member : discord.Member
ohh r u using member as the var
sorry for the lack of understanding xd
it just didnt quite gel till just now what u were doing
@bot.command()
async def inviter(ctx, member: discord.Member):
await channel.set_permissions(member, read_messages=True, send_messages=False)
await ctx.send(f"{member} added to the channel")
all you need
i just realised one issue; i cant ping people who cant see the channel alrdy
just make a channel for commands
and add a param for channel
in the cmd deco
or you can still do in that channel but take member id instead then get member object
i was thinking of that
its not exactly convenient for other people to do that tho, as this isnt a developer server or anything
is there a way to use slash commands that let u show everyone in the server as a choice for a parameter?
seeing as u r familiar with em
nah if they don't have perms to that channel the slash cmd is being executed in then you can't mention them
damn
can u think of any workaround atm
i guess i could make a command that lets people get the id of whoever they pinged
its a lil messy but could work
you can still ping ppl in channels they cant see
i actually right clicked their name in a normal channel hit mention then copied it from chat box and pasted in that channel
but ye you can also do like that
but its kind of annoying if youre just a normal user
oh
thats a bit easier
i mean if i can simplify it more i can later, but this will let me do testing
also do u know if its possible to have 2 people running on the same version of an instantiated class
ie if i had 2 people who were in diff channels but could interact with the same info
and modify it
How do I append an async function to a dict, without triggering it?
a_dict = {}
a_dict.update({"ID_1": await an_async_function(arg1, arg2)})
I want to add it now but trigger it later by doing something like a_dict["ID_1"], when clicking on a button
I tried to do this, without await
a_dict.update({"ID_1": an_async_function(arg1, arg2)})
to later do this: await a_dict["ID_1"]
But it wouldn't let me.
It will give me error about that I need to put await in it, before it can continue
!d asyncio.loop.create_task
loop.create_task(coro, *, name=None)```
Schedule the execution of [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine) *coro*. Return a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") object.
Third-party event loops can use their own subclass of [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") for interoperability. In this case, the result type is a subclass of [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task").
If the *name* argument is provided and not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").
Changed in version 3.8: Added the *name* parameter.
How should i use it?
Could someone send me the discord.py source for where interactions are processed for like views and all commands?
I’ve looked and I couldn’t find it
discord/state.py is what initially dispatches the appropriate methods for app commands and message components through its parse_interaction_create method
??@primal token
you're on discord.py 2.0 right?
what's the problem?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
Update discord.py
I forgor how 💀
pip install -U discord.py
first of all put your token lol client.run(“TOKEN”)
and turn on the intents on ur bit and write tgat after the “*”, intents=discord.Intents.all()
still same error
❤️ thank you
whats the error
!dashmpip
When trying to install a package via pip, it's recommended to invoke pip as a module: python -m pip install your_package.
Why would we use python -m pip instead of pip?
Invoking pip as a module ensures you know which pip you're using. This is helpful if you have multiple Python versions. You always know which Python version you're installing packages to.
Note
The exact python command you invoke can vary. It may be python3 or py, ensure it's correct for your system.
And run your code with the python command instead of through your ide
What's the best way to see if message has a thread created? Trying to delete message and thread if it exists.
You need intents
from discord import Intents
Intents.message_content = True
client = discord.Client(intents = Intents.all())
Hey, can someone help me with making a button that says “claim” and hen you tap on it it changes to “claimed by - {the user name}”
you can look at the examples in the dpy repo on github
Okay
nice
Intents.message_content = True
Thankss
welcome, you can always ask for help here if you face any issues regarding those
are there more commands with ?autorole?
@commands.hybrid_command(
name="userinfo",
description="Get some useful information about a user.",
aliases=["ui"]
)
@checks.not_blacklisted()
async def userinfo(self, context: Context, *, user: discord.User = None) -> None:
if user is None:
user = context.author
account_created = discord.utils.format_dt(user.created_at, style="R")
id = user.id
name = user.display_name
if user in context.guild.members:
joined_at = discord.utils.format_dt(user.joined_at, style="R")
roles = [role.mention for role in context.author.roles if role.name != "@everyone"]
if user.bot:
roles.append("Bot")
embed = discord.Embed(
title="__User Info__",
description=f"**Username:** {user.mention} \n **Nickname:** {user.display_name}\n **ID:** {id}\n **Bot Account? : Yes ✅**\n**Account Created:** {account_created}\n**Joined Server:** {joined_at}",
)
else:
embed = discord.Embed(
title="__User Info__",
description=f"**Username:** {user.mention} \n **Nickname:** {user.display_name}\n **ID:** {id}\n **Bot Account? : No ❌**\n**Account Created:** {account_created}\n**Joined Server:** {joined_at}\n**Roles:** {', '.join(roles)}",
)
await context.send(embed=embed)
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'User' object has no attribute 'joined_at'
error
if the user is in guild then i am getting this error
!d discord.Member.joined_at - User doesn't have a joined_at attribute. Maybe you're looking for a Member object?
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.
but in member we can't get the info about the user who is not in the guild
what
Then you can't get joined_at because the User object doesn't have it
is there any other way?
You could use typing.Union and check if the argument is Member or User before getting the joined_at
import typing
...
async def userinfo(
self,
context: Context,
*,
user: typing.Union[discord.Member, discord.User] = None,
):
...
joined_at = None # Default value
if isinstance(user, discord.Member): # Check if `user` is an instance of `discord.Member`
joined_at = discord.utils.format_dt(user.joined_at, style="R")
You can improve this later, but I'll keep it simple
is it possible to make a link of some kind that when clicked makes my bot perform an action? i dont mean like a button or a reaction, but an actual link. its fine if it only works within the server
why does joined_at need a default value huh
and why is user a kwarg, it'll be converted to a string, there's no point of typehints
you'll have to own the website that the link is of
or you can always create a separate app for creating redirect links and then using those
* would convert user to a string
i dont mean a website link (i hope it doesnt involve a website anyway)
which link.
im looking for a way for peeps in my server to share a limited life (timed) invite link to a multiplayer private game channel
i guess i could use a database to store a password that gets deleted after a time; the users could just have to type the password into any of the chats for the bot to allow them access
think of typical multiplayer games where u need an password to join; im just trying to create a version of that password
atm im using ping mentions and direct messages, but a couple of issues im trying to work around is that u cant directly ping someone from within a private channel
how do links come into play
and if someone has their dms off the reaction invites dont work
well links was the best thing i could think of to get around those issues
add a try/except if that's what you mean?
well if you're trying to invite a friend to play
hm
hm yeah
once u do that, the bot will send the pinged player a dm
that player can react with an emoji within 60 seconds to join the game; after that the link expires
ah
you'll have to set up a custom event or smth ig? which checks if a new member was added to a channel
i need a simpler way of 1, pinging the players, and 2, being able to manually give the players a code that lets them join if dms r set to friend only
because atm the only way to ping/mention the players in the private channel is to type @ so and so in a general channel then copy paste it into the private one
technically what i have functions. im just after a easier method for the people who are trying to chill and have fun, as the current way is a bit messy
you could make something like a command which shows all the available private game channels in a server along with their codes. the user then types in the code and a prompt is shown in the game channel asking if the user can join or not
I think that's an easier way
and then the room owner can accept/decline that request
or you can send them to the owner's dms if they are enabled
thats an interesting idea
hm, I really think that's gonna be cleaner, easier and would give more control to you
probably less work to set up than what ive had to do so far too lol
this would def allow for various changes later on
mhm
well ive noted that down for later, thx
!e y = 4
y = 9
print(y)
@honest shoal :white_check_mark: Your 3.11 eval job has completed with return code 0.
9
because you defined Client and Bot both using client
yeah but it works in vs code
only the latest one is taken in python
i just followed a tut on yt
don't go for them
@slate swan use bot or client. Not both
i am working in vscode

were you the one who just ghost ponged
yes
with what
.
why is the view making an error
like it sayd that its not defined
says
yo
So easy program
someone just scammed me :/
I made them a discord bot & dashboard and once I transferred he blocked me lmao
you should take money first
how are you sending
you should get some error
Thats weird i dont get an error
how much was he going to pay you, if you dont mind me asking?
then you maybe missing something, I can't help because I've never made a single select menu
Swap the interaction and select in the callback function
property values```
A list of values that have been selected by the user.
WORKS!
do u know how do i do that if theyre choosing an option the bot is giving them a role?
this is why you should request the money first
Can anyone remake my code for me? Ill send the code in dms
You right
for a basic bot or a complex application?
It's my first time selling so I didn't know
Complex bot and dashboard
25 for both?
Economy/moderation/mini games
Yea
That's a scam already it shouldve been, 15$ the bot and 15$ the dashboard
depending on your codebase and the purpose of your bot but i'm thinking your codebase isnt terrible
why does my code work with bots and client in vs but not in replit
What do you mean by not work in replit?
i only get errors but it works fine in visual studio
What errors?
Hey guys, can someone tell me what is wrong with this thing: python users = await new_msg.reactions[0].users().flatten()
AttributeError: 'async_generator' object has no attribute 'flatten'
The above exception was the direct cause of the following exception:```
I'm trying to make a giveaway command and this error pops up and I don't know what is up with it.
i always get TooManyRequests on replit
See examples in docs
!d discord.Reaction.users
async for ... in users(*, limit=None, after=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") representing the users that have reacted to the message.
The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Changed in version 2.0: `limit` and `after` parameters are now keyword-only.
Examples
Usage...
hmmm how i get all yes/YES/YeS/Yes/yES in one
all combination
for check
Hey guys is there a way to combine slash commands and prefix commands
guys what's use of ctx.typing() function?
Just make input string lowercase and compare to lowercase "yes'
It shows "bot is typing..."
its usually to indicate the bot is typing
In discord py it is called "hybrid command"
There is mor info in docs probaby
I'm looking for nextcord
but it should be the same right?
where am i going wrong ere
id_list = '\n'.join([f' - {m.name} ({m.id})' for m in ctx.guild.members]):
await game_channel.send(id_list)
it says that neither m nor ctx is valid references (tho i suspect fixing ctx would fix m)
Im assuming that list comprehensions cant use global values?
this is within an async func
Can u send full error?
Or the full function
wait stupid me
Also why is there colon after
i think i worked out why smh
nextcord doesn't have any such feature
that explains why I couldn't find any in the docs thanks
tried it and i couldnt do anything
tried what
reading the docs.
gives me error for this python users = [user async for user in new_msg.users()] AttributeError: 'Message' object has no attribute 'users
Because it is method of Reaction not Message
See how ur getting Reaction obj here
new_msg.reactions[0] ?
ye it worked now. Tysm, appreciate it!
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
Guys i have run my discord bot in termux
How can I stop the running of code?
I have intents
Exit the session
But i need to cd again
How can I stop there?
The error doesn't lie
class h(discord.ui.View):
def __init__(self):
super().__init__()
self.value = None
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = '**__You have cooldown ! Please use this command again in {:.2f}s__**'.format(error.retry_after)
await ctx.send(embed)
@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def h(ctx, *,message='No Reason ! ❌', self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.send_message("You claimed me!", ephemeral=True)
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)```
thats the code
and its not working
I believe you can exit from the notification
If not then I honestly don't know another way besides exiting the app
That's not how you make button
What the hell is going on in command callback params 😆
can u go on a call?
no
oof
cuz
i need it to be a claim button
that staff can claim
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey) this should go in your View h
with a callback
and you should name your command something else
cuz it overwrites your view
for what maximum time ?
They have some good examples
https://github.com/Rapptz/discord.py/blob/master/examples/views/counter.py#L21-L28
examples/views/counter.py lines 21 to 28
class Counter(discord.ui.View):
# Define the actual button
# When pressed, this increments the number displayed until it hits 5.
# When it hits 5, the counter button is disabled and it turns green.
# note: The name of the function does not matter to the library
@discord.ui.button(label='0', style=discord.ButtonStyle.red)
async def count(self, interaction: discord.Interaction, button: discord.ui.Button):```
thanks
yeah use those examples to create your own button
change to what?
also i cant find the callback
I don't know, it can be anything, that's why discord.py also added a name kwarg
@bot.command(name="h")
async def coconut(ctx):
await ctx.send("Coco Jumbo")
it's triggered with !h
ohhh
thats good
wait
class h(discord.ui.View):
def init(self):
super().init()
self.value = None
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
@bot.command(name="h")
async def coconut(ctx):
@commands.cooldown(1,30,commands.BucketType.user)
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def h(ctx, *,message='No Reason ! ❌', self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.send_message("You claimed me!", ephemeral=True)
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("Coco Jumbo")
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)
thats the code now
you didn't change anything tho
yes im doing before and after
ok
!d discord.ext.TextChannel.typing
I just realized something
!d discord.TextChannel.typing
async with typing()```
Returns an asynchronous context manager that allows you to send a typing indicator to the destination for an indefinite period of time, or 10 seconds if the context manager is called using `await`.
Example Usage:
```py
async with channel.typing():
# simulate something heavy
await asyncio.sleep(20)
await channel.send('Done!')
``` Example Usage...
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
you should add an else: raise error
like this?
oh
is that the problem?
well not necessarily
oh
what it does is not showing you the error
ohh
so you don't know what's wrong because you see no error
ill check one moment
except if it's a CommandOnCooldown error, you get that message
but eats up all others
Do u have message content intents?
In dev portal and code?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
U need to enable in code like that
import Intents 🤮
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
you do have intents
oh
Intents are fine but wtf is happening in command code
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error
Why do u have command decorator on top of button decorator
iu dont know\
ill try
god I love errors
🥴
No my friend did
U should look at dpy GitHub examples for how to make button
Mashing code together won't work
yes but i dont want to make a normal button
like
What is normal button
first of all let's clear your command mate
i want to do that
That's what buttons do
that it will do Help and if u tap on it it says "claimed by (the user)
That's a normal looking button
done
So how is that not a normal button 
nono it is
but if u tap on it its says claimed by and the user
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
And maybe learn OOP
Hehe
class MyButton(discord.ui.View):
def init(self):
super().init()
self.value = None
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error
@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)
so the button you want is going to be in the view
Yea so u can define that behaviour in the button callback...
Yes
put it in the class
put what?
The button
You need to use an instance of the class object not the actual class object
In the view
make a button like
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, button: discord.ui.Button, interaction: discord.Interaction):
print("pressed")
in the view
okay
you're also gonna wanna fix
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h)
to
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=h())
view= doesn't take a Class but a Class Instance
in the class ...
like in the MyButton(here)
The Interaction object always gets passed second upon the calling of the method
have you renamed your command yet?
No man u need to learn classes
thanks
i corrected myself as well for the people who like to be pedantic
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
print("pressed")
```this is right then
@bot.command()
async def menu(ctx):
view = MySelect()
await ctx.send("Hello", view=view)
I think ur the only pedant here dw
smt like that?
I'm not pedantic, but sure
that seems about right
with one waste of a variable that doesn't change the outcome
What's with the creation of a reference?
no...

then where
okay
and you send the view in a command
Nice contradiction
thank you I've been figuring this phrase for quite a while
class MyButton(discord.ui.View):
def init(self):
super().init()
self.value = None
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error
@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton)
@bot.command()
async def helpme(ctx):
view = MyButton()
await ctx.send("Hello", view=view)
class MyButton(discord.ui.View):
def __init__(self):
super().__init__()
self.value = None
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
print("pressed")
and the helpme command is right
class MyButton(discord.ui.View):
def init(self):
super().init()
self.value = None
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
print("pressed")
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error
@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton)
@bot.command()
async def helpme(ctx):
view = MyButton()
await ctx.send("Hello", view=view)
so now do i run the code?
await ctx.send("@deleted-role", embed=emeb12233, view=MyButton())
fix this and it's probably gonna work
did it print?
good
Now i need to learn how to make it edit to Claimed by (user)
i will learn this
thank you so much.
your the best thanks
Hey!
I want to make an event when someone joins a certain VC it makes a private one for that user.
What would something like that look like?
can u specify it more clearly?
Say i join a vc
The bot will drag me to a private vc with permissions for that channel to drag people in
sum like that
hmm
Create on_voice_state_update and check if the user joined the certain VC, if so then create a new voice channel just for the user and move him there
yea
hm
with perms to invite people to it
i know how oto change the perms
i just dont know how to detect when a user joins that exact vc
then proceed to make the channel
on_voice_state_update
how would i check if someone joined that specific channel then make a new channel?
alr wait
Check after voice channel id
on interaction:
if role-id in interactor.roles:
send-message "Claimed by" + interactor.name
else:
do nothing
can someone help me w turning this into a py code
heh
we not allowed to write code for you
i know thats why i wrote help me w that
@bot.event
async def on_voice_state_update(member,before,after):
if before.channel is None and after.channel.id == <id>:
channelNew=await member.guild.create_voice_channel("<channelname>" , overwrites = <dictionary of permissions>)
await move_to(member,channelNew)
idk if its right
im new to python
We can, it's just discouraged
ill try it! Thanks!
np
is immoral 
if you're using interaction, you can find the attributes by doing print(dir(interaction)) or look through docs to get started
No, it's still not correct
Before channel doesn't need to be None, bcs the user might decide to join from another vc
some people ask so vague/incomplete though and only way to help is write the whole thing it feels like
or tell them to read docs which is unhelpful
Spoonfeeding a whole command to a beginner is worst than actually giving them directions, you can give pseudo code but not one that they may continue using without any idea how it may work
thank you
from what i know it should work.. But is there a way to check if a vc is empty for 3 minutes it deletes it?
It's a good cause but causes more problems
what would i change it to?
Just remove the expression
hm yea
That's what he wants a user connects to a vc to get a private one
we can give the some clues
by giving them the solution? what are they learning, syntax?
Yeah but I imagine there's only one channel which has that special function, perhaps hes in a general vc and then wants to join the special one xd
yea
Let's no hate xen, it's his own choice xD
how would i check if they were in a vc before hand?
like if anyone from anywhere joins the vc it still makes the channel
I'm not hating on him, I'm just giving him alternatives that may help a user further than giving him the solution
if the @slate swan really wants to learn programming then he'll realize the importance of self learning
That's not learning programing, more like python and the process of coding and also programming
the problem with self learning now is that a ton of info has been taken away from forums and is shoved into discord servers tho
still pretty possible with discord.py though
because if you put it on forums, it gets outdated pretty quickly
Exactly, and if he really wants learn it, he'll know he wont learn shit with current asking
as for help servers, you'll get the up-to-date answer all the time
if before.channel != after.channel.id == <id>: ?
no, that can't be
would that fix it?
Try it bro
that condition isn't even possible in Python...

you should use and
where or how
well, first condition AND second condition
Doesnt really seem he has regrets on what hes been given or any interest in learning about python
!e
x = True
y = False
z = False
try:
if x != y == z:
print("asdfsad")
except:
print("doesn't work")
@dull terrace :white_check_mark: Your 3.11 eval job has completed with return code 0.
asdfsad
yep
it really feels like that shouldn't work
Why the try-except block?
@primal token
It's just expressions i wouldnt doubt python cant parse that order, which it doesnt have any trouble
!d discord.VoiceChannel.set_permissions
await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sets the channel specific permission overwrites for a target in the channel.
The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that belongs to guild.
The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.
If the `overwrite` parameter is `None`, then the permission overwrites are deleted.
You must have [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") to do this...
question
Is there a way for my bot to generate a vc invite?
Sorry, but what is VC invites?
a generate discord server invite thats default channel is the vc
but i think i got it
!d discord.VoiceChannel.create_invite - is this what you wanted?
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") to do this.

yes you are a genius
Print the embed dict after modifying and send here
No
The embed dict which ur changing
to_d
Bruh just print to_d
okay so i successed about changing to it to the one who tapped the button but im getting troubles to do that only one role can tap the button and if you tap the button it doesnt change the message its changing the button to claim by interaction.user
You could've just add new field by using "add_field"
Ur printing this after adding the field?
The add_field also do changes to embed..
They aren't rlly adding new field tho
They just editing the second field
Well, you could use .fields and get the field from there
And set the edited field by using set_field_at 
Sure but that edits internal dict anyways and doesn't make it more readable
It subjective ig
:))
You do to_d[1]["fields"]...
Print to_d after that
And see if it has the contents u want in the edited embed

How would i make it so if a voice channel is vacant for 5 minutes it deletes the channel?
like that new private channel should be deleted after 5 mins of being empty
@slate swan
yea
alr wait
Code
@bot.command()
async def incrypt_setup(ctx):
incrypt_role = 1024617513054650448
incrypt_overrides = {
ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False, connect=False),
incrypt_role: discord.PermissionOverwrite(read_messages=True, send_messages=True)
}
incrypt_main = await ctx.guild.create_category("Incrypt-X", overwrites=incrypt_overrides)
incrypt_general = await ctx.guild.create_text_channel("General", overwrites=incrypt_overrides, category=incrypt_main)
incrypt_announcements = await ctx.guild.create_text_channel("Announcements", overwrites=incrypt_overrides, category=incrypt_main)
incrypt_cmds = await ctx.guild.create_text_channel("Bot Commands", overwrites=incrypt_overrides, category=incrypt_main)
await ctx.send (f"Channels for Incrypt-X has been created \n {incrypt_general.id} {incrypt_announcements.id} {incrypt_cmds.id}")
error
Traceback (most recent call last):
File "E:\Python projects\CSI\venv\lib\site-packages\discord\ext\commands\core.py", line 190, in wrapped
ret = await coro(*args, **kwargs)
File "E:\Python projects\CSI\main.py", line 82, in incrypt_setup
incrypt_main = await ctx.guild.create_category("Incrypt-X", overwrites=incrypt_overrides)
File "E:\Python projects\CSI\venv\lib\site-packages\discord\guild.py", line 1545, in create_category
data = await self._create_channel(
File "E:\Python projects\CSI\venv\lib\site-packages\discord\guild.py", line 1197, in _create_channel
payload = {'allow': allow.value, 'deny': deny.value, 'id': target.id}
AttributeError: 'int' object has no attribute 'id'
what does the error even means ??
The overwrite key must be a Role object
define userguess
The incrypt_role is an int object
how do i pass the role object then ?
You have written us6er and not user
Fetch the role or get the role from guild.roles
incrypt_role = ctx.guild.roles(1024617513054650448)
``` like this right
No
um how then ?
!d discord.Guild.get_role
get_role(role_id, /)```
Returns a role with the given ID.
Changed in version 2.0: `role_id` parameter is now positional-only.
🫠
ah alr it works ty
okay so i successed about changing to it to the one who tapped the button but im getting troubles to do that only one role can tap the button and if you tap the button it doesnt change the message its changing the button to claim by interaction.user
@meager chasm
class MyButton(discord.ui.View):
def __init__(self):
super().__init__()
self.value = None
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.edit_message(content=f"Claimed By {interaction.user}")
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error
@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton())
@bot.command()
async def helpme(ctx):
view = MyButton()
await ctx.send("Hello", view=view)```
got anythin?
now I have a code called round_id = str(round_id) and I want it to write the round id in this code in my bot how can I do it
example .help
When [round_id] is entered, I want the round id we entered to appear at the bottom of the Embed.
async def delete_vc
await asyncio.sleep(5)
await vc.delete()
vacant = {}
async def on_voice_state_update
if not channel.members
vacant[channel.id] = asyncio.create_task(delete_vc(channel))
elif channel.id in vacant
task = vacant.pop(channel.id)
task.cancel()
``` just pseudocode but sometin like dat?
And maybe sometin in delete_vc to pop the task from vacant dict after it is complete
how owuld i repeat that every 5 minutes or so
what i have
https://hastebin.com/ujibajagug.py
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Repeat what every 5 sec or so
Ya so that what this code do
If channel is vacant u make asyncio task that sleeps 5 sec and deletes vc
But if channel get occupied and is in the dict then u cancel the task
So it don't get delete
class MyButton(discord.ui.View):
def __init__(self):
super().__init__()
self.value = None
@discord.ui.button(label="Claim", style=discord.ButtonStyle.grey)
async def my_button(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.response.edit_message(content=f"Claimed By {interaction.user}")
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = 'You have cooldown ! Please use this command again in {:.2f}s'.format(error.retry_after)
await ctx.send(embed)
else:
raise error
@bot.command(aliases=["H"])
@commands.cooldown(1,30,commands.BucketType.user)
async def h(ctx, *,message='No Reason ! ❌'):
check = ctx.author.voice
if check is None:
voice = f'The User Is Not Connected To A Voice ! ❌'
else:
voice = ctx.author.voice.channel.mention
emeb12233 = discord.Embed(title='User:',description=f'{ctx.author.mention} Needs Help ! ',color=0x6c97c5)
emeb12233.add_field(name="Reason:", value=f'{message}', inline = False)
emeb12233.add_field(name="Voice:", value=voice, inline = False)
emeb12233.set_author(icon_url=ctx.author.avatar, name=ctx.author.name + "#" + ctx.author.discriminator,)
emeb12233.set_thumbnail(url=ctx.author.avatar)
await ctx.send("<@&1010395040385876029>", embed=emeb12233, view=MyButton())
@bot.command()
async def helpme(ctx):
view = MyButton()
await ctx.send("Hello", view=view)```
okay so i successed about changing to it to the one who tapped the button but im getting troubles to do that only one role can tap the button and if you tap the button it doesnt change the message its changing the button to claim by interaction.user
If u want only one role to be able to tap da button u can just have if statement that checks if the role is in interaction.user.roles
Or make interaction_check method of View
method_manage.messages


