commit b5ef03c9a9c37abfd932ec32b129633796dd4fee
parent f11156ba54b94803758a466b3321dbda66591ad3
Author: Demonstrandum <moi@knutsen.co>
Date:   Tue, 17 Mar 2020 22:23:47 +0000
Fix format oed.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/format_oed.ts b/lib/format_oed.ts
@@ -45,7 +45,8 @@ export default (res, message) => {
         }
         if (!!lex_entry.pronunciations) {
             const prons = Object.values(lex_entry.pronunciations) as any;
-            if (!!prons && prons.length > 0) {
+            if (!!prons && prons.length > 0
+                && !!prons.dialects && prons.dialects.length > 0) {
                 msg += "\nPronunciations:\n"
                 for (const pron of prons) {
                     msg += `    Dialects of ${pron.dialects.join(', ')}:\n`;
diff --git a/lib/main.ts b/lib/main.ts
@@ -30,6 +30,7 @@ import { resolve } from 'dns';
 import { TextChannel } from 'discord.js';
 import { Collection } from 'discord.js';
 import yt_search from './api/yt_scrape';
+import { connect } from 'http2';
 
 
 // Anything that hasn't been defined in `bot.json`
@@ -585,6 +586,11 @@ export class SimpOMatic {
         message.content = trimmed;
         // When finished expanding...
         this.expand(message).then(content => {
+            if (content.length >= 2000) {
+                message.answer("The expansion for that message was"
+                + " over 2000 characters, what the fuck is wrong with you?");
+                return;
+            }
             message.content = content;
             console.log('Expanded message:', message.content);