Skip to content
This repository has been archived by the owner on Jul 31, 2018. It is now read-only.

Commit

Permalink
no idea why modlog isnt wokring here, did for #33
Browse files Browse the repository at this point in the history
@verixx or @XAOS1502, if possible please help :(
  • Loading branch information
fourjr committed Nov 14, 2017
1 parent af7127b commit aefdd7a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cogs/mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import pip
import os
import io
import json


class Mod:
Expand All @@ -40,7 +41,7 @@ def __init__(self, bot):

async def format_mod_embed(self, ctx, user, success, method, duration = None, location=None):
'''Helper func to format an embed to prevent extra code'''
emb = discord.Embed()
emb = discord.Embed(timestamp=ctx.message.created_at)
emb.set_author(name=method.title(), icon_url=user.avatar_url)
emb.color = await ctx.get_dominant_color(user.avatar_url)
emb.set_footer(text=f'User ID: {user.id}')
Expand All @@ -60,7 +61,19 @@ async def format_mod_embed(self, ctx, user, success, method, duration = None, lo
emb.description = f"You do not have the permissions to {method} `{location.name}`."
else:
emb.description = f"You do not have the permissions to {method} {user.name}."


with open('data/config.json') as f:
config = json.load(f)
modlog = os.environ.get('MODLOG') or config.get('MODLOG')
if modlog is None:
await ctx.send('You have not set `MODLOG` in your config vars.', delete_after=5)
else:
modlog = discord.utils.get(self.bot.get_all_channels(), id=int(modlog))
if modlog is None:
await ctx.send('Your `MODLOG` channel ID is invalid.', delete_after=5)
else:
await modlog.send(embed=emb)

return emb

@commands.command()
Expand Down

0 comments on commit aefdd7a

Please sign in to comment.