Implement lock
This commit is contained in:
parent
b2a907babf
commit
832524eb56
3 changed files with 46 additions and 1 deletions
|
@ -11,9 +11,18 @@ class Links:
|
|||
|
||||
@commands.command(hidden=True)
|
||||
async def pegaswitch(self, ctx):
|
||||
"""test"""
|
||||
"""Link to the Pegaswitch repo"""
|
||||
await ctx.send("https://github.com/reswitched/pegaswitch")
|
||||
|
||||
@commands.command(hidden=True, aliases=["atmos"])
|
||||
async def Atmosphere(self, ctx):
|
||||
"""Link to the Atmosphere repo"""
|
||||
await ctx.send("https://github.com/atmosphere-nx/atmosphere")
|
||||
|
||||
@commands.command(hidden=True, aliases=["guides"])
|
||||
async def guide(self, ctx):
|
||||
"""Link to the guide(s)"""
|
||||
await ctx.send("*AtlasNX's SDSetup-Guide:* https://guide.teamatlasnx.com \n *Noirscape's Guide:* http://switchguide.xyz/ \n *Pegaswitch Guide:* https://switch.hacks.guide/")
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Links(bot))
|
||||
|
|
31
cogs/lockdown.py
Normal file
31
cogs/lockdown.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import discord
|
||||
import asyncio
|
||||
from discord.ext import commands
|
||||
from config import modlog_channel, staff_role_ids, participant_role, community_channels, general_channels, hacker_role, community_role
|
||||
|
||||
class Lockdown:
|
||||
"Lockdown Commands"
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
@commands.command(pass_context=True)
|
||||
async def lock(self, ctx):
|
||||
"Locks the channel"
|
||||
if ctx.message.channel in community_channels:
|
||||
roles = (hacker_role, community_role)
|
||||
else:
|
||||
roles = participant_role
|
||||
overwrites = ctx.message.channel.overwrites_for(roles[0])
|
||||
if overwrites.send_message == False:
|
||||
await ctx.send("The Channel is already locked!")
|
||||
return
|
||||
overwrites.send_message = False
|
||||
overwrites.add_reactions = False
|
||||
await asyncio.gather(*(self.bot.edit_channel_permissions(ctx.message.channel, role, overwrites) for role in roles))
|
||||
await ctx.send("🔒 Channel locked down. Only staff members may speak. Do not bring the topic to other channels or risk disciplinary actions.")
|
||||
ctx.send_message(modlog_channel, "Channel Lockdown for {channel} by {user}".format(ctx.message.channel.mention, ctx.message.author.mention))
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Lockdown(bot))
|
|
@ -25,3 +25,8 @@ staff_role_ids = [526384077679624192, # Team role in NotSwitched
|
|||
modlog_channel = 526377735908491284 # Log channel in NotSwitched
|
||||
welcome_channel = 526372470752673792 # rules-info channel in NotSwitched
|
||||
participant_role = 526378358129557506 # participant role in NotSwitched
|
||||
community_role = 526378381839695872 # community role in NotSwitched
|
||||
hacker_role = 526471781184176139 # hacker role in NotSwitched
|
||||
|
||||
community_channels = ["526378423468425236"] # All channels only accessable with the community role
|
||||
general_channels = ["526372255052201995"] # All channels everyone can access
|
Loading…
Reference in a new issue