diff --git a/config.example.ts b/config.example.ts index 5d2bf71..e707eca 100755 --- a/config.example.ts +++ b/config.example.ts @@ -1,6 +1,6 @@ export const config = { name: 'Logogram Bot', // Name of the bot - version: '1.2.1', // Version of the bot + version: '1.3.0', // Version of the bot token: 'the_bot_token', // Discord API Token for this bot localToken: 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token" prefix: 'l!', // Prefix for all commands diff --git a/deno.lock b/deno.lock index 63a158e..3dd3763 100644 --- a/deno.lock +++ b/deno.lock @@ -1,5 +1,5 @@ { - "version": "3", + "version": "4", "remote": { "https://deno.land/std@0.99.0/encoding/base64.ts": "eecae390f1f1d1cae6f6c6d732ede5276bf4b9cd29b1d281678c054dc5cc009e", "https://deno.land/x/discordeno@12.0.1/mod.ts": "9c4187b459f479e23a77b0e7f0e24507a10729c7865b5c18113e79b1fbf0effa", @@ -536,6 +536,9 @@ "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/deps.ts": "4932522dd8d38cc322df6508d4f2e55e5fb0ec15e54fcdc81e2bf10051021608", "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/mod.ts": "d9c38a41a405cf5732c9233c2391a1d7f5a12d0e464aace6f8f596fabf5f21ba", "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/src/logger.ts": "f6ba6f7fe254fc3227a3ad48fd7c2c3aaaec8c350f0246fb3eeff075c21dc7e5", + "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.1.1/deps.ts": "3ab026026d146ca5e7160b16146d5665e45487a62749a7970f8e00c0c934874d", + "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.1.1/mod.ts": "d9c38a41a405cf5732c9233c2391a1d7f5a12d0e464aace6f8f596fabf5f21ba", + "https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.1.1/src/logger.ts": "b3a39724d58102dfbcdcd640a829cbfe1f083065060f68003f9c8fd49fdd658a", "https://unpkg.com/@evan/wasm@0.0.65/target/zlib/deno.js": "36cd3f1edd2f3a6d6fd4c2376f701c2748338c132703810d4866cfa52b5e7bf9" } } diff --git a/deps.ts b/deps.ts index fc84a84..e1ff364 100644 --- a/deps.ts +++ b/deps.ts @@ -2,4 +2,4 @@ export { cache, cacheHandlers, DiscordActivityTypes, editBotNickname, editBotSta export type { DiscordenoGuild, DiscordenoMessage, Embed } from 'https://deno.land/x/discordeno@12.0.1/mod.ts'; -export { initLog, log, LogTypes as LT } from 'https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.1/mod.ts'; +export { initLog, log, LogTypes as LT } from 'https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.1.1/mod.ts'; diff --git a/logogram.rc b/logogram.rc index 1fc4aec..610998f 100755 --- a/logogram.rc +++ b/logogram.rc @@ -14,7 +14,7 @@ logogram_log="/var/log/logogram-bot.log" logogram_chdir="${logogram_root}" command="/usr/sbin/daemon" -command_args="-f -R 5 -P ${pidfile} -o ${logogram_log} /usr/local/bin/deno run --allow-write=${logogram_write} --allow-net ${logogram_root}/mod.ts" +command_args="-f -R 5 -P ${pidfile} -o ${logogram_log} /usr/local/bin/deno run --allow-write=${logogram_write} --allow-net --allow-import ${logogram_root}/mod.ts" load_rc_config logogram run_rc_command "$1" diff --git a/logogram.service b/logogram.service index 7ce5dc3..0987aa5 100755 --- a/logogram.service +++ b/logogram.service @@ -6,7 +6,7 @@ After=network.target [Service] Type=simple PIDFile=/run/deno.pid -ExecStart=/root/.deno/bin/deno run --allow-write=./logs/ --allow-net /var/dbots/logogram-bot/mod.ts +ExecStart=/root/.deno/bin/deno run --allow-write=./logs/ --allow-net --allow-import /var/dbots/logogram-bot/mod.ts RestartSec=60 Restart=on-failure diff --git a/mod.ts b/mod.ts index 1bb6010..f2e0a2f 100755 --- a/mod.ts +++ b/mod.ts @@ -158,9 +158,7 @@ startBot({ }); } else if (query && data.ActionShortNames.includes(query)) { log(LT.LOG, `in shorthand matched '${query}'`); - const searchResults: Array = data.Actions.filter((action) => action.shorthand === query).map((action) => - data.ActionNames.indexOf(action.name.toLowerCase()) - ); + const searchResults: Array = data.Actions.filter((action) => action.shorthand === query).map((action) => data.ActionNames.indexOf(action.name.toLowerCase())); message .send({ content: searchResults.length > 1 ? `Showing ${searchResults.length} actions:` : 'Showing single action:', @@ -171,9 +169,7 @@ startBot({ }); } else { log(LT.LOG, `in general search '${query}'`); - const initialSearchResults: Array = data.ActionNames.filter((action) => action.includes(query)).map((action) => - data.ActionNames.indexOf(action) - ); + const initialSearchResults: Array = data.ActionNames.filter((action) => action.includes(query)).map((action) => data.ActionNames.indexOf(action)); const searchResults: Array = initialSearchResults.filter((actionIdx) => params.class ? (data.Actions[actionIdx].jobs.includes('all-nin') && !params.isNin) || @@ -189,10 +185,9 @@ startBot({ } const classMessage = params.class ? ` -class=${params.rawClass}` : ''; const userQuery = `${rawQuery}${classMessage}`.trim(); - const paginationMessage = - searchResults.length > config.resultsPerPage - ? `\nShowing page ${params.page} of ${totalPages}\n\nTo see more results, please run \`${config.prefix}logos ${userQuery} -page=#\`, where # is the page number you wish to see.` - : ''; + const paginationMessage = searchResults.length > config.resultsPerPage + ? `\nShowing page ${params.page} of ${totalPages}\n\nTo see more results, please run \`${config.prefix}logos ${userQuery} -page=#\`, where # is the page number you wish to see.` + : ''; message .send({ content: `${searchResults.length} result${searchResults.length > 1 ? 's' : ''} matching query: \`${userQuery}\`${paginationMessage}`, @@ -231,10 +226,12 @@ startBot({ } else if (!query) { message .send({ - content: `Available presets: ${data.Presets.keys() - .toArray() - .map((p) => `\`${p}\``) - .join(', ')}`, + content: `Available presets: ${ + data.Presets.keys() + .toArray() + .map((p) => `\`${p}\``) + .join(', ') + }`, }) .catch((e) => { log(LT.ERROR, `Failed to send message: ${JSON.stringify(message)} | ${JSON.stringify(e)}`); diff --git a/src/constantCmds.ts b/src/constantCmds.ts index 142c676..aeef7d9 100755 --- a/src/constantCmds.ts +++ b/src/constantCmds.ts @@ -25,8 +25,7 @@ export const constantCmds = { }, { name: `\`${config.prefix}logograms [query]\` or \`${config.prefix}l [query]\``, - value: - 'Sends information about the requested logogram, or logograms matching the query\nCan use `-class=abbr` to further filter the results, or `-page=#` to view more results', + value: 'Sends information about the requested logogram, or logograms matching the query\nCan use `-class=abbr` to further filter the results, or `-page=#` to view more results', inline: true, }, { diff --git a/start.command b/start.command index 6bec692..41bf215 100755 --- a/start.command +++ b/start.command @@ -1 +1 @@ -deno run --allow-net --allow-write=./logs/ ./mod.ts +deno run --allow-write=./logs/ --allow-net --allow-import ./mod.ts