Added a command to dynamically add doggo images
This commit is contained in:
parent
2618eebfbc
commit
d251d20e9a
1 changed files with 12 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from .utils import config
|
from .utils import config
|
||||||
from .utils import checks
|
from .utils import checks
|
||||||
|
import urllib.request
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import glob
|
||||||
import sys
|
import sys
|
||||||
import discord
|
import discord
|
||||||
import inspect
|
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))
|
await self.bot.say("Restarting; see you in the next life {0}!".format(ctx.message.author.mention))
|
||||||
python = sys.executable
|
python = sys.executable
|
||||||
os.execl(python, python, *sys.argv)
|
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.command(pass_context=True)
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
async def py(self, ctx):
|
async def py(self, ctx):
|
||||||
|
|
Loading…
Reference in a new issue