From affc0c34ee6708292e301674df5556a66ce98813 Mon Sep 17 00:00:00 2001 From: Miksu <46541386+ahnl@users.noreply.github.com> Date: Sat, 26 Jun 2021 17:35:53 +0300 Subject: [PATCH] Display module version and logging --- package.json | 4 ++-- src/index.js | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1ee12ea..c119ee1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "kaatisbot", - "version": "1.0.0", + "name": "kaatisbotti", + "version": "1.1.0", "description": "hyvää kontenttia/good content", "type": "module", "main": "index.js", diff --git a/src/index.js b/src/index.js index 0477e1f..862ee01 100644 --- a/src/index.js +++ b/src/index.js @@ -21,6 +21,11 @@ const htaccessPath = process.env.HTACCESS_PATH || 'public/.htaccess' const client = new Client() +client.on('ready', async () => { + // Notice: npm_package_version is only available if the application is launched with npm start + client.user.setActivity(`v${process.env.npm_package_version}`) +}) + client.on('message', async (message) => { if (message.channel.id !== memeChannelId) return @@ -71,6 +76,8 @@ client.on('message', async (message) => { // The name of the uploader of the file is shown in Apache directory listing fsp.appendFile(htaccessPath, `AddDescription "${utils.alphanum(message.author.username)}" ${availableFilename}\n`) + + console.log(`Successfully uploaded ${availableFilename} by ${message.author.tag}`) } } catch (e) { const errorMessage = await message.reply(`Kuvaasi ei voitu lähettää kaatikseen: ${e.message}`)