Created
May 29, 2021 17:17
-
-
Save gfrn/f3eaca70dd7103e63ea68c2363f1f523 to your computer and use it in GitHub Desktop.
Discord bot that relays messages to users anonymously
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import discord | |
from discord.ext import commands | |
import os | |
intents = discord.Intents.default() | |
intents.members = True | |
bot = commands.Bot(command_prefix='$', intents=intents) | |
@bot.command() | |
async def send(ctx, target, msg, signature="anon"): | |
try: | |
user = bot.get_user(int(target)) | |
await user.send(f"{msg}\n~{signature}") | |
await ctx.send(f"Mensagem enviada com sucesso para @{user}!") | |
except (ValueError, TypeError, commands.errors.CommandInvokeError): | |
await ctx.send("Syntax: $send id \"message\" \"signature\" (optional)") | |
bot.run(os.getenv('TOKEN')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment