forked from syntaxbullet/AuroraBot-discord
feat: Implement userService.getOrCreateUser and integrate it across commands, remove old utility scripts, and fix daily bonus calculation.
This commit is contained in:
@@ -21,7 +21,7 @@ export const pay = createCommand({
|
||||
execute: async (interaction) => {
|
||||
await interaction.deferReply();
|
||||
|
||||
const targetUser = interaction.options.getUser("user", true);
|
||||
const targetUser = await userService.getOrCreateUser(interaction.options.getUser("user", true).id, interaction.options.getUser("user", true).username);
|
||||
const amount = BigInt(interaction.options.getInteger("amount", true));
|
||||
const senderId = interaction.user.id;
|
||||
const receiverId = targetUser.id;
|
||||
@@ -31,12 +31,6 @@ export const pay = createCommand({
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure receiver exists
|
||||
let receiver = await userService.getUserById(receiverId);
|
||||
if (!receiver) {
|
||||
receiver = await userService.createUser(receiverId, targetUser.username, undefined);
|
||||
}
|
||||
|
||||
try {
|
||||
await economyService.transfer(senderId, receiverId, amount);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user