transcribe: label every mapped language, resolve replied messages off-cache

Irish, Javanese and Latin mapped to codes with no display name, so a reply
header would have shown a raw ISO code. A reply to a message outside the
25-message cache also fell through to the newest voice message instead of the
one the user actually replied to.
This commit is contained in:
2026-11-02 15:45:19 -06:00
parent 51932b1cd7
commit 60cb3e30ac
+14 -5
View File
@@ -61,12 +61,14 @@ LANGUAGE_LABELS = {
"ca": "Catalan", "cs": "Czech", "cy": "Welsh", "da": "Danish", "ca": "Catalan", "cs": "Czech", "cy": "Welsh", "da": "Danish",
"de": "German", "el": "Greek", "en": "English", "eo": "Esperanto", "de": "German", "el": "Greek", "en": "English", "eo": "Esperanto",
"es": "Spanish", "et": "Estonian", "eu": "Basque", "fa": "Persian", "es": "Spanish", "et": "Estonian", "eu": "Basque", "fa": "Persian",
"fi": "Finnish", "fo": "Faroese", "fr": "French", "gl": "Galician", "fi": "Finnish", "fo": "Faroese", "fr": "French", "ga": "Irish", "gl": "Galician",
"gu": "Gujarati", "ha": "Hausa", "he": "Hebrew", "hi": "Hindi", "gu": "Gujarati", "ha": "Hausa", "he": "Hebrew", "hi": "Hindi",
"hr": "Croatian", "ht": "Haitian Creole", "hu": "Hungarian", "hy": "Armenian", "hr": "Croatian", "ht": "Haitian Creole", "hu": "Hungarian", "hy": "Armenian",
"id": "Indonesian", "ig": "Igbo", "is": "Icelandic", "it": "Italian", "id": "Indonesian", "ig": "Igbo", "is": "Icelandic", "it": "Italian",
"ja": "Japanese", "jv": "Javanese", "ka": "Georgian", "kk": "Kazakh", "ja": "Japanese", "jv": "Javanese", "jw": "Javanese", "ka": "Georgian",
"km": "Khmer", "kn": "Kannada", "ko": "Korean", "lb": "Luxembourgish", "kk": "Kazakh",
"km": "Khmer", "kn": "Kannada", "ko": "Korean", "la": "Latin",
"lb": "Luxembourgish",
"ln": "Lingala", "lo": "Lao", "lt": "Lithuanian", "lv": "Latvian", "ln": "Lingala", "lo": "Lao", "lt": "Lithuanian", "lv": "Latvian",
"mg": "Malagasy", "mi": "Maori", "mk": "Macedonian", "ml": "Malayalam", "mg": "Malagasy", "mi": "Maori", "mk": "Macedonian", "ml": "Malayalam",
"mn": "Mongolian", "mr": "Marathi", "ms": "Malay", "mt": "Maltese", "mn": "Mongolian", "mr": "Marathi", "ms": "Malay", "mt": "Maltese",
@@ -115,8 +117,15 @@ class Transcribe(commands.Cog):
async def _find_attachment(self, ctx: commands.Context) -> Optional[discord.Attachment]: async def _find_attachment(self, ctx: commands.Context) -> Optional[discord.Attachment]:
"""Audio from the replied-to message if any, else the newest in channel.""" """Audio from the replied-to message if any, else the newest in channel."""
if ctx.message.reference is not None: reference = ctx.message.reference
replied = ctx.message.reference.resolved if reference is not None:
replied = reference.resolved
if not isinstance(replied, discord.Message):
# Replying to a message outside the cache still resolves.
try:
replied = await ctx.channel.fetch_message(reference.message_id)
except (discord.NotFound, discord.Forbidden, discord.HTTPException):
replied = None
if isinstance(replied, discord.Message): if isinstance(replied, discord.Message):
attachment = self._is_audio_attachment(replied) attachment = self._is_audio_attachment(replied)
if attachment is not None: if attachment is not None: