fix deletereaction, started setting up service files

This commit is contained in:
Ean Milligan (Bastion) 2022-09-27 11:37:56 -04:00
parent 57d6b45d2e
commit 2a68522abd
5 changed files with 37 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# Sweeper Bot | V0.4.0 - 2022/09/09
# Sweeper Bot | V0.4.4 - 2022/09/27
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=SweeperBot)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=SweeperBot&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=SweeperBot) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=SweeperBot&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=SweeperBot) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=SweeperBot&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=SweeperBot) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=SweeperBot&metric=bugs)](https://sonarcloud.io/summary/new_code?id=SweeperBot) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=SweeperBot&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=SweeperBot) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=SweeperBot&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=SweeperBot)

View File

@ -1,6 +1,6 @@
export const config = {
'name': 'Sweeper Bot', // Name of the bot
'version': '0.4.2', // Version of the bot
'version': '0.4.4', // 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': 's!', // Prefix for all commands

View File

@ -29,7 +29,7 @@ export const pollReactions = async (bot: Bot, message: Message, update = false)
if (reaction.emoji.name) {
// Make emoji name that matches our allEmojis array format
const emojiName = reaction.emoji.id ? `:${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name;
await bot.helpers.deleteReaction(message.channelId, message.id, emojiName).catch((e: Error) => utils.commonLoggers.reactionDeleteError('pollReactions.ts:32', message, e, emojiName));
await bot.helpers.deleteReactionsEmoji(message.channelId, message.id, emojiName).catch((e: Error) => utils.commonLoggers.reactionDeleteError('pollReactions.ts:32', message, e, emojiName));
}
}
}

20
sweeper.rc Normal file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# PROVIDE: sweeper
. /etc/rc.subr
name="sweeper"
rcvar="sweeper_enable"
pidfile="/var/dbots/SweeperBot/sweeper.pid"
sweeper_root="/var/dbots/SweeperBot"
sweeper_write="./logs/"
sweeper_log="/var/log/sweeper.log"
sweeper_chdir="${sweeper_root}"
command="/usr/sbin/daemon"
command_args="-f -R 5 -P ${pidfile} -o ${sweeper_log} /usr/local/bin/deno run --allow-write=${sweeper_write} --allow-net ${sweeper_root}/mod.ts"
load_rc_config sweeper
run_rc_command "$1"

14
sweeper.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=Sweeper Bot Discord Bot
Documentation=https://github.com/Burn-E99/SweeperBot
After=network.target
[Service]
Type=simple
PIDFile=/run/deno.pid
ExecStart=/root/.deno/bin/deno run --allow-write=./logs/ --allow-net .\mod.ts
RestartSec=60
Restart=on-failure
[Install]
WantedBy=multi-user.target