1
0
Fork 0
mirror of synced 2024-06-02 10:44:32 +12:00

Changed notifications settings so that a mod can set a certain channel, for all notifications

This commit is contained in:
Phxntxm 2016-08-11 14:00:24 -05:00
parent dc257e9072
commit d906b46daf
2 changed files with 14 additions and 1 deletions

View file

@ -12,6 +12,15 @@ class Mod:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole(kick_members=True)
async def alerts(self, ctx, channel = discord.Channel)
"""This command is used to set a channel as the server's 'notifications' channel
Any notifications (like someone going live on Twitch, or Picarto) will go to that channel"""
server_alerts = config.getContent('server_alerts') or {}
server_alerts[ctx.message.server.id] = ctx.message.channel.id
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole(kick_members=True)
async def usernotify(self, ctx, on_off:str):

View file

@ -41,8 +41,10 @@ class Picarto:
online = await check_online(user)
if not live and notify and online:
for server_id, channel_id in r['servers'].items():
for server_id in r['servers'].items():
server = self.bot.get_server(server_id)
server_alerts = config.getContent('server_alerts') or {}
channel_id = server_alerts.get(server_id) or server_id
channel = self.bot.get_channel(channel_id)
member = discord.utils.find(lambda m: m.id == m_id, server.members)
@ -53,6 +55,8 @@ class Picarto:
elif live and not online:
for server_id, channel_id in r['servers'].items():
server = self.bot.get_server(server_id)
server_alerts = config.getContent('server_alerts') or {}
channel_id = server_alerts.get(server_id) or server_id
channel = self.bot.get_channel(channel_id)
member = discord.utils.find(lambda m: m.id == m_id, server.members)