Skip to content

Commit

Permalink
feat: add rank command
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelMedeiros committed Jan 4, 2024
1 parent 8b2450a commit eb3fa5d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/domain/bot/bot.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
BlockchainCommand,
ConvertCommand,
DifficultyCommand,
FeesCommand,
LightningStatsCommand,
LightningTopCommand,
MarketCapCommand,
Expand All @@ -21,12 +22,12 @@ import {
NodeStatsCommand,
OpReturnCommand,
PriceCommand,
RankCommand,
TipCommand,
TransactionCommand,
} from './commands'
import { MurrayServiceRepository } from './repositories'
import { NumbersService } from 'src/utils/numbers/numbers.service'
import { FeesCommand } from './commands/fees.command'

@Module({
imports: [DiscordModule.forFeature(), HttpModule],
Expand Down Expand Up @@ -61,6 +62,7 @@ import { FeesCommand } from './commands/fees.command'
NodeStatsCommand,
OpReturnCommand,
PriceCommand,
RankCommand,
TipCommand,
TransactionCommand,

Expand Down
2 changes: 2 additions & 0 deletions src/domain/bot/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ export * from './node-stats.command'
export * from './op-return.command'
export * from './tip.command'
export * from './transaction.command'
export * from './rank.command'
export * from './fees.command'
20 changes: 20 additions & 0 deletions src/domain/bot/commands/rank.command.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Command, DiscordCommand } from '@discord-nestjs/core'
import { CommandInteraction } from 'discord.js'
import { Injectable } from '@nestjs/common'
import { MurrayServiceRepository } from '../repositories'
import { createResponse } from 'src/utils/default-response'

@Command({
name: 'rank',
description: 'Tip Rank',
})
@Injectable()
export class RankCommand implements DiscordCommand {
constructor(private readonly repository: MurrayServiceRepository) {}

async handler(interaction: CommandInteraction): Promise<{}> {
const rank = await this.repository.getRank()

return createResponse(rank.data)
}
}
5 changes: 5 additions & 0 deletions src/domain/bot/repositories/murrayservice.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export class MurrayServiceRepository {
return this.postData(url, bodyData)
}

getRank(): Promise<any> {
const url = `${this.baseUrl}/payment/rank`
return this.getData(url)
}

// Blockchain

getAddress({ address }): Promise<any> {
Expand Down

0 comments on commit eb3fa5d

Please sign in to comment.