steam-family-bot-core
Version:
一个用于新版 Steam 家庭的库存监控 Bot 插件
38 lines • 1.59 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const builder_1 = require("../cmd/builder");
const steamid_1 = __importDefault(require("steamid"));
const cmd = new builder_1.CommandBuilder()
.setName('bind')
.setDescription('bind to an steamid without auth')
.addAlias('sbbind')
.setExecutor(async (c) => {
const { steamService, logger, session, options, input } = c;
const steamAccount = await steamService.db.Account.getSteamAccountBySteamId(input);
if (steamAccount) {
session.sendQueued(session.text('commands.bind.conflict', { steamId: input }));
return;
}
const id = new steamid_1.default(input);
if (!id.isValid()) {
session.sendQueued(session.text('commands.bind.not-steamid', { input }));
return;
}
const account = await steamService.db.Account.getSteamAccountBySessionUid(session.uid);
if (account && account.status !== 'un-auth') {
session.sendQueued(session.text('commands.bind.bind-auth', { steamId: account.steamId }));
return;
}
await steamService.db.Account.upsertSteamAccount({
accountName: '',
steamId: input,
lastRefreshTime: new Date().getTime().toFixed(),
status: 'un-auth',
}, session.getSessionInfo());
session.sendQueued(session.text('commands.bind.bind-success', { steamId: input }));
});
exports.default = () => cmd;
//# sourceMappingURL=bind.js.map