1
0
Fork 0
mirror of synced 2024-06-03 11:14:33 +12:00

Changed pathing to relative pathing

This commit is contained in:
Phxntxm 2016-08-11 21:13:35 -05:00
parent 96c58d4341
commit 89ca7b0469
2 changed files with 5 additions and 9 deletions

View file

@ -77,8 +77,7 @@ class Core:
async def doggo(self, ctx):
"""Use this to print a random doggo image.
Doggo is love, doggo is life."""
os.chdir('/home/phxntx5/public_html/Bonfire/images')
f = glob.glob('doggo*')[random.randint(0, len(glob.glob('doggo*')) - 1)]
f = glob.glob('images/doggo*')[random.randint(0, len(glob.glob('doggo*')) - 1)]
with open(f, 'rb') as f:
await self.bot.upload(f)
@ -87,8 +86,7 @@ class Core:
async def snek(self, ctx):
"""Use this to print a random snek image.
Sneks are o3o"""
os.chdir('/home/phxntx5/public_html/Bonfire/images')
f = glob.glob('snek*')[random.randint(0, len(glob.glob('snek*')) - 1)]
f = glob.glob('images/snek*')[random.randint(0, len(glob.glob('snek*')) - 1)]
with open(f, 'rb') as f:
await self.bot.upload(f)

View file

@ -32,8 +32,7 @@ class Owner:
@commands.check(checks.isOwner)
async def adddoggo(self, url: str):
"""Saves a URL as an image to add for the doggo command"""
os.chdir('/home/phxntx5/public_html/Bonfire/images')
local_path = 'doggo{}.jpg'.format(len(glob.glob('doggo*')))
local_path = 'images/doggo{}.jpg'.format(len(glob.glob('doggo*')))
with aiohttp.ClientSession() as s:
async with s.get(url) as r:
val = await r.read()
@ -46,8 +45,7 @@ class Owner:
@commands.check(checks.isOwner)
async def addsnek(self, url: str):
"""Saves a URL as an image to add for the snek command"""
os.chdir('/home/phxntx5/public_html/Bonfire/images')
local_path = 'snek{}.jpg'.format(len(glob.glob('snek*')))
local_path = 'images/snek{}.jpg'.format(len(glob.glob('snek*')))
with aiohttp.ClientSession() as s:
async with s.get(url) as r:
val = await r.read()
@ -90,7 +88,7 @@ class Owner:
@commands.check(checks.isOwner)
async def avatar(self, content: str):
"""Changes the avatar for the bot to the filename following the command"""
file = '/home/phxntx5/public_html/bot/images/' + content
file = 'images/' + content
with open(file, 'rb') as fp:
await self.bot.edit_profile(avatar=fp.read())