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:
@@ -61,12 +61,14 @@ LANGUAGE_LABELS = {
|
||||
"ca": "Catalan", "cs": "Czech", "cy": "Welsh", "da": "Danish",
|
||||
"de": "German", "el": "Greek", "en": "English", "eo": "Esperanto",
|
||||
"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",
|
||||
"hr": "Croatian", "ht": "Haitian Creole", "hu": "Hungarian", "hy": "Armenian",
|
||||
"id": "Indonesian", "ig": "Igbo", "is": "Icelandic", "it": "Italian",
|
||||
"ja": "Japanese", "jv": "Javanese", "ka": "Georgian", "kk": "Kazakh",
|
||||
"km": "Khmer", "kn": "Kannada", "ko": "Korean", "lb": "Luxembourgish",
|
||||
"ja": "Japanese", "jv": "Javanese", "jw": "Javanese", "ka": "Georgian",
|
||||
"kk": "Kazakh",
|
||||
"km": "Khmer", "kn": "Kannada", "ko": "Korean", "la": "Latin",
|
||||
"lb": "Luxembourgish",
|
||||
"ln": "Lingala", "lo": "Lao", "lt": "Lithuanian", "lv": "Latvian",
|
||||
"mg": "Malagasy", "mi": "Maori", "mk": "Macedonian", "ml": "Malayalam",
|
||||
"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]:
|
||||
"""Audio from the replied-to message if any, else the newest in channel."""
|
||||
if ctx.message.reference is not None:
|
||||
replied = ctx.message.reference.resolved
|
||||
reference = ctx.message.reference
|
||||
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):
|
||||
attachment = self._is_audio_attachment(replied)
|
||||
if attachment is not None:
|
||||
|
||||
Reference in New Issue
Block a user