|
19 | 19 | import globals |
20 | 20 | import itertools |
21 | 21 | import miru |
| 22 | +import logging |
22 | 23 |
|
23 | 24 | baseSettings = Settings() |
24 | 25 | component = tanjun.Component() |
25 | 26 | moderationGroup = tanjun.slash_command_group("zmod", "commands only moderators can use").add_check(StaticMethods.isPermission) |
26 | 27 | moderationGroupY = tanjun.slash_command_group("ymod", "commands only moderators can use").add_check(StaticMethods.isPermission ) |
| 28 | +logger = logging.getLogger(__name__) |
| 29 | +logger.setLevel(baseSettings.SASSBOT_LOG_LEVEL) |
27 | 30 |
|
28 | 31 | @tanjun.with_str_slash_option("prefix", "prefix of the emote you want to check") |
29 | 32 | @tanjun.with_int_slash_option("days", "number of days to look back", default=30) |
@@ -211,12 +214,16 @@ async def ConnectKickAccount(ctx: miru.ViewContext) -> None: |
211 | 214 |
|
212 | 215 | @CommandLogger |
213 | 216 | async def BanAppeal(ctx: miru.ViewContext) -> None: |
214 | | - view = MiruViews.AppealModalView(autodefer=False) |
215 | | - await ctx.respond("Pre-type your ban appeal and then hit the submit button when you are ready to submit it.\n Button will time out after a few mins, so re-push button if it doesn't work", components=view, flags=hikari.MessageFlag.EPHEMERAL) |
216 | | - message = await ctx.get_last_response() |
217 | | - await view.start(message) |
218 | | - await view.wait() |
219 | | - await ctx.interaction.delete_initial_response() |
| 217 | + if baseSettings.MOD_ROLE_ID and baseSettings.APPEAL_CHANNEL_ID: |
| 218 | + view = MiruViews.AppealModalView(autodefer=False) |
| 219 | + await ctx.respond("Pre-type your ban appeal and then hit the submit button when you are ready to submit it.\n Button will time out after a few mins, so re-push button if it doesn't work", components=view, flags=hikari.MessageFlag.EPHEMERAL) |
| 220 | + message = await ctx.get_last_response() |
| 221 | + await view.start(message) |
| 222 | + await view.wait() |
| 223 | + await ctx.interaction.delete_initial_response() |
| 224 | + else: |
| 225 | + await ctx.respond("Can't do that. Command isn't set up correctly. Tell an admin/mod", flags=hikari.MessageFlag.EPHEMERAL) |
| 226 | + logger.warning("BanAppeal can't be used. MOD_ROLE_ID and APPEAL_CHANNEL_ID not set") |
220 | 227 |
|
221 | 228 | @moderationGroupY.as_sub_command("appeal-review", "View appeals that need to be reviewd for approval or denial",default_to_ephemeral= True, always_defer= True) |
222 | 229 | @CommandLogger |
@@ -280,17 +287,23 @@ async def confessReview(ctx: tanjun.abc.SlashContext, rest: alluka.Injected[hika |
280 | 287 | @component.with_slash_command |
281 | 288 | @tanjun.as_slash_command("confess", "Anonymously post a confession or question to the confessions channel.", always_defer= True, default_to_ephemeral= True) |
282 | 289 | async def confess(ctx: tanjun.abc.SlashContext) -> None: |
283 | | - content = "Pre-type your Confession/Question and then hit the submit button when you are ready to submit it.\n Button will time out after a few mins, so re-type command if it doesn't work" |
284 | | - view = MiruViews.ConfessionModalView(autodefer=False) |
285 | | - if isinstance(ctx, tanjun.abc.SlashContext): |
286 | | - await ctx.respond(content=content, components=view) |
| 290 | + if baseSettings.CONFESSTION_CHANNEL_ID: |
| 291 | + content = "Pre-type your Confession/Question and then hit the submit button when you are ready to submit it.\n Button will time out after a few mins, so re-type command if it doesn't work" |
| 292 | + view = MiruViews.ConfessionModalView(autodefer=False) |
| 293 | + if isinstance(ctx, tanjun.abc.SlashContext): |
| 294 | + await ctx.respond(content=content, components=view) |
| 295 | + else: |
| 296 | + await ctx.respond(content=content, components=view, flags = hikari.MessageFlag.EPHEMERAL) |
| 297 | + message = await ctx.fetch_last_response() if isinstance(ctx, tanjun.abc.SlashContext) else await ctx.get_last_response() |
| 298 | + await view.start(message) |
| 299 | + await view.wait() |
| 300 | + await ctx.interaction.delete_initial_response() |
287 | 301 | else: |
288 | | - await ctx.respond(content=content, components=view, flags = hikari.MessageFlag.EPHEMERAL) |
289 | | - message = await ctx.fetch_last_response() if isinstance(ctx, tanjun.abc.SlashContext) else await ctx.get_last_response() |
290 | | - await view.start(message) |
291 | | - await view.wait() |
292 | | - await ctx.interaction.delete_initial_response() |
293 | | - |
| 302 | + logger.warning("CONFESS can't be uesed. CONFESSION_CHANNEL_ID not yet") |
| 303 | + if isinstance(ctx, tanjun.abc.SlashContext): |
| 304 | + await ctx.respond("Can't do that. Command isn't set up correctly. Tell admin/mod") |
| 305 | + else: |
| 306 | + await ctx.respond("Can't do that. Command isn't set up correctly. Tell admin/mod", flags = hikari.MessageFlag.EPHEMERAL) |
294 | 307 | @tanjun.with_bool_slash_option("rerunannounce","True if you want rerun pings False if not") |
295 | 308 | @moderationGroup.as_sub_command("announce-rerun-toggle", "Toggle whether or not the bot will announce reruns", default_to_ephemeral=True, always_defer=True) |
296 | 309 | @CommandLogger |
|
0 commit comments