Reputation: 65
I was trying to do a ghostping command that pings people then deletes the message it (creates a notification but no ping) but when I used .purge
it deleted a lot of messages I just wanted to delete one message and using .delete doesn't work for some reason :P I wanted to also delete the users command so people wont see who ghost pinged.
Here is the code I have tried:
@client.command()
async def ghostping(message, member : discord.Member):
await message.channel.send(f"<@!{member.id}>", delete_after=0)
await message.channel.purge()
Upvotes: 0
Views: 65
Reputation: 94
First you need to define how many msgs you want to delete if its not specified, which should be 5 or so
async def ping(ctx,member: discord.Member,amt):
for i in range(int(amt)):
await ctx.send(f"{member.mention}")
await ctx.channel.purge(limit=int(amt)+1)
here i didnt state a default amount, but you can just add in ur own default amount using this method
async def clear(ctx,amount=5):
await ctx.channel.purge(limit=amount)
Upvotes: 1