Skip to content

Commit 4a7bfdf

Browse files
committed
Implement 'forum' style modmail
1 parent 7b130bc commit 4a7bfdf

File tree

17 files changed

+595
-210
lines changed

17 files changed

+595
-210
lines changed

modmail/backends/common/models/settings_model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class SettingsModel(BaseModel):
1818
"""Settings model for bot configuration.
1919
2020
Attributes:
21-
bot_id: Bot identifier.
21+
bot_id: Bot ID.
2222
last_ran_version: Last version that the bot was run on; None indicates first run.
2323
last_ran_locale: Last locale used when running the bot.
2424
last_slash_synced_version: Last version in which slash commands were synced.
2525
last_slash_minimum_permission_int: Last minimum permission integer for slash commands.
26-
main_category_id: Main category identifier.
27-
fallback_category_id: Fallback category identifier.
28-
log_channel_id: Log channel identifier.
29-
storage_channel_id: Storage channel identifier.
26+
main_category_or_forum_id: Main category or forum ID.
27+
fallback_category_id: Fallback category ID.
28+
log_channel_id: Log channel ID.
29+
storage_channel_id: Storage channel ID.
3030
status: The bot's status.
3131
activity: The bot's activity.
3232
"""
@@ -38,7 +38,7 @@ class SettingsModel(BaseModel):
3838
last_ran_locale: str | None = None # The last locale the bot was run on
3939
last_slash_synced_version: str | None = None # The last version the slash commands were synced on
4040
last_slash_minimum_permission_int: int | None = None # The last minimum permission int for slash commands
41-
main_category_id: int | None = None
41+
main_category_or_forum_id: int | None = None
4242
fallback_category_id: int | None = None
4343
log_channel_id: int | None = None
4444
storage_channel_id: int | None = None

modmail/backends/mongodb/models/settings_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class MongoDBSettingsDocument(Document):
4747
last_ran_locale: The locale setting used during the last run.
4848
last_slash_synced_version: The version when slash commands were last synchronized.
4949
last_slash_minimum_permission_int: The minimum permission integer required for using slash commands.
50-
main_category_id: The ID of the main category for organizing channels.
50+
main_category_or_forum_id: The ID of the main category or forum for organizing channels.
5151
fallback_category_id: The ID of the fallback category used when main is unavailable.
5252
log_channel_id: The ID of the log channel.
5353
storage_channel_id: The ID of the storage channel.
@@ -60,7 +60,7 @@ class MongoDBSettingsDocument(Document):
6060
last_ran_locale: str | None = None # the last locale the bot was run on
6161
last_slash_synced_version: str | None = None # the last version the slash commands were synced on
6262
last_slash_minimum_permission_int: int | None = None # the last minimum permission int for slash commands
63-
main_category_id: int | None = None
63+
main_category_or_forum_id: int | None = None
6464
fallback_category_id: int | None = None
6565
log_channel_id: int | None = None
6666
storage_channel_id: int | None = None

modmail/backends/sql/migrations/versions/ec2d46746dcd_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def upgrade() -> None:
2929
sa.Column("last_ran_locale", sa.String(length=8), nullable=True),
3030
sa.Column("last_slash_synced_version", sa.String(length=32), nullable=True),
3131
sa.Column("last_slash_minimum_permission_int", sa.Integer(), nullable=True),
32-
sa.Column("main_category_id", sa.Integer(), nullable=True),
32+
sa.Column("main_category_or_forum_id", sa.Integer(), nullable=True),
3333
sa.Column("fallback_category_id", sa.Integer(), nullable=True),
3434
sa.Column("log_channel_id", sa.Integer(), nullable=True),
3535
sa.Column("storage_channel_id", sa.Integer(), nullable=True),

modmail/backends/sql/models/settings_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SQLSettingsTable(SQLBase):
3333
last_ran_locale: The locale setting when the bot was last run (max 8 characters).
3434
last_slash_synced_version: The version when slash commands were last synchronized (max 32 characters).
3535
last_slash_minimum_permission_int: The minimum permission level required for slash commands.
36-
main_category_id: The Discord category ID where new tickets are created.
36+
main_category_or_forum_id: The Discord category or forum ID where new tickets are created.
3737
fallback_category_id: The backup Discord category ID for when the main category is full.
3838
log_channel_id: The Discord channel ID for the log channel.
3939
storage_channel_id: The Discord channel ID for the storage channel.
@@ -48,7 +48,7 @@ class SQLSettingsTable(SQLBase):
4848
last_ran_locale: Mapped[str | None] = mapped_column(String(8))
4949
last_slash_synced_version: Mapped[str | None] = mapped_column(String(32))
5050
last_slash_minimum_permission_int: Mapped[int | None]
51-
main_category_id: Mapped[int | None]
51+
main_category_or_forum_id: Mapped[int | None]
5252
fallback_category_id: Mapped[int | None]
5353
log_channel_id: Mapped[int | None]
5454
storage_channel_id: Mapped[int | None]

modmail/cogs/modmail/commands/close.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def close_command(
6161
if ctx.interaction is not None:
6262
await cog.reply(ctx, _("ftl-cmd-close-message-sending"), delete_after=3, ephemeral=True, auto_embed=False)
6363

64-
assert isinstance(ctx.channel, discord.abc.GuildChannel)
64+
assert isinstance(ctx.channel, discord.TextChannel | discord.Thread)
6565
ticket = await cog.bot.staff_guild.get_ticket(ctx.channel)
6666
if ticket is None:
6767
raise ModmailError("Ticket should not be None here.")

modmail/cogs/modmail/commands/reply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def reply_command(
7171
if ctx.interaction is not None:
7272
await cog.reply(ctx, _("flt-cmd-reply-message-sending"), delete_after=3, ephemeral=True, auto_embed=False)
7373

74-
assert isinstance(ctx.channel, discord.abc.GuildChannel)
74+
assert isinstance(ctx.channel, discord.TextChannel | discord.Thread)
7575
ticket = await cog.bot.staff_guild.get_ticket(ctx.channel)
7676
if ticket is None:
7777
raise ModmailError("Ticket should not be None here.")

modmail/cogs/modmail/commands/sclose.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async def sclose_command(
6060
if ctx.interaction is not None:
6161
await cog.reply(ctx, _("ftl-cmd-sclose-message-sending"), delete_after=3, ephemeral=True, auto_embed=False)
6262

63-
assert isinstance(ctx.channel, discord.abc.GuildChannel)
63+
assert isinstance(ctx.channel, discord.TextChannel | discord.Thread)
6464
ticket = await cog.bot.staff_guild.get_ticket(ctx.channel)
6565
if ticket is None:
6666
raise ModmailError("Ticket should not be None here.")

0 commit comments

Comments
 (0)