Skip to content

Instantly share code, notes, and snippets.

@LaBlazer
Created February 23, 2018 17:40
Show Gist options
  • Save LaBlazer/bdf95ff81a94e0ace547a171b9ba9f56 to your computer and use it in GitHub Desktop.
Save LaBlazer/bdf95ff81a94e0ace547a171b9ba9f56 to your computer and use it in GitHub Desktop.
Discord bot that posts a doggo picture
# Pls no stealerino licence
import discord, asyncio, os, random
IMG_FOLDER = "dogs"
BOT_TOKEN = "SECRET"
IMG_MESSAGE = ":dog: :dog: :dog:"
client = discord.Client()
if not os.path.isdir(IMG_FOLDER + "/"):
os.mkdir(IMG_FOLDER + "/")
@client.event
async def on_ready():
print("Made by LBLRZ_")
print("-"*30)
print("Starting doggo bot...")
print("Name: {} ID: {}".format(client.user.name, client.user.id))
print("-"*30)
@client.event
async def on_message(message):
if message.content.startswith('!dog'):
print("User {} requested dog picture, sending...".format(message.author))
await client.delete_message(message)
msg = await client.send_message(message.channel, ":arrows_counterclockwise: Sending...")
await client.send_file(message.channel,
os.path.join(IMG_FOLDER, random.choice([x for x in os.listdir(IMG_FOLDER) if os.path.isfile(os.path.join(IMG_FOLDER, x))])),
content=IMG_MESSAGE)
await client.delete_message(msg)
client.run(BOT_TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment