Skip to content

Commit

Permalink
Display module version and logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnl committed Jun 26, 2021
1 parent a7f3611 commit affc0c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}`)
Expand Down

0 comments on commit affc0c3

Please sign in to comment.