Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #535 from EddieHubCommunity/issue-534
Browse files Browse the repository at this point in the history
feat: version command
  • Loading branch information
eddiejaoude authored May 15, 2021
2 parents 4f135c0 + 122d253 commit 1859f51
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.

## Env-File
## Config / Secrets environment variables

Copy `.env.example` to `.env` and add your private information

*Note: never commit this file, it should be ignored by git*

```
DISCORD_TOKEN=
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
}
2 changes: 2 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DiscordModule } from 'discord-nestjs';
import { AppService } from './app.service';
import { DiscordConfigService } from './environment/discord-config.service';
import { AlexModule } from './alexjs/alex.module';
import { VersionModule } from './version/version.module';

@Module({
imports: [
Expand All @@ -12,6 +13,7 @@ import { AlexModule } from './alexjs/alex.module';
ConfigModule.forRoot({
isGlobal: true,
}),
VersionModule,
],
providers: [AppService, DiscordConfigService],
})
Expand Down
11 changes: 11 additions & 0 deletions src/version/version.handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Injectable } from '@nestjs/common';
import { Context, OnCommand } from 'discord-nestjs';
import { Message } from 'discord.js';

@Injectable()
export class VersionHandler {
@OnCommand({ name: 'version' })
async version(@Context() [context]: [Message]): Promise<void> {
await context.reply(`Currently running version "${process.env.VERSION}"`);
}
}
8 changes: 8 additions & 0 deletions src/version/version.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Module } from '@nestjs/common';
import { VersionHandler } from './version.handler';

@Module({
providers: [VersionHandler],
exports: [],
})
export class VersionModule {}

0 comments on commit 1859f51

Please sign in to comment.