Skip to content

Commit

Permalink
Add command to display current version
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhsm committed Jul 24, 2022
1 parent 8ba9e2a commit 5375c2b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Add version.txt
run: git describe --tags --abbrev=0 > version.txt

- name: Build and push
uses: docker/build-push-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
version.txt

# Logs
logs
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ Update packages
`npm update`

Better way to update packages (Will tell you about any new versions, including major)
`npx npm-check-updates` provide `-u` for the program to update them itself
`npx npm-check-updates` provide `-u` for the program to update them itself

Get current Junior version
`git describe --tags --abbrev=0 > version.txt`
24 changes: 24 additions & 0 deletions commands/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const fs = require('fs');

module.exports = {
data: new SlashCommandBuilder()
.setName('version')
.setDescription('Replies with Junior\'s current version.'),
async execute(interaction) {
fs.readFile('version.txt', 'utf8', (err, data) => {
if (err) {
console.error(err);
return interaction.reply({
content: 'Error, version unknown.',
ephemeral: true
});
}

return interaction.reply({
content: 'v' + data,
ephemeral: true
});
});
},
};

0 comments on commit 5375c2b

Please sign in to comment.