Fix error that was causing crash when posting statistics
Additionally, added system logging to rc.service
This commit is contained in:
parent
766dff179e
commit
23ca3a2665
|
@ -1,4 +1,4 @@
|
||||||
# The Artificer - A Dice Rolling Discord Bot | V2.1.1 - 2022/07/10
|
# The Artificer - A Dice Rolling Discord Bot | V2.1.2 - 2022/07/31
|
||||||
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=TheArtificer)
|
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=TheArtificer)
|
||||||
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=bugs)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=TheArtificer)
|
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=bugs)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=TheArtificer) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=TheArtificer&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=TheArtificer)
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,11 @@ pidfile="/var/dbots/TheArtificer/artificer.pid"
|
||||||
artificer_root="/var/dbots/TheArtificer"
|
artificer_root="/var/dbots/TheArtificer"
|
||||||
artificer_write="./logs/,./src/endpoints/gets/heatmap.png"
|
artificer_write="./logs/,./src/endpoints/gets/heatmap.png"
|
||||||
artificer_read="./src/solver/,./src/endpoints/gets/heatmap-base.png,./src/endpoints/gets/heatmap.png"
|
artificer_read="./src/solver/,./src/endpoints/gets/heatmap-base.png,./src/endpoints/gets/heatmap.png"
|
||||||
|
artificer_log="/var/log/artificer.log"
|
||||||
|
|
||||||
artificer_chdir="${artificer_root}"
|
artificer_chdir="${artificer_root}"
|
||||||
command="/usr/sbin/daemon"
|
command="/usr/sbin/daemon"
|
||||||
command_args="-f -R 5 -P ${pidfile} /usr/local/bin/deno run --allow-write=${artificer_write} --allow-read=${artificer_read} --allow-net ${artificer_root}/mod.ts"
|
command_args="-f -R 5 -P ${pidfile} -o ${artificer_log} /usr/local/bin/deno run --allow-write=${artificer_write} --allow-read=${artificer_read} --allow-net ${artificer_root}/mod.ts"
|
||||||
|
|
||||||
load_rc_config artificer
|
load_rc_config artificer
|
||||||
run_rc_command "$1"
|
run_rc_command "$1"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export const config = {
|
export const config = {
|
||||||
'name': 'The Artificer', // Name of the bot
|
'name': 'The Artificer', // Name of the bot
|
||||||
'version': '2.1.1', // Version of the bot
|
'version': '2.1.2', // Version of the bot
|
||||||
'token': 'the_bot_token', // Discord API Token for this 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"
|
'localtoken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS MUST BE DIFFERENT FROM "token"
|
||||||
'prefix': '[[', // Prefix for all commands
|
'prefix': '[[', // Prefix for all commands
|
||||||
|
|
|
@ -47,6 +47,7 @@ const getRandomStatus = async (): Promise<string> => {
|
||||||
// Sends the current server count to all bot list sites we are listed on
|
// Sends the current server count to all bot list sites we are listed on
|
||||||
const updateListStatistics = (botID: bigint, serverCount: number): void => {
|
const updateListStatistics = (botID: bigint, serverCount: number): void => {
|
||||||
config.botLists.forEach(async (e) => {
|
config.botLists.forEach(async (e) => {
|
||||||
|
try {
|
||||||
log(LT.LOG, `Updating statistics for ${JSON.stringify(e)}`);
|
log(LT.LOG, `Updating statistics for ${JSON.stringify(e)}`);
|
||||||
if (e.enabled) {
|
if (e.enabled) {
|
||||||
const tempHeaders = new Headers();
|
const tempHeaders = new Headers();
|
||||||
|
@ -60,6 +61,9 @@ const updateListStatistics = (botID: bigint, serverCount: number): void => {
|
||||||
});
|
});
|
||||||
log(LT.INFO, `Posted server count to ${e.name}. Results: ${JSON.stringify(response)}`);
|
log(LT.INFO, `Posted server count to ${e.name}. Results: ${JSON.stringify(response)}`);
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
log(LT.ERROR, `Failed to update statistics for ${e.name} | Error: ${err.name} - ${err.message}`)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue