Skip to content

Commit

Permalink
Tests back in passing locally. Travis to come soon tm
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftSpider committed Jul 17, 2018
1 parent eec7d25 commit 4ead4cd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Discord/talos.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ async def get_context(self, message, *, cls=commands.Context):
return ctx

async def mod_log(self, ctx, event, user, message):
"""
Logs a message to a guild's mod log, if Talos is set up to do so
:param ctx: Context object so we can know the guild
:param event: Name of the event being logged
:param user: User who is the target of the event
:param message: The reason or details associated with the action
"""
if not self.database.get_guild_options(ctx.guild.id).mod_log:
return False
if self.should_embed(ctx):
Expand Down Expand Up @@ -363,6 +370,11 @@ async def on_guild_remove(self, guild):
self.database.clean_guild(guild.id)

async def on_member_ban(self, guild, user):
"""
Called upon a member being banned from a guild
:param guild: Guild the user was banned from
:param user: User who was banned
"""
options = self.database.get_guild_options(guild.id)
if not options.mod_log:
return
Expand Down
4 changes: 3 additions & 1 deletion Tests/test_utils/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_talos_user():

def test_guild_options():

test_data = [1, 1, 0, 0, 1, 1, 1, 0, 1, "prompts", "^", "UTC"]
test_data = [1, 1, 0, 0, 1, 1, 1, 0, 1, "prompts", 0, "mod_log", "^", "UTC"]
options = data.GuildOptions(test_data)

assert options.id == 1
Expand All @@ -130,6 +130,8 @@ def test_guild_options():
assert options.joke_commands is False
assert options.writing_prompts is True
assert options.prompts_channel == "prompts"
assert options.mod_log is False
assert options.log_channel == "mod_log"
assert options.prefix == "^"
assert options.timezone == "UTC"

Expand Down

0 comments on commit 4ead4cd

Please sign in to comment.