Python & Embeds

Togls

Developer
Supreme
Feedback score
22
Posts
756
Reactions
143
Resources
10
Really quick thread because I am absolutely clueless, how do I add how many messages where deleted in a purge to an embed?

Like for example I'd want the embed to say:

{amount} of messages where deleted.

At the moment, I have this (it works as well)

@bot.command() #!purge (purge messages)
@commands.has_permissions(manage_messages = True)
async def purge(ctx, amount : int):
await ctx.channel.purge(limit=amount + 1)

embed=discord.Embed(title="Purge Moderation Handler", description="Messages purged!", colour=discord.Colour.red())
embed.set_footer(text="Bot created by Syxro.")
await ctx.channel.send(embed=embed)

If anyone knows, it'd be appreciated :)
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

polarline

Premium
Feedback score
46
Posts
835
Reactions
157
Resources
20
Code:
@bot.command() #!purge (purge messages)
@commands.has_permissions(manage_messages = True)
async def purge(ctx, amount : int):
await ctx.channel.purge(limit=amount + 1)

embed=discord.Embed(title="Purge Moderation Handler", description=str(amount) +  "messages where deleted!", colour=discord.Colour.red())
embed.set_footer(text="Bot created by Syxro.")
await ctx.channel.send(embed=embed)

Let me know if that works
 
Last edited:

Togls

Developer
Supreme
Feedback score
22
Posts
756
Reactions
143
Resources
10
Code:
@bot.command() #!purge (purge messages)
@commands.has_permissions(manage_messages = True)
async def purge(ctx, amount : int):
await ctx.channel.purge(limit=amount + 1)

embed=discord.Embed(title="Purge Moderation Handler", description=str(amount) +  "messages where deleted!", colour=discord.Colour.red())
embed.set_footer(text="Bot created by Syxro.")
await ctx.channel.send(embed=embed)

Let me know if that works


Absolute legend, it worked.
Thank you! <3[DOUBLEPOST=1635383749][/DOUBLEPOST]Another note, polarline
Do you have any suggestions to as where I should host the bot & what platform to use to host it?
I'm not looking to spend a ton of money but I am willing to spend a little bit of cash to host the bot 24/7.
 
Last edited:

polarline

Premium
Feedback score
46
Posts
835
Reactions
157
Resources
20
Absolute legend, it worked.
Thank you! <3[DOUBLEPOST=1635383749][/DOUBLEPOST]Another note, polarline
Do you have any suggestions to as where I should host the bot & what platform to use to host it?
I'm not looking to spend a ton of money but I am willing to spend a little bit of cash to host the bot 24/7.
You can use Heroku, which is free. Another option would be IONOS, which charges $2 per month for a VPS (you would need to setup the VPS). You can also use PebbleHost, which charges $3/month for bot hosting.
 

adamawesome135

Check out Levely.me
Supreme
Feedback score
38
Posts
1,398
Reactions
555
Resources
4
You can also use AWS or Google Clouds free tiers
 
Top