From 17b80e3acb69f3f7befa50ca0ddc9f69234c775f Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Thu, 3 Aug 2023 16:28:11 +0300 Subject: [PATCH] changes --- calendar/plugin.ts | 6 +- gamedig/plugin.ts | 11 ++- squeebot.repo.json | 2 +- timezone/tzdata.ts | 218 +++++++++++++++++++++++++++++++++++++++++++ urlreply/plugin.json | 2 +- urlreply/plugin.ts | 2 +- utility/convert.ts | 6 +- 7 files changed, 236 insertions(+), 11 deletions(-) create mode 100644 timezone/tzdata.ts diff --git a/calendar/plugin.ts b/calendar/plugin.ts index 85bb7c2..ebf1604 100644 --- a/calendar/plugin.ts +++ b/calendar/plugin.ts @@ -108,12 +108,12 @@ function tellEvent(eventData: Event, msg: IMessage, countdown = true): void { let name = eventData.name; if (name.length > 64) { - name = name.substr(0, 64) + '...'; + name = name.substring(0, 64) + '...'; } let description = eventData.description; if (description.length > 120) { - description = description.substr(0, 120) + '...'; + description = description.substring(0, 120) + '...'; } keys.push(['field', 'Event', { type: 'title', color: 'green' }]); @@ -290,7 +290,7 @@ class CalendarPlugin extends Plugin { } loadConfig(): void { - for (const cfg of this.config.get('calendars', [])) { + for (const cfg of this.config.get('calendars', [])) { if (!cfg.name || !cfg.url) { logger.error('[%s] Invalid calendar configuration.', this.name); continue; diff --git a/gamedig/plugin.ts b/gamedig/plugin.ts index 070cd82..f8c9c6e 100644 --- a/gamedig/plugin.ts +++ b/gamedig/plugin.ts @@ -33,6 +33,13 @@ interface ICommonResponse { version: string; } +interface GameEntry { + game: string; + host: string; + port: number; + rooms: string[]; +} + class Parsers { public static parseMinecraftStatus(response: QueryResult): ICommonResponse | null { const result: ICommonResponse = { @@ -75,8 +82,8 @@ class GamePlugin extends Plugin { @DependencyLoad('simplecommands') addCommands(cmd: any): void { - for (const i in this.config.get('games', [])) { - const game = this.config.get('games', [])[i]; + const gamesList = this.config.get('games', []); + for (const game of gamesList) { if (game.game === 'minecraft' && game.host) { const port = game.port; const command: any = { diff --git a/squeebot.repo.json b/squeebot.repo.json index 06bd032..00fa32f 100644 --- a/squeebot.repo.json +++ b/squeebot.repo.json @@ -39,7 +39,7 @@ }, { "name": "urlreply", - "version": "1.0.8" + "version": "1.0.9" }, { "name": "utility", diff --git a/timezone/tzdata.ts b/timezone/tzdata.ts new file mode 100644 index 0000000..9e84c6a --- /dev/null +++ b/timezone/tzdata.ts @@ -0,0 +1,218 @@ +const masterOffsetList: { [key: string]: number } = { + 'UTC-12': -12, + 'UTC-11': -11, + 'UTC-10': -10, + 'UTC-9': -9, + 'UTC-9:30': -9.5, + 'UTC-8': -8, + 'UTC-7': -7, + 'UTC-6': -6, + 'UTC-5': -5, + 'UTC-4': -4, + 'UTC-3': -3, + 'UTC-3:30': -3.5, + 'UTC-2': -2, + 'UTC-1': -1, + UTC: 0, + 'UTC+1': 1, + 'UTC+2': 2, + 'UTC+3': 3, + 'UTC+4': 4, + 'UTC+4:30': 4.5, + 'UTC+5': 5, + 'UTC+5:30': 5.5, + 'UTC+5:45': 5.75, + 'UTC+6': 6, + 'UTC+6:30': 6.5, + 'UTC+7': 7, + 'UTC+8': 8, + 'UTC+8:30': 8.5, + 'UTC+8:45': 8.75, + 'UTC+9': 9, + 'UTC+9:30': 9.5, + 'UTC+10': 10, + 'UTC+10:30': 10.5, + 'UTC+11': 11, + 'UTC+12': 12, + 'UTC+12:45': 12.75, + 'UTC+13': 13, + 'UTC+13:45': 13.75, + 'UTC+14': 14, + BST: 1, + CET: 1, + DFT: 1, + IST: 1, + MET: 1, + WAT: 1, + WEST: 1, + CAT: 2, + CEST: 2, + EET: 2, + HAEC: 2, + MEST: 2, + SAST: 2, + USZ1: 2, + WAST: 2, + AST: 3, + EAT: 3, + EEST: 3, + FET: 3, + IDT: 3, + IOT: 3, + MSK: 3, + SYOT: 3, + TRT: 3, + IRST: 3.5, + AMT: 4, + AZT: 4, + GET: 4, + GST: 4, + MUT: 4, + RET: 4, + SAMT: 4, + SCT: 4, + VOLT: 4, + AFT: 4.5, + IRDT: 4.5, + MAWT: 5, + MVT: 5, + ORAT: 5, + PKT: 5, + TFT: 5, + TJT: 5, + TMT: 5, + UZT: 5, + YEKT: 5, + IndianST: 5.5, + SLST: 5.5, + NPT: 5.75, + BIOT: 6, + BTT: 6, + KGT: 6, + OMST: 6, + VOST: 6, + CCT: 6.5, + MMT: 6.5, + ACT: 6.5, + CXT: 7, + DAVT: 7, + HOVT: 7, + ICT: 7, + KRAT: 7, + THA: 7, + WIT: 7, + AWST: 8, + BDT: 8, + CHOT: 8, + CIT: 8, + CT: 8, + HKT: 8, + HOVST: 8, + IRKT: 8, + MST: 8, + MYT: 8, + PHT: 8, + SGT: 8, + SST: 8, + ULAT: 8, + WST: 8, + CWST: 8.5, + CHOST: 9, + EIT: 9, + JST: 9, + KST: 9, + TLT: 9, + ULAST: 9, + YAKT: 9, + ACST: 9.5, + AEST: 10, + CHST: 10, + CHUT: 10, + DDUT: 10, + PGT: 10, + VLAT: 10, + ACDT: 10.5, + LHST: 10.5, + AEDT: 11, + KOST: 11, + MIST: 11, + NCT: 11, + NFT: 11, + PONT: 11, + SAKT: 11, + SBT: 11, + SRET: 11, + VUT: 11, + FJT: 12, + GILT: 12, + MAGT: 12, + MHT: 12, + NZST: 12, + PETT: 12, + TVT: 12, + WAKT: 12, + CHAST: 12.75, + NZDT: 13, + PHOT: 13, + TKT: 13, + TOT: 13, + CHADT: 13.75, + LINT: 14, + AZOT: -1, + CVT: -1, + EGT: -1, + BRST: -2, + FNT: -2, + PMDT: -2, + UYST: -2, + NDT: -2.5, + ADT: -3, + AMST: -3, + ART: -3, + BRT: -3, + CLST: -3, + FKST: -3, + GFT: -3, + PMST: -3, + PYST: -3, + ROTT: -3, + UYT: -3, + NST: -3.5, + NT: -3.5, + AtST: -4, + BOT: -4, + CLT: -4, + COST: -4, + ECT: -4, + EDT: -4, + FKT: -4, + GYT: -4, + PYT: -4, + VET: -4, + CDT: -5, + COT: -5, + EASST: -5, + EST: -5, + PET: -5, + CST: -6, + EAST: -6, + GALT: -6, + MDT: -6, + PDT: -7, + AKDT: -8, + CIST: -8, + PST: -8, + AKST: -9, + GAMT: -9, + GIT: -9, + HADT: -9, + MART: -9.5, + MIT: -9.5, + CKT: -10, + HAST: -10, + TAHT: -10, + NUT: -11, + BIT: -12, + GMT: 0, + WET: 0, +}; diff --git a/urlreply/plugin.json b/urlreply/plugin.json index 77881d5..e9665a1 100644 --- a/urlreply/plugin.json +++ b/urlreply/plugin.json @@ -2,7 +2,7 @@ "main": "plugin.js", "name": "urlreply", "description": "Fetch titles from web pages, specifically made for IRC", - "version": "1.0.8", + "version": "1.0.9", "tags": ["irc"], "dependencies": [], "npmDependencies": ["cheerio@^1.0.0-rc.10"] diff --git a/urlreply/plugin.ts b/urlreply/plugin.ts index 964df00..b370625 100644 --- a/urlreply/plugin.ts +++ b/urlreply/plugin.ts @@ -181,7 +181,7 @@ async function getYoutubeFromVideo( } } - keys.push(['field', 'You' + msg.source.format.color('brown', 'Tube'), { color: 'white', type: 'title' }]); + keys.push(['field', msg.source.format.color('white', 'You') + msg.source.format.color('brown', 'Tube'), { type: 'title' }]); keys.push(['field', vid.snippet.title, {type: 'description'}]); keys.push(['field', vid.statistics.viewCount.toString(), { type: 'metric', label: 'Views' }]); diff --git a/utility/convert.ts b/utility/convert.ts index ff00305..614bb65 100644 --- a/utility/convert.ts +++ b/utility/convert.ts @@ -202,7 +202,7 @@ export function ASCIIBinaryConverter(input: string, simplified: string[]): strin parseInt(Buffer.from(strArr[i].toString(), 'utf8').toString('hex'), 16).toString(2)).slice(-8); } - response = response.substr(1); + response = response.substring(1); break; case 'DECODE': @@ -210,7 +210,7 @@ export function ASCIIBinaryConverter(input: string, simplified: string[]): strin i = 0; while (8 * (i + 1) <= text.length) { - response += Buffer.from(parseInt(text.substr(8 * i, 8), 2).toString(16), 'hex').toString('utf8'); + response += Buffer.from(parseInt(text.substring(8 * i, 8), 2).toString(16), 'hex').toString('utf8'); i++; } @@ -230,7 +230,7 @@ export function ASCIIHexConverter(input: string, simplified: string[]): string { text = text.replace(/\s/g, ''); for (i = 0; i < text.length; i += 2) { - response += String.fromCharCode(parseInt(text.substr(i, 2), 16)); + response += String.fromCharCode(parseInt(text.substring(i, 2), 16)); } response = response.replace(/\n/g, '\\n').replace(/\r/g, '\\r');