From d251d20e9a2ae71d4f1c2203396e1f7c31b177d9 Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sat, 16 Jul 2016 10:56:20 -0500 Subject: [PATCH] Added a command to dynamically add doggo images --- cogs/owner.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cogs/owner.py b/cogs/owner.py index 368ae1d..e09b17a 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -1,8 +1,10 @@ from discord.ext import commands from .utils import config from .utils import checks +import urllib.request import re import os +import glob import sys import discord import inspect @@ -28,7 +30,17 @@ class Owner: await self.bot.say("Restarting; see you in the next life {0}!".format(ctx.message.author.mention)) python = sys.executable os.execl(python, python, *sys.argv) + + @commands.command(pass_context=True) + @commands.check(checks.isOwner) + async def adddoggo(self, ctx, url: str): + """Saves a URL as a image to add for the doggo command""" + os.chdir('/home/phxntx5/public_html/Bonfire/images') + local_path = 'doggo{}.jpg'.format(len(glob.glob('doggo*'))) + urllib.request.urlretrieve(url,local_path) + await self.bot.say("Just saved a new doggo image! You now have {} doggo images!".format(len(glob.glob('doggo*')))) + @commands.command(pass_context=True) @commands.check(checks.isOwner) async def py(self, ctx):