Ignore implementation for time being
This commit is contained in:
parent
9647f9c746
commit
e9500d6ce1
1 changed files with 24 additions and 23 deletions
|
@ -1,6 +1,7 @@
|
|||
"""J.A.R.V.I.S. Settings Management Cog."""
|
||||
from typing import Any
|
||||
|
||||
from dis_snek.models.snek.command import check
|
||||
from discord import Role, TextChannel
|
||||
from discord.ext import commands
|
||||
from discord.utils import find
|
||||
|
@ -42,15 +43,15 @@ class SettingsCog(commands.Cog):
|
|||
create_option(
|
||||
name="channel",
|
||||
description="Modlog channel",
|
||||
option_type=7,
|
||||
opt_type=7,
|
||||
required=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _set_modlog(self, ctx: SlashContext, channel: TextChannel) -> None:
|
||||
if not isinstance(channel, TextChannel):
|
||||
await ctx.send("Channel must be a TextChannel", hidden=True)
|
||||
await ctx.send("Channel must be a TextChannel", ephemeral=True)
|
||||
return
|
||||
self.update_settings("modlog", channel.id, ctx.guild.id)
|
||||
await ctx.send(f"Settings applied. New modlog channel is {channel.mention}")
|
||||
|
@ -64,15 +65,15 @@ class SettingsCog(commands.Cog):
|
|||
create_option(
|
||||
name="channel",
|
||||
description="Userlog channel",
|
||||
option_type=7,
|
||||
opt_type=7,
|
||||
required=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _set_userlog(self, ctx: SlashContext, channel: TextChannel) -> None:
|
||||
if not isinstance(channel, TextChannel):
|
||||
await ctx.send("Channel must be a TextChannel", hidden=True)
|
||||
await ctx.send("Channel must be a TextChannel", ephemeral=True)
|
||||
return
|
||||
self.update_settings("userlog", channel.id, ctx.guild.id)
|
||||
await ctx.send(f"Settings applied. New userlog channel is {channel.mention}")
|
||||
|
@ -86,12 +87,12 @@ class SettingsCog(commands.Cog):
|
|||
create_option(
|
||||
name="amount",
|
||||
description="Amount of mentions (0 to disable)",
|
||||
option_type=4,
|
||||
opt_type=4,
|
||||
required=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _set_massmention(self, ctx: SlashContext, amount: int) -> None:
|
||||
await ctx.defer()
|
||||
self.update_settings("massmention", amount, ctx.guild.id)
|
||||
|
@ -106,12 +107,12 @@ class SettingsCog(commands.Cog):
|
|||
create_option(
|
||||
name="role",
|
||||
description="verified role",
|
||||
option_type=8,
|
||||
opt_type=8,
|
||||
required=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _set_verified(self, ctx: SlashContext, role: Role) -> None:
|
||||
await ctx.defer()
|
||||
self.update_settings("verified", role.id, ctx.guild.id)
|
||||
|
@ -126,12 +127,12 @@ class SettingsCog(commands.Cog):
|
|||
create_option(
|
||||
name="role",
|
||||
description="Unverified role",
|
||||
option_type=8,
|
||||
opt_type=8,
|
||||
required=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _set_unverified(self, ctx: SlashContext, role: Role) -> None:
|
||||
await ctx.defer()
|
||||
self.update_settings("unverified", role.id, ctx.guild.id)
|
||||
|
@ -146,12 +147,12 @@ class SettingsCog(commands.Cog):
|
|||
create_option(
|
||||
name="active",
|
||||
description="Active?",
|
||||
option_type=4,
|
||||
opt_type=4,
|
||||
required=True,
|
||||
)
|
||||
],
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _set_invitedel(self, ctx: SlashContext, active: int) -> None:
|
||||
await ctx.defer()
|
||||
self.update_settings("noinvite", bool(active), ctx.guild.id)
|
||||
|
@ -163,7 +164,7 @@ class SettingsCog(commands.Cog):
|
|||
name="modlog",
|
||||
description="Unset modlog channel",
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _unset_modlog(self, ctx: SlashContext) -> None:
|
||||
self.delete_settings("modlog", ctx.guild.id)
|
||||
await ctx.send("Setting removed.")
|
||||
|
@ -174,7 +175,7 @@ class SettingsCog(commands.Cog):
|
|||
name="userlog",
|
||||
description="Unset userlog channel",
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _unset_userlog(self, ctx: SlashContext) -> None:
|
||||
self.delete_settings("userlog", ctx.guild.id)
|
||||
await ctx.send("Setting removed.")
|
||||
|
@ -185,7 +186,7 @@ class SettingsCog(commands.Cog):
|
|||
name="massmention",
|
||||
description="Unet massmention amount",
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _massmention(self, ctx: SlashContext) -> None:
|
||||
await ctx.defer()
|
||||
self.delete_settings("massmention", ctx.guild.id)
|
||||
|
@ -197,7 +198,7 @@ class SettingsCog(commands.Cog):
|
|||
name="verified",
|
||||
description="Unset verified role",
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _verified(self, ctx: SlashContext) -> None:
|
||||
await ctx.defer()
|
||||
self.delete_settings("verified", ctx.guild.id)
|
||||
|
@ -209,14 +210,14 @@ class SettingsCog(commands.Cog):
|
|||
name="unverified",
|
||||
description="Unset unverified role",
|
||||
)
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _unverified(self, ctx: SlashContext) -> None:
|
||||
await ctx.defer()
|
||||
self.delete_settings("unverified", ctx.guild.id)
|
||||
await ctx.send("Setting removed.")
|
||||
|
||||
@cog_ext.cog_subcommand(base="settings", name="view", description="View settings")
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _view(self, ctx: SlashContext) -> None:
|
||||
settings = Setting.objects(guild=ctx.guild.id)
|
||||
|
||||
|
@ -237,7 +238,7 @@ class SettingsCog(commands.Cog):
|
|||
value = "||`[redacted]`||"
|
||||
elif setting.setting == "rolegiver":
|
||||
value = ""
|
||||
for role in setting.value:
|
||||
for _role in setting.value:
|
||||
nvalue = find(lambda x: x.id == value, ctx.guild.roles)
|
||||
if value:
|
||||
value += "\n" + nvalue.mention
|
||||
|
@ -250,7 +251,7 @@ class SettingsCog(commands.Cog):
|
|||
await ctx.send(embed=embed)
|
||||
|
||||
@cog_ext.cog_subcommand(base="settings", name="clear", description="Clear all settings")
|
||||
@admin_or_permissions(manage_guild=True)
|
||||
@check(admin_or_permissions(manage_guild=True))
|
||||
async def _clear(self, ctx: SlashContext) -> None:
|
||||
deleted = Setting.objects(guild=ctx.guild.id).delete()
|
||||
await ctx.send(f"Guild settings cleared: `{deleted is not None}`")
|
||||
|
@ -258,4 +259,4 @@ class SettingsCog(commands.Cog):
|
|||
|
||||
def setup(bot: commands.Bot) -> None:
|
||||
"""Add SettingsCog to J.A.R.V.I.S."""
|
||||
bot.add_cog(SettingsCog(bot))
|
||||
SettingsCog(bot)
|
||||
|
|
Loading…
Add table
Reference in a new issue