1
0
Fork 0
mirror of synced 2024-06-02 18:54:33 +12:00

Seperation of welcome alerts and default alerts

This commit is contained in:
Phxntxm 2017-06-17 18:03:26 -05:00
parent 0a7cfb42b7
commit d5c49b2347

View file

@ -141,33 +141,37 @@ class Administration:
self.bot.db.save('server_settings', entry) self.bot.db.save('server_settings', entry)
await ctx.send(fmt) await ctx.send(fmt)
@commands.command(aliases=['alerts']) @commands.command(aliases=['notifications'])
@commands.guild_only() @commands.guild_only()
@utils.custom_perms(kick_members=True) @utils.custom_perms(kick_members=True)
async def notifications(self, ctx, channel: discord.TextChannel): async def alerts(self, ctx, channel: discord.TextChannel):
"""This command is used to set a channel as the server's 'notifications' channel """This command is used to set a channel as the server's default 'notifications' channel
Any notifications (like someone going live on Twitch, or Picarto) will go to that channel Any notifications (like someone going live on Twitch, or Picarto) will go to that channel by default
This can be overridden with specific alerts command, such as `!picarto alerts #channel`
This command is just the default; the one used if there is no other one set.
EXAMPLE: !alerts #alerts EXAMPLE: !alerts #alerts
RESULT: No more alerts spammed in #general!""" RESULT: No more alerts spammed in #general!"""
entry = { entry = {
'server_id': str(ctx.message.guild.id), 'server_id': str(ctx.message.guild.id),
'notifications_channel': str(channel.id) 'notifications': {
'default': str(channel.id)
}
} }
self.bot.db.save('server_settings', entry) self.bot.db.save('server_settings', entry)
await ctx.send("I have just changed this server's 'notifications' channel" await ctx.send("I have just changed this server's default 'notifications' channel"
"\nAll notifications will now go to `{}`".format(channel)) "\nAll notifications will now default to `{}`".format(channel))
@commands.command() @commands.group(invoke_without_command=True)
@commands.guild_only() @commands.guild_only()
@utils.custom_perms(kick_members=True) @utils.custom_perms(kick_members=True)
async def usernotify(self, ctx, on_off: str): async def welcome(self, ctx, on_off: str):
"""This command can be used to set whether or not you want user notificaitons to show """This command can be used to set whether or not you want user notificaitons to show
Provide on, yes, or true to set it on; otherwise it will be turned off Provide on, yes, or true to set it on; otherwise it will be turned off
EXAMPLE: !usernotify on EXAMPLE: !welcome on
RESULT: Annying join/leave notifications! Yay!""" RESULT: Annoying join/leave notifications! Yay!"""
# Join/Leave notifications can be kept separate from normal alerts # Join/Leave notifications can be kept separate from normal alerts
# So we base this channel on it's own and not from alerts # So we base this channel on it's own and not from alerts
# When mod logging becomes available, that will be kept to it's own channel if wanted as well # When mod logging becomes available, that will be kept to it's own channel if wanted as well
@ -182,6 +186,25 @@ class Administration:
fmt = "notify" if on_off else "not notify" fmt = "notify" if on_off else "not notify"
await ctx.send("This server will now {} if someone has joined or left".format(fmt)) await ctx.send("This server will now {} if someone has joined or left".format(fmt))
@welcome.command(name='alerts', aliases=['notifications'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def _welcome_alerts(self, ctx, *, channel: discord.TextChannel):
"""A command used to set the override for notifications about users joining/leaving
EXAMPLE: !welcome alerts #notifications
RESULT: All user joins/leaves will be sent to the #notificatoins channel"""
entry = {
'server_id': str(ctx.message.guild.id),
'notifications': {
'welcome': str(channel.id)
}
}
self.bot.db.save('server_settings', entry)
await ctx.send("I have just changed this server's welcome/goodbye notifications channel to {}".format(channel.name))
@commands.group() @commands.group()
async def nsfw(self, ctx): async def nsfw(self, ctx):
"""Handles adding or removing a channel as a nsfw channel""" """Handles adding or removing a channel as a nsfw channel"""