mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 13:56:57 +01:00
add iteminfo command, change name of project to qweribot, fix ghcr publish url, add proper README.md
This commit is contained in:
19
src/commands/qbucks.ts
Normal file
19
src/commands/qbucks.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { createBotCommand } from "@twurple/easy-bot";
|
||||
import { HelixUser } from "@twurple/api";
|
||||
import api from "../lib/api";
|
||||
import { getBalance } from "../lib/userHelper";
|
||||
|
||||
export default createBotCommand('balance', async (params, { userName, say }) => {
|
||||
let user: HelixUser | null
|
||||
if (params.length !== 0) {
|
||||
user = await api.users.getUserByName(params[0].replace(/[@]/g, ''))
|
||||
} else user = await api.users.getUserByName(userName)
|
||||
if (!user) {
|
||||
await say(`User ${params[0]} not found`)
|
||||
return
|
||||
}
|
||||
|
||||
const data = await getBalance(user)
|
||||
await say(`${user.name} has ${data.balance} qbucks ${data.balance === 0 ? 'mandoooYikes' : 'mandoooSmile'}`)
|
||||
|
||||
}, { aliases: ['qbucks', 'qweribucks', 'bal'] })
|
||||
Reference in New Issue
Block a user