dank-bot-py/plugins/pepe/plugin.py

21 lines
603 B
Python

# Posts a dank pepe in the chat
from discord.ext import commands
import discord
import random
import os
plugin_folder=os.path.dirname(os.path.realpath(__file__))
pepe_filename=os.path.join(plugin_folder, 'pepes.txt')
@commands.command(name='pepe')
async def send_pepe(ctx):
with open(pepe_filename, 'r') as pepe_file:
pepeLines = pepe_file.readlines()
num_pepes = len(pepeLines)
chosen_pepe = pepeLines[random.randint(0,num_pepes-1)]
await ctx.send(f'{chosen_pepe}')
async def setup(bot):
print("Rare Pepes initialized")
bot.add_command(send_pepe)