1

Sooo Python Discord.py,

I have this embed:

embed = discord.Embed(title = atc_info['callsign'] + ' has just connected!', color = 0xffffff)

embed.set_footer(text = 'something goes here')

return embed

It works fine, but I would like to assign it an ID based on a field returned in the API call. So if a certain condition happens the bot makes an API call, grabs that ID and delete the embed with assigned that ID. Is there any way to do that? (I just need the ID assignment, not also the API call and stuff)

Thanks a lot!

  • If by "custom ID", you don't mean [`message.id`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message.id) or [`message.webhook_id`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message.webhook_id) or [`message.jump_url`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message.jump_url), you can probably encrypt these IDs, provided by discord.py, and use them instead, as you'll then have "custom IDs". – The Amateur Coder Jun 24 '22 at 17:15
  • Wait, so you haven't tried `message.id`? – The Amateur Coder Jun 24 '22 at 17:26
  • I thought that message.id was the discord message id so something like this '989931782017277962' which I belive is something I cannot edit – Filippo Genoni Jun 24 '22 at 17:33
  • Yes, you can't edit it; it's stored in Discord's databases, but you obviously can, on your own databases/PC, change these into other unique values. For example, `id = message.id your_encoding = str.maketrans( 'ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz', 'NOPQRSTUVWXYZnopqrs9uvwx16HIABDCFEGKJMLbACBEP328&0YI') '989931782017277962'.translate(your_encoding)`. See https://stackoverflow.com/a/3269756/16136190. – The Amateur Coder Jun 24 '22 at 17:44
  • You can do something like `message.id ^ 2144927757761289083` (that number can be anything random) and then convert it back using the same expression. Please include some code about your embed making command. (Formatting tip: use code fences ``` or indent by 4 spaces to make the code show up in a code block) – Eric Jin Jun 24 '22 at 21:15

0 Answers0