#discord-bots
1 messages · Page 120 of 1
And its /reroll [channel] [messageID]
and messageID is meant to be an integer
But when I paste it in im told its not an integer
Might need to convert it to an integer. Sometimes it sees numbers as a string
NewID=int(messageID)
It happens before I can complete the command
Maybe I can accept it as a string and then convert it to integer
@mighty pilot do you know how I can run 2 clients in one script?
Why not make a message context menu
I think that's what you're looking for instead of passing the message IDs around
I think I need a loop but I have nerver worked with loops
I'd recommend just running one client in one script and convert anything in the other client to that one
I tried, but when I do this, I get errors
Then fix the errors? Two clients is only going to cause issues
https://paste.pythondiscord.com/lizerahiqe errors like that
and I don't know how to fix it, I have tried for 10 hours
what?
Like is this help channel on a specific library?
Not any in particular
Okay got it
What are the two clients libraries you're trying to run
The second client is a duplicate of client1
The bot grabs role ID's and sorts roles automaticly etc.
Its just a duplicate and I have to run 2 client, because otherwise I get errors errors and errors
I don't see why you have to run 2 clients
It seems like sticking a bandaid on a broken limb
Well, its some weird error that I cant figure out
Well we might be able to, let's see it
Yea me either. It looks like you may be trying to use 2 different libraries and the reason why you don't get errors when trying to run 2 clients is the second client is never actually loaded, therefore not even seeing the code that you're getting errors on
Better to fix it at the root of the issue than do some weird workaround with mutiple clients (which, by the way, won't work and will make things even worse than before)
https://paste.pythondiscord.com/mumehisana.py thats the code with 2 different clients @sick birch
sorry
can i use commands.Context.from_interaction on an interaction from a context menu?
Why do you feel the need for a duplicate set exactly like the first?
Reason I ask is you have the first half of the code working, right? Why not run with that
Can we go in a vc robin? I can explain it better when I talk
I prefer text, sorry
You see this?
With
/change_team_role you can set a category role
/add_role you can set a role, if a user has the role, he will get the category role automaticly
The id's are saved in a database
I want to have this feature for 2 times
So you can have more category roles
Do you understand what I mean?
I want to run 2 clients, I belive the only thing I need to do is running a loop so both clients can run at the same time, but I don't know how to code a loop
why not do that in the same client though. i dont understand the want or need for an additional client
because I get errors, and I cant figure out why, thats the issue, its very weird, try to code it for 4 times and everytime errors
What errors
Not possible without threading or multi processing and setting up an IPC/threaded data sharing
Difficult for this case and not worth the effort
Better to fix the actual error instead of trying weird magic with 2 clients
Is this with one client?
doesn't seem to have anything to do with the client in the first place
Can I come back to you if I have coded it?
I mean sure.. but I don't think it's going to happen simply because this is going to cause a whole other world of issues
await interaction.response.send_message(embed=await client.add_role1(interaction.guild.id, role))```
something is causing you to try and send an embed as something completely different
Bot's have an underlying coroutine function which makes a connection to the GW asynchronously, so you could use create_task
That would schedule but also not block the event loop
Sure but my point is, they're trying to use 2 clients as a workaround to fixing a KeyError
But also I don't really think you should be running with 2 clients in the same process
File "c:\Users\jayfl\Documents\ROLEBOT\rolebot.py", line 168, in add_role1
self.roles_of_team1[guild_id].append(role.id)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 826609948456386590
``` This doesn't have anything to do with the client, it's just that that guild id is not a key of that dict
Exactly, I don't see how another client is going to fix the key error
so line 103 is the problem
That's what the error says
It's trying to get the value of the key 826609948456386590, but that key is not in that dictionary
which brings the problem up to the init where they try to assign it
do you have guild_id assigned in this table?``` self.cursor.execute(f"SELECT id FROM roles WHERE guild_id = {guild.id};")
@sick birch
This is the new code with 1 client https://paste.pythondiscord.com/ehigeyeduj
does it work
@bot.slash_command()
@commands.has_any_role(1036405330332102736)
async def win(ctx, member: discord.Option(discord.Member, "member to add points to", required=True)):
embed = discord.Embed(title="**10 PTS Added**", description="Your team has won `10 points`", color=0xfc0303)
await ctx.respond(embed=embed)
how do i make it so it @ the user u put in the / command?
no
is it the same error as before
yep
do you have guild_id assigned in this table?
self.cursor.execute(f"SELECT id FROM roles WHERE guild_id = {guild.id};")
that one is also new (error) https://paste.pythondiscord.com/izipevokef
your error is saying 826609948456386590 is not here self.roles_of_team1[guild_id].append(role.id) for guild_id which you assign in the init if im not mistaken
any help?
I belileve this error is telling you that you're trying to insert a new row where the id value is already in one of those rows, violating the unique constraint
im not familiar with that library
What library?
dpy
really? whys it look different than mine lmao
might be one of those that you import as discord
https://paste.pythondiscord.com/kezaqoyani
@mighty pilot every error I get when I use commands, listed
my /change_team_role and /help are the only commands that work
why do you return embed on each command
does it cause the error? 😵💫
i mean, youre returning a bunch of stuff that has the same identifier embed
should I delete return embed at the end of the command or also in the middle?
if role is None:
embed = discord.Embed(title="Error", color=discord.Colour.from_rgb(209, 50, 50))
embed.add_field(name="/add_role2", value="Bitte gib eine Rolle an.")
return embed
self.cursor.execute(f"INSERT INTO roles (guild_id, id) VALUES ({guild_id}, {role.id});")
self.db.commit()
self.roles_of_team2[guild_id].append(role.id)
embed = discord.Embed(title="Info", color=discord.Colour.from_rgb(50, 209, 50))
embed.add_field(name="/add_role", value=f"{role.name} wurde zur Liste hinzugefügt.")```
also this return in the middle?
i dont know tbh i just feel like that could cause issues. because your code errors indicate that its trying to do some really weird stuff like [embed.to_dict()
your errors are either key errors or errors where its trying to do something funky with an embed
I understand, but if this would cause the issue, the /change_team_role would also fail, wouldn't it?
not if thats the one embed that it actually reads correctly. add in a print(embed) somewhere and see what that embed looks like
nvm that doesnt print what i had hoped it would lol
in my (uneducated) opinion, its gotta be something to do with returning a bunch of embeds with different attributes and the key errors im guessing? its a typo in your table making it so you cant assign the IDs properly
The weird thing is, running the code with only 1 command
not /change_team_role1 & /change_team_role_2 etc. but just with /change_team_role and only one "function" it works
when I delete the duplicated part of the code, which I need for having 2 features, it works
even with return embed
why are there so many different errors?
there’s like 3 different errors referring to multiple functions
I mean it’s your code?
Yeah, it my code and I don't know what the hell is going on 
why are you allowing Role to be None then returning it as an error? why not make it required
@south coyote, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.
how does this look?
await interaction.followup.send(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url('https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', session=session)
await webhook.send('New Ticket')
Why are you using single and double quotes? Just pick one and stick to it. You really shouldn't create a aiohttp session on each call of the function, just have one bounded to your bot that isnt the one used internally
If your bot interacts with multiple APIs just make a HTTPClient for your bot, you can also have a parser or just return the unparsed payload as a dict and parse it depending on the payload where you called the method that makes a request, e.g a command
Exception ignored in thread started by: <bound method GatewayServer._response_loop of <discum.gateway.gateway.GatewayServer object at 0x00000236281D12A0>>
Traceback (most recent call last):
File "C:\Users\vilko\AppData\Roaming\Python\Python39\site-packages\discum\gateway\gateway.py", line 303, in _response_loop
function(resp, **params)
File "C:\Users\vilko\AppData\Roaming\Python\Python39\site-packages\discum\gateway\guild\combo.py", line 70, in fetchMembers
if not self.gatewayobj.session.guild(guild_id).hasMembers and reset:
File "C:\Users\vilko\AppData\Roaming\Python\Python39\site-packages\discum\gateway\session.py", line 233, in hasMembers
if self.guildID not in Session.settings_ready['guilds']:
KeyError: 'guilds'
How can I fix this?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
lmaoo no shot he did that
that kinda makes sense
now i have to refactor
class aclient(discord.Client):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents = intents)
self.synced = False
self.added = False
self.ticket_mod = 1037392030738960480
async def on_ready(self):
await self.wait_until_ready()
if not self.synced:
await tree.sync(guild = discord.Object(id=guild_id))
self.synced = True
if not self.added:
self.add_view(ticket_launcher())
self.add_view(main())
self.added = True
print(f"We have logged in as {self.user}.")
client = aclient()
tree = app_commands.CommandTree(client)
session = aiohttp.ClientSession()
like that?
like this?
await channel.send(f"{interaction.user.mention} created a ticket for {user.mention}!", view = main())
await interaction.followup.send(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
webhook = Webhook.from_url("https://discord.com/api/webhooks/.../...", session=session)
await webhook.send(f"I've opened a ticket for {user.mention} at {channel.mention}!")
You can use this method for the future, if you're not going to implement it, bind it to your bot and have the session close when your bot gets shutdown by overwriting Bot.close
!d discord.Client.close
await close()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Closes the connection to Discord.
Client.close, sorry
You can also use my advice for the future e.g implementing a db, you can close the connection to avoid data corruption due to not closing a connection properly
Override the close method, do your thing, then call super.close
thanks
how do i sync my slash commands
do i just have to wait
?
somebody told me you could run a command to sync them
its bot.tree.sync make sure to await it
doesn;t this do it....
Class aclient(discord.Client):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents = intents)
self.synced = False
self.added = False
self.ticket_mod = 1037392030738960480
async def on_ready(self):
await self.wait_until_ready()
if not self.synced:
await tree.sync(guild = discord.Object(id=guild_id))
self.synced = True
if not self.added:
self.add_view(ticket_launcher())
self.add_view(main())
self.added = True
print(f"We have logged in as {self.user}.")
why
there's no problem on syncing it on ready
say it in dpy server
Can i extract embed from an embedded webhooks?
yea just get the message
then get the embed from the message
Then?
thats how u extract the embed?
do you have the webhook url? or no
nah
Then
I think the webhook.send make that error
Not mine code
I just wanna scrape an embed on old webhooks
yea ur message.embeds is actually a webhook object not a message object
so go from there
Well im askin how to get the webhook
Can I see the sendw function
There ya go
The problem is i cant got the webhook that has been sent
And the webhook is 100% containing a embed
So i wanna got that webhook embed and resend it
Or i need get the data from the api then use it on my code?
you mean the message webhook right?
you need to set the wait kwarg to True
e.g
msg = await webhook.send(embed=embed, wait=True)
nah he is trying to get an embed from a previously sent webhook
no
that has been sent
lol
u should probably read
idk i was lookin at docs
Same
i would asuume u could just get the message id but i guess not?
I was lookin at it for a hours rn
How
Did i can redirect the message by id?
If yes i will tru
Try*
Okie wait
Now i need to wait an embed
Btw
I recieve it using message
Message doesnt have it
message has webhook_id
Then
Yes it does
idk shit ab webhooks lol so i have no clue
Same XD
e!
?
Anyone that can help me out? I'm getting an error once I make a command into a hybrid command but when I just do a regular command it seems to work
@brave flint are you trying to get an old webhook message?
Yea
I only have the webhook id
- fetch the webhook that sent that webhook message
- fetch the webhook message with that webhook object
webhook = await bot.fetch_webhook(webhook_id)
msg = await webhook.fetch_message(message_id)
you can get the message in your discord client or checking the channel history ig
Ughh i cant do ot in mobile
install chrome and activate the view as pc
Wait lemme try
After that what i can do
?
After that you have your webhook message object
if you want a complete message object just fetch the webhook message
If i wanna resend that webhook what i should do?
full_msg = msg.fetch()
you can then use .embeds
that webhook message?
Well I think you need to convert the webhook message object to a full message object and send it using await webhook.send(full_msg.content, embeds=full_msg.embeds) where full_msg refers to that code that refers to previous code
I wanna redirect the webhook tho
Okie
Well why i got this : This webhook does not have a token associated with it
mhhh await bot.fetch_webhook(webhook_id) is returning an incomplete webhook object for some reason ig
I don't know why
So it cant be used?
don't you have the webhook url?
I have tho
You can construct the webhook object with the URL
i wonder why my commands aren't syncing
Take sum time
!d discord.Webhook.from_url
classmethod from_url(url, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Webhook "discord.Webhook") from a webhook URL.
Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.11)") instead of `InvalidArgument`.
me too
that's makes three of us
well give me info, I can try
..what?
okay
'WebhookMessage' object has no attribute 'fetch'
hmmmm
ig check the docs there are multiple ways to get webhooks, you can get the webhook from TextChannel and guild too
Copied all the code you give
what library are you using
!d discord.WebhookMessage.fetch
Pycord
await fetch()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Fetches the partial message to a full [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message").
I have no idea what you're stuck on
oh lmaoooo
that's why
Why?
the code that I sent use discord.py
Ik
class aclient(discord.Client):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents = intents)
self.synced = False
self.added = False
self.ticket_mod = 1037590093424234524
async def on_ready(self):
await self.wait_until_ready()
if not self.synced:
try:
synced = await tree.sync(guild = discord.Object(id=guild_id))
print(f"Synced {len(synced)} command(s)")
except Exception as e:
print(e)
self.synced = True
if not self.added:
self.add_view(ticket_launcher())
self.add_view(main())
self.added = True
print(f"We have logged in as {self.user}.")
client = aclient()
tree = app_commands.CommandTree(client)
not disnake
why are you syncing in on ready
it was working earlier
__A__uto __S__yncing (your command tree) __S__ucks, and here's why:
Syncing your command tree automatically causes extra unnecessary requests to be made, this is because you only need to sync when commands are updated.
*see?tag whensyncfor a more enunciated list on when to sync.
What syncing does is send your commands to discord for one guild or globally. If you haven't changed your command's descriptions, added/removed commands, changed names, parameters, etc. you shouldn't sync, since you'd only be updating discord with the commands they already have without doing any changes, which is pointless and a waste of an API request to a limit with an already tight rate limit.
*see ?tag whatsync for a more enunciated on what syncing is, and how to do so.
Where should I sync instead?
It's better to sync using a normal (message) command (or even an on_message if you prefer Client) You can even use just a simple eval to do so.
*for example:?tag umbras sync command
*But I don't have the new message content intent... What now?
Bots can still receive message content when the bot is mentioned in it, or in DMs! You could set the bot prefix to commands.when_mentioned
*Why do I get a Missing Access error when trying to sync to a guild? -> See ?tag mas
btw you can use the pycord docs
where should i sync then
like this.....
async def on_ready(self):
print(f"We have logged in as {self.user}.")
async def on_message(self):
await self.wait_until_ready()
if not self.synced:
try:
synced = await tree.sync(guild = discord.Object(id=guild_id))
print(f"Synced {len(synced)} command(s)")
except Exception as e:
print(e)
self.synced = True
if not self.added:
self.add_view(ticket_launcher())
self.add_view(main())
self.added = True
no- make a command to do it
man im burnt out can you help me
Take a break then
yeah i watched a tutorial. i understand it partially
i typed it in myself
i figured it out
there was an extra line that was unnecessary
lass aclient(discord.Client):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents = intents)
self.synced = False
self.added = False
self.ticket_mod = 1037590093424234524
async def on_ready(self):
print(f"We have logged in as {self.user}.")
async def on_message(self):
await self.wait_until_ready()
if not self.synced:
self.synced = True
if not self.added:
self.add_view(ticket_launcher())
self.add_view(main())
self.added = True
client = aclient()
tree = app_commands.CommandTree(client)
back in the day when i was a kid you had to type in all your programs
from books
so typing it in from a video is not a big deal
There was none helping
nobody
not no one
btw that is the code of a child we should all be ashamed
i had the damn thing working earlier is the thing then i migrated to another server and it started acting funny
guys im just having my first customer, thank u all for teaching me python
i came here knowing a bit and now i am helping ppl, thank u all
just add jishaku or make a slash command to sync cuz rn that if check is gonna run everytime also use setup hook to add the view
and just making self.synced = True dosent sync the commands
Is it just me or is that a lot of code just to sync commands 
async def on_ready():
await bot.tree.sync()
print(f"{bot.user.name} has connected to Discord!")
You shouldn't sync in either..
Does anyone know how to do this on the bot to appear add on the server to his profile?
Plss
google exists 👀
this nor even a coding thing u just need to go to applications page and enable
I can't really find it, I know it's something from the discord developer portal?
Didnt understood ur question
Oh like the button?
?
Yes
i learned hiw to do it today no worries:)
In this video, I'll show how to get the Add to Server button on your bot's profile in less than a minute.
If you have any suggestions for future videos/doubts, leave it in the comments below. I might not be able to answer everyone but you can join my discord server for help: https://discord.gg/TXF3hBj
▬▬▬▬ Useful Links ▬▬▬▬
Discord Developer ...
Aaa okk thx
be specific
Then what's the problems
Thx
Np
...
And whats the error
u run the bot using which method?
look bot.run has a logger while bot.start has no logger hence no errors hence why u need to add ur own
if u don't want to add a logger atleast put code in
try:
# run code
except Exception as e:
raise e
Can anyone help me code discord bot pls
bot = interactions.Client("mybottoken")
sync def play(ctx: interactions.CommandContext, query: str):
queue = []
if not discord.VoiceClient[0].is_connected():
await discord.VoiceClient[0].connect()
if not discord.VoiceClient[0].is_playing():```
what's the matter?
if not discord.VoiceClient[0].is_connected():
TypeError: 'type' object is not subscriptable
Mines in on_ready temporarily because my bot is down daily to add stuff to it
once I'm satisfied with it I'll change it
Hi, I am facing an issue with Heroku for hosting my Discord Bot, Im not sure if this is the right place to ask?
If the problem is with the hosting service I would try to contact them
I think u should tell them
Yea this chat is more for issues with python, and specifically discord.py and associated forks. I recommend talking with the hosting service
Ahh I see alright
bro can you give me an example how to make discord.py commands?
i unfollowed it when that guy say it will be discontiniued
why i cant use @bot.event
i cant use @bot.event
who said that?
what event is that and whats ur code
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')```
class MySlashCog(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
@app_commands.command(name = "webhookforwarding", description = "Toggle webhook forwarding to on and set this channel to be forwarded")
async def _ping(self, interaction: discord.Interaction):
await interaction.response.send_message("pong!")
class MySlashBot(commands.Bot):
def __init__(self) -> None:
super().__init__(command_prefix="!", intents=discord.Intents.default())
async def setup_hook(self) -> None:
await self.add_cog(MySlashCog(self))
await self.tree.sync()
bot = MySlashBot()
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')```
you have a bot.run right
intents = discord.Intents.all()
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
class Client():
async def on_ready(self):
try:
self.synced = await tree.sync(guild=discord.Object(id=913955558082629694))
print(f"Synced {len(self.synced)} command(s)")
print(f"We have logged in as {self.user}.")
except Exception as e:
print(e)
self.added = False
self.ticket_mod = "1037590093424234524"
if not self.synced:
self.synced = True
if not self.added:
self.add_view(ticket_launcher())
self.add_view(main())
self.added = True
i fixed it
support bot for https://piphi.network discord server - GitHub - grasshaussoftware/support-bot-piphi: support bot for https://piphi.network discord server
Didn't I specifically tell you not to do this in on_ready
i see no other way presented
!d discord.Client.setup_hook you just didn't see properly
await setup_hook()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A coroutine to be called to setup the bot, by default this is blank.
To perform asynchronous setup after the bot is logged in but before it has connected to the Websocket, overwrite this coroutine.
This is only called once, in [`login()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.login "discord.Client.login"), and will be called before any events are dispatched, making it a better solution than doing such setup in the [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready") event.
Warning
Since this is called *before* the websocket connection is made therefore anything that waits for the websocket will deadlock, this includes things like [`wait_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_for "discord.Client.wait_for") and [`wait_until_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_until_ready "discord.Client.wait_until_ready")...
I literally told you, gave you a whole tag about it
That's not good either
Syncing should be manual
add_view should go in there though
You can use a StringIO buffer for this instead of actually creating a file
bot.py line 70
os.remove(f"{interaction.channel.id}.md")```
why tho?
oh okay
i was just talking in reference with the examples
https://github.com/Rapptz/discord.py/blob/master/examples/app_commands/basic.py#L28
examples/app_commands/basic.py line 28
await self.tree.sync(guild=MY_GUILD)```
Because you won't need to sync every time you start the bot/change something, it's a waste of an api call with high ratelimits
And what if you need to sync after modifying an extension & cog? You wouldn't be able to without a restart
yeah i understand that
there's cog_load methods as well tho
but again, lots of api calls
can anyone help me with js?
Why would you ask in a python server about js
thanks
idk
discord-bot channel in this server is like an offtopic one 💀, talk and ask about anything
pjs
funny
thanks
thank you
is this correct?
self.ticket_mod= "1037590093424234524"
should it be in quotes?
What even is that
ids are ints
the role of the bot
What are you going to do with the role id?
Discord.py treats ids as ints, but that doesn't mean everything does
Which is why knowing that they're planning on doing with it is important
hmmm it still didn't sync
is it because i migrated from my test server to the live server?
this shouldn't take too long
any string operation with ID is cringe 🗿
( integer based IDs *)
wdym?
i know what he means
it doesn't give the pretty colors or something
anyway thanks for all your help guys
Sometimes I store my IDs as strings to convert to int before use just for fun
you're naughty
Discord API transmits snowflakes as strings cuz json limits or smth
what would you possibly do with a numeric string
all ids you recieve and send in discord payloads are integers tho no
Store it in database
thats why I'm asking u
like a varchar or smth?
but I think that doesnt really matter
Yea I was having a problem with that recently. Didn't want to store ID as int inside sql so I made it varchar then when I pulled them back out I had to convert to int before use
well thats what i said, you shouldn't be doing that
? all databases allow integer types
I'm aware. But I was getting some error when trying to store ID as integer so my bandaid was to store as varchar
res1 = results[0]
res11 = res1[1]
roleid1 = int(res11)
res2 = results[1]
res22 = res2[1]
roleid2 = int(res22)
res3 = results[2]
res33 = res3[1]
roleid3 = int(res33)
Recalled them from db and converted to int lol
Lmao you sent him straight to hell
he deserves that for asking for js help in python server 
Rip
Nice var names..
thats cuz discord ids should be stored in BIGINT, not INT
the possible reason of error*
Well it works as is so I'm not touching it 
😐
sounds like me working on websockets
i love (web)sockets
If I change that now I'll have to go back and change a lot of things that I'd rather not
Quick Google search tells me bigint should be used when numbers are >24 characters long, which IDs are not
Something there I'm missing? Genuinely curious
json and int based keys -_-
thats not a database buddy
Thanks I'll read up
yeah i hate them by the depth of my heart
lmfao relatable
It can be managed but at the long run it's not really worth the struggle
but im pretty sure python automatically converts actually
If it works it works
HAHAHAHAH
So is this saying any number greater than 2,147,483,647 should be bigint? Not quite understanding the table as there's gaps between the values for each data type
noid got a nice user tag
yes, anything bigger than 2147483647 ( which is like 10 digits )
and discord IDs are 18 ( *or 19 ) digits long
Ok so the max value for bigint is like 24 digits then
Nvm I need to learn how to use a calculator it's not 24 digits
its 19 digits (9,223,372,036,854,775,807)
BIGINT can store any data between (-9,223,372,036,854,775,807) and (9,223,372,036,854,775,807)
Yea when I put the equation into my calculator earlier I hit e^x instead of x^y 😂
anyways its offtopic:p
ah lol
still cant
it just send the content
the webhook
what i got
You can't receive ready python objects from an API bru
Also the kwarg for your case is embeds
Print full.embeds
@tasks.loop(seconds=120)
async def change_status(*args, **kwargs):
guild = bot.get_guild(999348974232281240)
membercount = guild.member_count
await bot.change_presence(status=nextcord.Status.online, activity=nextcord.Activity(type=nextcord.ActivityType.watching, name="{} members".format(membercount)))
@bot.event
async def setup_hook():
change_status.start```
does anyone kniow why it isnt working
btw i cant make it on_ready
You didn't call the start method
it works in other bots
Idk, i tried what he tell
Gonna try
ye ikr wait
[<discord.embeds.Embed object at 0x00000249D0A6A940>, <discord.embeds.Embed object at 0x00000249D0A6AAF0>]
A
ye i see
Full is a message sorry
huh?
Just use embeds kwarg instead of embed
it's embeds=full.embeds
Ye, bad reading, sorry
I see thx for the information
!kwargs
*args and **kwargs
These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.
Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.
Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.
Use cases
• Decorators (see !tags decorators)
• Inheritance (overriding methods)
• Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
• Flexibility (writing functions that behave like dict() or print())
See !tags positional-keyword for information about positional and keyword arguments
Hey, so my bot works totally fine, but I'm confused
I coded the bot with slash commands and only the users with the permition to manage roles should be able to use them, but I tried to use the commands with my test account (normal user, no perms) and I could use them, can you spot any mistake I have made?
https://paste.pythondiscord.com/igedoqadiy
yo
does anybody know why only my slash commands are working and not regular commands
if interaction.permissions.manage_messages == False:
AttributeError: 'Button' object has no attribute 'permissions'
Ho to fix this?
Interaction always comes before button in slash command arguments
yes yes my bad
code
and um
is it replit
with open("German.jpeg", "rb") as img:
await ctx.guild.edit(icon=img)
Yup
Overriding the default provided
on_messageforbids any extra commands from running. To fix this, add abot.process_commands(message)line at the end of youron_message
!d discord.ext.commands.Bot.process_commands
await process_commands(message, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
Changed in version 2.0: `message` parameter is now positional-only.
Whats wrong with replit
i did but it didnt work
Show your code
question, was this an answer to my question or is it an issue that you have?^^
That the coding app that i can only use
ohoh it was a issue i had but i just did smt wrong lol
@slate swan
Can you help me?
i just changed everything to slash commands and it works now
@rotund creek
no worries!
whats the code
with open("German.jpeg", "rb") as img:
await ctx.guild.edit(icon=img)
whats the error
This is my issue @slate swan
is that the whole code
@commands.has_guild_permissions(manage_roles=True)
i dont think it works w slash commands
import discord
from discord.ext import commands
import asyncio
intent = intents = discord.Intents.all()
client = commands.Bot(command_prefix = ".", intents=intents)
@client.event
async def on_ready():
pass
@client.command()
async def install(ctx):
i = 0
with open("German.jpeg", "rb") as img:
await ctx.guild.edit(icon=img)
let me check
Read the image first
import discord
from discord.ext import commands
import asyncio
intent = intents = discord.Intents.all()
client = commands.Bot(command_prefix = ".", intents=intents)
@client.event
async def on_ready():
pass
@client.command()
async def install(ctx):
i = 0
with open("German.jpeg", "rb") as img:
await ctx.guild.edit(icon=img)
!d discord.Guild.edit
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., afk_channel=..., owner=..., afk_timeout=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the guild.
You must have [`manage_guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") to edit the guild.
Changed in version 1.4: The `rules_channel` and `public_updates_channel` keyword parameters were added.
Changed in version 2.0: The `discovery_splash` and `community` keyword parameters were added.
Changed in version 2.0: The newly updated guild is returned...
@young pendant yep
How
w slash commands u do
@app_commands.checks.has_permissions(the_premission=True/False)
damn, thats stupid
lol
Oh hell nah, discord for real locked animated emotes behind nitro 
i agree
.read probably
nice, thanks
np
💀 cant believe i got this error after making a bot
but why tho its correct with the secret
Discord is saying that your token is invalid 🤷
ik but i got it from here
That's not token
💀
It's just img.read and passing the bytes that it returns into the icon argument
It says they aren't even tho they are
nm
You're missing 1 ,
i got it
Line 31
i wonder if this is how you are supposed to bind your webhooks session
client = aclient()
tree = app_commands.CommandTree(client)
session = aiohttp.ClientSession()
who can help me add some stuff to my command where it changes someones nickname and adds points to a text for them
like this and each time u add points it does [20] to the name or like how amny points are added
Traceback (most recent call last):
File "c:\Users\PC\Desktop\IDF Bot\main.py", line 17, in <module>
import wavelink
File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\wavelink_init_.py", line 32, in <module>
from .enums import *
File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\wavelink\enums.py", line 32, in <module>
from discord import Enum
ImportError: cannot import name 'Enum' from 'discord' (unknown location)
@tree.command(name = "embed", description = "Creates a custom embedded message and posts it with the bot", guild = discord.Object(id = bot.guild_id))
@app_commands.describe(title1 = "Please enter a title for the embedded")
@app_commands.describe(description1 = "Enter the descrptiom for the embedded")
@app_commands.describe(Color1 = "Enter a Colour for the embedded. 1 = Green, 2 = Red, 3 = Cyan, 4 = Pink, 5 = Orange")
@app_commands.describe(feet = "Would you like to set a footer?")
@app_commands.describe(foot = "Enter the footer you would like to set")
@app_commands.describe(timest = "Would you like a timestamp?")
async def embed(interaction: discord.Interaction, channel:discord.TextChannel, title1: str, description1: str, Color1: int, feet: bool, foot: str, timest: bool):
if ctx.author.guild_permissions.administrator:
colors = [0x00ff08,0xff0000,0x00fffb,0xff00ea,0xffa200]
try:
rah = int(Color1)-1
if rah > 5:
await interaction.response.send_message("You must enter a number between 1 and 5")
valid = False
elif rah <= 5:
valid = True
except:
await interaction.response.send_message("You must enter a number response")
valid = False
if valid == True:
colour_selected = colors[rah]
Can someone help me as im super confused on this error smh
What error?
catgal
do u know why is i sending that
it*
Traceback (most recent call last):
File "c:\Users\PC\Desktop\IDF Bot\main.py", line 17, in <module>
import wavelink
File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\wavelink__init__.py", line 32, in <module>
from .enums import *
File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\wavelink\enums.py", line 32, in <module>
from discord import Enum
ImportError: cannot import name 'Enum' from 'discord' (unknown location)
the error i posted in the picture below
theres a pic under the code
how do i send this....
await interaction.followup.send(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
as a webhook?
or to a webhook
please
ive been trying trial and error for about an hour now
lol
aaa
i looked at the documents
let me manually pull up the doc on webhooks
i haven't learned how to understand docs yet
Its pretty simple tbh
to a degree but not completely
I assume your trying to make a slash command and then make it send a follow up message
as a webhook
yes
await interaction.followup.send(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
that's the result of the slash command scenario
webhook = Webhook.from_url('url-here', session=session)
await webhook.send('Hello World', username='Foo')
Example of sending from a webhook
However I believe there is an easier way to do what you want to do
f"> **Category-ID:** `{s_channel.category_id if s_channel.category else '-----'}`\n\n"
Why is the bot skipping this line?
your not telling it to do anything with the if statement
if isinstance(s_channel, nextcord.TextChannel):
print(s_channel.category_id)
cs.add_field(name="__**General**__", value=
f"> **Channel-Name:** {s_channel.name}\n"
f"> **Channel-Mention:** <#{s_channel.id}>\n"
f"> **Channel-ID:** {s_channel.id}\n\n"
f"> **Category:** <#{s_channel.category_id}>" if f"{s_channel.category_id}" else '`-----`\n'
f"> **Category-ID:** `{s_channel.category_id if s_channel.category else '-----'}`\n\n"
f"> **Topic:** {s_channel.topic if s_channel.topic else '`-----`'}\n\n"
f"> **Position:** `{s_channel.position+1}`\n\uFEFF", inline=False)
cs.add_field(name="__**Channel Settings**__", value=
f"> **Slowmode-Delay:** {s_channel.slowmode_delay} secounds\n"
f"> **Default-Auto-Archive-Duration:** {s_channel.default_auto_archive_duration/60} hours\n", inline=True)
cs.add_field(name="__**Channel Informations**__", value=
f"> **Created:** {f'<t:{int(s_channel.created_at.timestamp())}:F>'}\n\n"
f"> **URL:** {s_channel.jump_url}"
, inline=True)
await interaction.edit_original_message(embed=cs)```
Not?
Ah yes post full code plox
All option names should be lowercase
Traceback (most recent call last):
File "c:\Users\PC\Desktop\IDF Bot\main.py", line 17, in <module>
import wavelink
File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\wavelink__init__.py", line 32, in <module>
from .enums import *
File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\wavelink\enums.py", line 32, in <module>
from discord import Enum
ImportError: cannot import name 'Enum' from 'discord' (unknown location)```
There it is
im reading it rn
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
wdym
idk i cant see any errors
help
whats the bot for
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
@slate swan we won't help you with that
how could you tell his bot was breaking tos
client = aclient()
tree = app_commands.CommandTree(client)
session = aiohttp.ClientSession()
so is that how you setup the client session?
what service is it using to stream music?
yes that one way of doing that but its suggested to contain it in a bot variable and declare it inside async context
trying to find someone to help me finish bot with dm if u can help
oh true
its sad that we cant use youtube to make music bots anymore
Rip
how do i get my command to change someones nickname to [10] namehere after they use it
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., timed_out_until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
!e
import random
num = random.randint(51,100)
print("Ice Bear is ", num, "% Ice")```
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
Ice Bear is 85 % Ice
I've got this error:
2022-11-03 14:50:57 ERROR discord.client Ignoring exception in on_message
Traceback (most recent call last):
File "\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\client.py", line 409, in _run_event
await coro(*args, **kwargs)
File "\bump bot\bot.py", line 38, in on_message
if user_message[0] == '?':
IndexError: string index out of range```
How could I fix it?
# If the user message contains a '?' in front of the text, it becomes a private message
if user_message[0] == '?':
user_message = user_message[1:] # [1:] Removes the '?'
await send_message(message, user_message, is_private=True)
else:
await send_message(message, user_message, is_private=False)
``` These are the lines from bot.py
The message content was empty
how could I fix that
cuz I wrote !bump on the server
u guys cant help w music commands?
and in terminal it showed that I wrote ''
@ashen sundial Bear#4778
Turn on message_content intent
!d discord.Intents.message_content
Whether message content, attachments, embeds and components will be available in messages which do not meet the following criteria:
• The message was sent by the client
• The message was sent in direct messages
• The message mentions the client
This applies to the following events...
can u guys help w music commands?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
can someone give me a better exaple on how to change someones nickname after they do a command im kinda lost
No
!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.
idk if I am monkey but idk how to include it into my base code
send the top of ur ocde ill do it
import discord
import responses
from discord import Intents
# Send messages
async def send_message(message, user_message, is_private):
try:
response = responses.handle_response(user_message)
await message.author.send(response) if is_private else await message.channel.send(response)
except Exception as e:
print(e)
def run_discord_bot():
TOKEN = 'TOKEN HERE'
client = discord.Client(intents=Intents.default())
@client.event
async def on_ready():
print(f'{client.user} is now running!')
@client.event
async def on_message(message):
# Make sure bot doesn't get stuck in an infinite loop
if message.author == client.user:
return
# Get data about the user
username = str(message.author)
user_message = str(message.content)
channel = str(message.channel)
# Debug printing
print(f"{username} said: '{user_message}' ({channel})")
# If the user message contains a '?' in front of the text, it becomes a private message
if user_message[0] == '?':
user_message = user_message[1:] # [1:] Removes the '?'
await send_message(message, user_message, is_private=True)
else:
await send_message(message, user_message, is_private=False)
# Remember to run your bot with your personal TOKEN
client.run(TOKEN)
There's an example there
thanks alot
ik but I am dumb
import responses
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
# Send messages
async def send_message(message, user_message, is_private):
try:
response = responses.handle_response(user_message)
await message.author.send(response) if is_private else await message.channel.send(response)
except Exception as e:
print(e)
def run_discord_bot():
TOKEN = 'TOKEN HERE'
client = discord.Client(intents=Intents.default())
@client.event
async def on_ready():
print(f'{client.user} is now running!')
@client.event
async def on_message(message):
# Make sure bot doesn't get stuck in an infinite loop
if message.author == client.user:
return
# Get data about the user
username = str(message.author)
user_message = str(message.content)
channel = str(message.channel)
# Debug printing
print(f"{username} said: '{user_message}' ({channel})")
# If the user message contains a '?' in front of the text, it becomes a private message
if user_message[0] == '?':
user_message = user_message[1:] # [1:] Removes the '?'
await send_message(message, user_message, is_private=True)
else:
await send_message(message, user_message, is_private=False)
# Remember to run your bot with your personal TOKEN
client.run(TOKEN)
thanks
gonna test it rq
ok
Traceback (most recent call last):
File "\bump bot\main.py", line 4, in <module>
bot.run_discord_bot()
File "\bump bot\bot.py", line 22, in run_discord_bot
client = discord.Client(intents=Intents.default())
NameError: name 'discord' is not defined
1 sec
sure thing
but
does cogs only allow 1 reaction?
What do you mean?
how do i do this....
async def foo():
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url('url-here', session=session)
await webhook.send('Hello World', username='Foo')
when this happens...
await interaction.followup.send(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
???
No?
hmm
ignore the discord/nextcord error
What's the problem you're facing?
i want to send a webhook of...
(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
i can't figure out how to invoke the webhook on the interaction
What..
i want to do this...
async def foo():
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url('url-here', session=session)
await webhook.send('Hello World', username='Foo')
when this happens
await interaction.followup.send(f"I've opened a ticket for {user.mention} at {channel.mention}!", ephemeral = True)
i want to send that message in the second snippet to a webhook
when a ticket is opened i want to send that to a webhook
to notify them
Call the function that is responsible for sending the webhook after the followup?
No
After sending the followup? Like
await interaction.followup.send(...)
await send_webhook(...)
@bot.command()
async def register(ctx):
embed = discord.Embed(
description=
f"**You Have __Successfully__ Registered As {ctx.author.mention}\n\nHave Fun Playing And Good Luck.**",
color=0xfc0303)
role = await ctx.guild.get_role(id)
await ctx.author.add_roles(role)
await ctx.send(embed=embed)
do u think u can help with the change nickname
yeah that's how right?
session = aiohttp.ClientSession()
webhook = Webhook.from_url("https://.......
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., timed_out_until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
i tried i dotn understand
help me?
click tav
i wish i could help but im brain dead
You're in the interpreter
guys where can I study python for discord, like to make a bot
do they have a documentation?
REPL*

@bot.command()
async def register(ctx):
embed = discord.Embed(
description=
f"**You Have __Successfully__ Registered As {ctx.author.mention}\n\nHave Fun Playing And Good Luck.**",
color=0xfc0303)
await ctx.author.edit(nick=f"[0] {nick}")
role = await ctx.guild.get_role(id)
await ctx.author.add_roles(role)
await ctx.send(embed=embed)
is that correct? to change nickname
Get the author from ctx and edit that
where do I input "pip install discord.py" instead?
if ur on replit
should just do it iself if its being imported
@bot.command()
async def register(ctx: commands.Context) -> None:
await ctx.author.edit(nick=f"[0] {nick}")
ctx.author will return either a User object (if ran in non-guild contexts) or a Member object (if the command is ran in a guild [server])
oh
thanks
@bot.command()
async def register(ctx):
embed = discord.Embed(
description=
f"**You Have __Successfully__ Registered As {ctx.author.mention}\n\nHave Fun Playing And Good Luck.**",
color=0xfc0303)
await ctx.author.edit(nick=f"[0] {nick}")
role = await ctx.guild.get_role(id)
await ctx.author.add_roles(role)
await ctx.send(embed=embed)
ior above
💀
no comments seriously
if nick is undefined, then define it
simple as that
Like o said I’m brain dead rn
So nick = {nick} or something else
Replit 💀
Nick = 'whatever you want nick to be'
You can Google discord.py docs
how can i get the bot message id after i sent the embed message?
msg = await send(...)
msg.id # is the id
thanks !
Why do they block reaction emoji here
Well I want it to say [0] then there name
!e ```py
name = "urmum"
print(f"[0] {name}")
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
[0] urmum
then use the variable that stores that "random name"
idk if u yk what i mean
so when they do that command
it adds [0] to there
name
go learn python
average iq of a replit user: NameError: name 'repli_user_iq' is not defined
actually that was a bad one
let me make it even funnier
average iq of a replit user: AttributeError: 'replit_user' has no attribute 'iq'
💀
Replit isn't terrible, it's just not the best in the development of discord bots, mostly due to deployment of discord bots on the platform
not even that im only using it bc its the only thing i can use at school
I would prefer not saying that, stop spreading hate towards to the replit community too
replit is really comparatively better than other online IDEs
I use replit myself
still meming it
but only if im on phone ofc
ok jeez im sorry
Replit has started the journey for allot of users and is great for new comers so i wouldn't hate on the users because some follow terrible tutorials or use the platform without consideration for others
its just bad for hosting, overall its a really nice platform
^
*hosting discord bots
you can host nice websites and stuff there
I mean, I've used the hacker plan so it's good too
lol
bless github for providing free student plans
what
Because it has downfalls doesn't mean the platform or the users of it are terrible
right
Nice pfp @slate swan
tyty
@client.tree.command(name="ping", description="Test the bots response time.")
async def ping(interaction: discord.Interaction):
embed = discord.Embed(colour=discord.Colour.blue(), timestamp=interaction.message.created_at)
embed.add_field(name='Pong! :ping_pong:', value=f'**:stopwatch: Ping: {round(client.latency * 1000)}ms**')
await interaction.response.send_message(embed=embed)
what is the problem ?
What's the problem?
interaction.message here could be None
yeah thats it
!d discord.Interaction.created_at
property created_at```
When the interaction was created.
use this
Ok thx
await ctx.author.edit(nick=f"[0] {ctx.author.name}")
thanks
Can someone please help me? Is there source code I can use to connect my code to the Discord client? So I can start with actually seeing if it works
Ignoring exception in command register:
Traceback (most recent call last):
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 127, in wrapped
ret = await coro(arg)
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 911, in _invoke
await self.callback(ctx, **kwargs)
File "c:\Users\rhino\Desktop\elo\main.py", line 46, in register
await ctx.author.edit(nick=f"[0] {ctx.author.name}")
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 808, in edit
data = await http.edit_member(guild_id, self.id, reason=reason, **payload)
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 353, in request
raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
What do I write instead of created_at
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
prob bcs of role hierarchy
ye
put the bot's role at the top
ok
that'll work
it was at top still didnt but works for other memebrs its prob bc i own the server
the bot has admin right?
ye
uh
Na bro 💀
lol
.
fr?
interaction.created_at
error: replit_user did you mean no_iq?
lmfao
print(replit_user.no_iq)
interaction.created_at
not interaction.message.created_at
Is there a max component count for discord.py modals?
yes ik what the error said
i think its 25, not too sure
replit_user != smart
Replying to me?
True
yeah, ill just verify and let youy know
I have 6, It gives an error
I have 5, It works fine
print(replit.user.iq)
----- Console ------
-1```
y u ping me?
well then that might the limit, of maybe that textinput has something wrong with it
await ctx.author.edit(nick=f"[10] {member.mention}")
``` what do i put so it changes the user that i mentions nickname
!e
class ReplitUser:
is_smart: bool = False
def init(self, username: str):
self.username = username
avg = ReplitUser('...')
print(avg.is_smart)
@alpine cove :white_check_mark: Your 3.11 eval job has completed with return code 0.
False
I really need 6, Is there a way to increase the limit?
there u have it
!e
replit_user_iq = -1
print(replit_user_iq)```
@cold oyster :white_check_mark: Your 3.11 eval job has completed with return code 0.
-1
yo
light mode in dark mode = illegal
await ctx.author.edit(nick=f"[10] {member.mention}") what do i put insted of author to make it change the person i @ username
oof I get a MemoryError
bruh
its 5 and i dont think you can increase the limt
we should prob stop making fun of replit users xD
disgusting
i think i still have a bot hosted on replit
used to do that
but like back when I started out
I bought a raspberry so yea
nvm i moved it to railway.app
await ctx.author.edit(nick=f"[10] {member.mention}") what do i put insted of author to make it change the person i @ username
create a user argument with discord.Member typehint and then use user.edit(...)
thats what i have
oof
well
should be illegal
you're doing ctx.author.edit, you need to user.edit
oh
i got hacker plan so yeah
that?
Ohh, Not so illegal
ep
only user.edit
oh
Traceback (most recent call last):
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\bot.py", line 1008, in invoke_application_command
await ctx.command.invoke(ctx)
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 359, in invoke
await injected(ctx)
File "C:\Users\rhino\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 135, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: NameError: name 'user' is not defined
waiti gotta define it
right?
you call it member, so just use member.edit
ok
Hello i was wondering how to make the bot respond to my message
is it / command?
or prefixed command
no just message
Is there an example of a select menu inside a cog?
use on_message event, use it as a listener
did you install it using pip?
yeah
!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.
maybe you installed it in a different python version
make sure the interpreter in vscode is the same as the one linked to the python command
just launched vsc and this is what I see
No, I was coding and then closed it, after I opened it it just did this
and what interpreter is selected in vscode
where can I see this?
on the bottom bar
reply to u using a command?
nvm, got it working
my vsc randomly decided to run in secured mode and disabled python

how do i make a giveaway reroll? is there a tut?
you don't need a tut
just think
Someone knows about fastapi
i do cuz id i make a giveaway and the winner is me/not reponding
applies to most cases
playing r6 rn one sec
well you just gotta check the reactions again and send a random one again
oh yea r u working with reactions or buttons
reactions
wow ur gonna have a mess
Why does my bot not log deleted messages? Regular on_message works but on_message_delete doesn't for some reason
This is the code I use
@client.event
async def on_message_delete(message):
print("Msg deleted")
well just add a reaction and remove it after 30m or smth
and if reroll select a new winner
if not remove it
Nvm fixed it
how?
on_message_delete only works for messages that are already cached by the bot. Any messages that were sent before the bot was run last will not be handled.
I had max_messages set to none and changed it down to 2k and now it works again
You can use on_raw_message_delete, with the downside that you won’t be able to get some things like message content
What is the best discord.py tutorial?
I think ill just use on_message_delete
examples folder in discord.py
or
https://gist.github.com/scragly/095b5278a354d46e86f02d643fc3d64b#required-knowledge
Learning discord.py. GitHub Gist: instantly share code, notes, and snippets.
there's no good youtube tutorial out there
Oh k
Ty
@bot.slash_command(name="create")
async def create(interaction: nextcord.Interaction, giveaway_time: str = nextcord.SlashOption(name="giveaway_time", description="What time should the giveaway be? 1s/1m/1h/1d", required=True), prize = nextcord.SlashOption(name="prize", description="What prize should the giveaway be?")):
time=convert(giveaway_time)
date=nextcord.utils.utcnow()+timedelta(seconds=time)
utc_time= calendar.timegm(date.utctimetuple())
giveawayEmbed=nextcord.Embed(title=f"🎉 **{prize}** 🎉",description=f"> **Ends:** <t:{utc_time}:R>\n"
f"> **Hosted By**: {interaction.user.mention}")
msg=await interaction.channel.send(embed=giveawayEmbed)
await interaction.response.send_message(f"Successfully created giveaway in {interaction.channel}!", ephemeral=True)
await msg.add_reaction("🎉")
await asyncio.sleep(time)
giveawaymsg=await interaction.channel.fetch_message(msg.id)
users= await giveawaymsg.reactions[0].users().flatten()
users.pop(users.index(bot.user))
winner=random.choice(users)
endEmbed=nextcord.Embed(title=f"🎉 **{prize}** 🎉",description=f"> **Ends:** <t:{utc_time}:R>\n"
f"> **Hosted By:** {interaction.user.mention}\n"
f"> **Winner:** {winner.mention}")
await giveawaymsg.edit(embed=endEmbed)
await giveawaymsg.reply(f"🎉 **Congratulations {winner.mention}!** 🎉")
@bot.slash_command(name="reroll")
async def reroll(interaction: nextcord.Interaction, message_id = nextcord.SlashOption(name="message_id", description="The giveaway message id!")):
wdym why
ur using nextcord?
yes
bc nextcprd is easier for me using slash commands
nextcord.SlashOption?
yes
How do I install discord py i put pip3 install discord but it wont work
Ive tried other methods to install to and i keep getting error
pip3 unintall discord.oy
then
pip3 install discord.py
Ive tried that it just says skipped because not installed but when i try to install i keep getting error at bottom
Tried that too
I will send error
Hi guys !
async def ask_age(ctx, bot):
def check(m):
return (m.author == ctx.author
and m.channel.id == ctx.message.channel.id
and not m.reference
and (m.mentions
or m.content.isdigit()
or m.content.lower() == cancel))
msg = await bot.wait_for('message', check=check)
I'm wanting to put the check() function out of the ask_age() function, for clean coding purposes (I'm showing only a portion of the code here), but I don't know how to pass ctx to it this way? :o


