import discord
@client.event
async def on_message(message):
response = await message.channel.send("Hello")
# Deletes the message the user sent
await message.delete()
# Deletes the responding message
await response.delete()
async def on_message(self,message):
channel = bot.get_channel(channel_id)
if message.content.startswith("!clear",):
messages = await channel.history(limit=anynumber).flatten()
for m in messages:
msg = await channel.fetch_message(m.id)
await msg.delete()
print("done!")
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = ".")
@client.command()
async def clear(ctx):
await ctx.channel.purge()#deletes all messages
Code Example |
---|
:: |
:: |
:: |
Python :: |
:: |
:: |
:: |
:: |
:: |
:: |
Python :: |
:: |
:: |
Javascript :: jquery get second td of tr |
:: |
Javascript :: |
:: |
:: |
:: js extract only numbers from string |
:: |
:: |
:: |
:: |
:: |
Javascript :: |
:: |
:: |
:: |
:: |
:: |