Add notify
setting, fix settings management
This commit is contained in:
parent
427f4a9cf9
commit
5bb592183e
1 changed files with 33 additions and 37 deletions
|
@ -124,79 +124,75 @@ class SettingsCog(Scale):
|
||||||
await self.update_settings("noinvite", active, ctx.guild.id)
|
await self.update_settings("noinvite", active, ctx.guild.id)
|
||||||
await ctx.send(f"Settings applied. Automatic invite active: {active}")
|
await ctx.send(f"Settings applied. Automatic invite active: {active}")
|
||||||
|
|
||||||
|
@set_.subcommand(sub_cmd_name="notify", sub_cmd_description="Notify users of admin action?")
|
||||||
|
@slash_option(name="active", description="Notify?", opt_type=OptionTypes.BOOLEAN, required=True)
|
||||||
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
|
async def _set_notify(self, ctx: InteractionContext, active: bool) -> None:
|
||||||
|
await ctx.defer()
|
||||||
|
await self.update_settings("notify", active, ctx.guild.id)
|
||||||
|
await ctx.send(f"Settings applied. Notifications active: {active}")
|
||||||
|
|
||||||
# Unset
|
# Unset
|
||||||
@unset.subcommand(
|
@unset.subcommand(
|
||||||
sub_cmd_name="modlog",
|
sub_cmd_name="modlog",
|
||||||
sub_cmd_description="Set Moglod channel",
|
sub_cmd_description="Unset Modlog channel",
|
||||||
)
|
|
||||||
@slash_option(
|
|
||||||
name="channel", description="ModLog Channel", opt_type=OptionTypes.CHANNEL, required=True
|
|
||||||
)
|
)
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _unset_modlog(self, ctx: InteractionContext, channel: GuildText) -> None:
|
async def _unset_modlog(self, ctx: InteractionContext) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await self.delete_settings("modlog", channel.id, ctx.guild.id)
|
await self.delete_settings("modlog")
|
||||||
await ctx.send(f"Setting `{channel.mention}` unset")
|
await ctx.send("Setting `modlog` unset")
|
||||||
|
|
||||||
@unset.subcommand(
|
@unset.subcommand(
|
||||||
sub_cmd_name="activitylog",
|
sub_cmd_name="activitylog",
|
||||||
sub_cmd_description="Set Activitylog channel",
|
sub_cmd_description="Unset Activitylog channel",
|
||||||
)
|
|
||||||
@slash_option(
|
|
||||||
name="channel",
|
|
||||||
description="Activitylog Channel",
|
|
||||||
opt_type=OptionTypes.CHANNEL,
|
|
||||||
required=True,
|
|
||||||
)
|
)
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _unset_activitylog(self, ctx: InteractionContext, channel: GuildText) -> None:
|
async def _unset_activitylog(self, ctx: InteractionContext) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await self.delete_settings("activitylog", channel.id, ctx.guild.id)
|
await self.delete_settings("activitylog")
|
||||||
await ctx.send(f"Setting `{channel.mention}` unset")
|
await ctx.send("Setting `activitylog` unset")
|
||||||
|
|
||||||
@unset.subcommand(sub_cmd_name="massmention", sub_cmd_description="Set massmention output")
|
@unset.subcommand(sub_cmd_name="massmention", sub_cmd_description="Unset massmention output")
|
||||||
@slash_option(
|
|
||||||
name="amount",
|
|
||||||
description="Amount of mentions (0 to disable)",
|
|
||||||
opt_type=OptionTypes.INTEGER,
|
|
||||||
required=True,
|
|
||||||
)
|
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _unset_massmention(self, ctx: InteractionContext, amount: int) -> None:
|
async def _unset_massmention(self, ctx: InteractionContext) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await self.delete_settings("massmention")
|
await self.delete_settings("massmention")
|
||||||
await ctx.send(f"Setting `{amount}` unset")
|
await ctx.send("Setting `massmention` unset")
|
||||||
|
|
||||||
@unset.subcommand(sub_cmd_name="verified", sub_cmd_description="Set verified role")
|
@unset.subcommand(sub_cmd_name="verified", sub_cmd_description="Unset verified role")
|
||||||
@slash_option(
|
@slash_option(
|
||||||
name="role", description="Verified role", opt_type=OptionTypes.ROLE, required=True
|
name="role", description="Verified role", opt_type=OptionTypes.ROLE, required=True
|
||||||
)
|
)
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _unset_verified(self, ctx: InteractionContext, role: Role) -> None:
|
async def _unset_verified(self, ctx: InteractionContext) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await self.delete_settings("verified")
|
await self.delete_settings("verified")
|
||||||
await ctx.send(f"Setting `{role.name} unset`")
|
await ctx.send("Setting `massmention` unset")
|
||||||
|
|
||||||
@unset.subcommand(sub_cmd_name="unverified", sub_cmd_description="Set unverified role")
|
@unset.subcommand(sub_cmd_name="unverified", sub_cmd_description="Unset unverified role")
|
||||||
@slash_option(
|
|
||||||
name="role", description="Unverified role", opt_type=OptionTypes.ROLE, required=True
|
|
||||||
)
|
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _unset_unverified(self, ctx: InteractionContext, role: Role) -> None:
|
async def _unset_unverified(self, ctx: InteractionContext) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await self.delete_settings("unverified")
|
await self.delete_settings("unverified")
|
||||||
await ctx.send(f"Setting `{role.name}` unset")
|
await ctx.send("Setting `unverified` unset")
|
||||||
|
|
||||||
@unset.subcommand(
|
@unset.subcommand(
|
||||||
sub_cmd_name="noinvite", sub_cmd_description="Set if invite deletion should happen"
|
sub_cmd_name="noinvite", sub_cmd_description="Unset if invite deletion should happen"
|
||||||
)
|
)
|
||||||
@slash_option(name="active", description="Active?", opt_type=OptionTypes.BOOLEAN, required=True)
|
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _unset_invitedel(self, ctx: InteractionContext, active: bool) -> None:
|
async def _unset_invitedel(self, ctx: InteractionContext, active: bool) -> None:
|
||||||
await ctx.defer()
|
await ctx.defer()
|
||||||
await self.delete_settings("noinvite")
|
await self.delete_settings("noinvite")
|
||||||
await ctx.send(f"Setting `{active}` unset")
|
await ctx.send(f"Setting `{active}` unset")
|
||||||
|
|
||||||
|
@unset.subcommand(sub_cmd_name="notify", sub_cmd_description="Unset admin action notifications")
|
||||||
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
|
async def _unset_notify(self, ctx: InteractionContext) -> None:
|
||||||
|
await ctx.defer()
|
||||||
|
await self.delete_settings("noinvite")
|
||||||
|
await ctx.send("Setting `notify` unset")
|
||||||
|
|
||||||
@settings.subcommand(sub_cmd_name="view", sub_cmd_description="View settings")
|
@settings.subcommand(sub_cmd_name="view", sub_cmd_description="View settings")
|
||||||
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
@check(admin_or_permissions(Permissions.MANAGE_GUILD))
|
||||||
async def _view(self, ctx: InteractionContext) -> None:
|
async def _view(self, ctx: InteractionContext) -> None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue