mod_reswitched: Push

This commit is contained in:
Ave 2020-09-01 10:58:35 +03:00
parent 7cb112cf5a
commit ffb129770d
No known key found for this signature in database
GPG key ID: 398DD7BD03276F6D
2 changed files with 50 additions and 0 deletions

45
cogs/mod_reswitched.py Normal file
View file

@ -0,0 +1,45 @@
import config
from discord.ext import commands
from discord.ext.commands import Cog
from helpers.checks import check_if_staff
class ModReswitched(Cog):
def __init__(self, bot):
self.bot = bot
@commands.guild_only()
@commands.command(aliases=["pingmods", "summonmods"])
async def pingmod(self, ctx):
"""Pings mods, only use when there's an emergency and such."""
can_ping = any(r.id in config.pingmods_allow for r in ctx.author.roles)
if can_ping:
await ctx.send(
f"<@&{config.pingmods_role}>: {ctx.author.mention} needs assistance."
)
else:
await ctx.send(
f"{ctx.author.mention}: You need community to be able to ping the entire staff team, please pick an online staff member, check if they have the mod role, and ping them instead."
)
@commands.guild_only()
@commands.check(check_if_staff)
@commands.command()
async def modtoggle(self, ctx):
"""Toggles your mod role, staff only."""
target_role = ctx.guild.get_role(config.modtoggle_role)
if target_role in ctx.author.roles:
await ctx.author.remove_roles(
target_role, reason="Staff self-unassigned mod role"
)
await ctx.send(f"{ctx.author.mention}: Removed your mod role.")
else:
await ctx.author.add_roles(
target_role, reason="Staff self-assigned mod role"
)
await ctx.send(f"{ctx.author.mention}: Gave you mod role.")
def setup(bot):
bot.add_cog(ModReswitched(bot))

View file

@ -318,3 +318,8 @@ list_channels = []
self_assignable_roles = { self_assignable_roles = {
"streamnotifs": 715158689060880384, "streamnotifs": 715158689060880384,
} }
# == Only if you want to use cogs.mod_reswitched ==
pingmods_allow = [named_roles["community"]] + staff_role_ids
pingmods_role = 360138431524765707
modtoggle_role = 360138431524765707