♻️ Migrated more credits module to Prisma
This commit is contained in:
parent
d26a8367dd
commit
7da0d9a97f
4 changed files with 156 additions and 318 deletions
|
@ -5,14 +5,14 @@ import {
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
||||||
// Helpers../../../../../../../helpers/userData
|
// Helpers../../../../../../../helpers/userData
|
||||||
import pluralize from "../../../../../../../helpers/pluralize";
|
import pluralize from "../../../../../../../helpers/pluralize";
|
||||||
// Models
|
// Models
|
||||||
import fetchUser from "../../../../../../../helpers/userData";
|
|
||||||
// Handlers
|
// Handlers
|
||||||
|
import prisma from "../../../../../../../prisma";
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
@ -48,50 +48,67 @@ export default {
|
||||||
const creditAmount = options?.getInteger("amount");
|
const creditAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// If amount option is null
|
// If amount option is null
|
||||||
if (creditAmount === null) {
|
if (creditAmount === null)
|
||||||
throw new Error("You need to provide a credit amount.");
|
throw new Error("You need to provide a credit amount.");
|
||||||
}
|
|
||||||
|
|
||||||
// If amount is zero or below
|
// If amount is zero or below
|
||||||
if (creditAmount <= 0) {
|
if (creditAmount <= 0)
|
||||||
throw new Error("You must provide a credit amount greater than zero");
|
throw new Error("You must provide a credit amount greater than zero");
|
||||||
}
|
|
||||||
|
|
||||||
if (discordReceiver === null) {
|
if (discordReceiver === null)
|
||||||
throw new Error("We could not get the receiving user from Discord");
|
throw new Error("We could not get the receiving user from Discord");
|
||||||
}
|
|
||||||
if (guild === null) {
|
if (guild === null)
|
||||||
throw new Error("We could not get the current guild from discord.");
|
throw new Error("We could not get the current guild from discord.");
|
||||||
}
|
|
||||||
|
|
||||||
const toUser = await fetchUser(discordReceiver, guild);
|
const createGuildMember = await prisma.guildMember.upsert({
|
||||||
|
where: {
|
||||||
|
userId_guildId: {
|
||||||
|
userId: discordReceiver.id,
|
||||||
|
guildId: guild.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update: { creditsEarned: { increment: creditAmount } },
|
||||||
|
create: {
|
||||||
|
creditsEarned: creditAmount,
|
||||||
|
user: {
|
||||||
|
connectOrCreate: {
|
||||||
|
create: {
|
||||||
|
id: discordReceiver.id,
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: discordReceiver.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
guild: {
|
||||||
|
connectOrCreate: {
|
||||||
|
create: {
|
||||||
|
id: guild.id,
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: guild.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
if (toUser === null) {
|
logger.silly(createGuildMember);
|
||||||
throw new Error("The receiving user is not found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toUser?.credits === null) {
|
|
||||||
throw new Error("The receiving user's credits value could not found.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deposit amount to toUser
|
|
||||||
toUser.credits += creditAmount;
|
|
||||||
|
|
||||||
// Save toUser
|
// Save toUser
|
||||||
await toUser?.save()?.then(async () => {
|
await interaction?.editReply({
|
||||||
await interaction?.editReply({
|
embeds: [
|
||||||
embeds: [
|
new EmbedBuilder()
|
||||||
new EmbedBuilder()
|
.setTitle("[:toolbox:] Manage - Credits (Give)")
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Give)")
|
.setDescription(
|
||||||
.setDescription(
|
`Successfully gave ${pluralize(creditAmount, "credit")}`
|
||||||
`Successfully gave ${pluralize(creditAmount, "credit")}`
|
)
|
||||||
)
|
.setTimestamp(new Date())
|
||||||
.setTimestamp(new Date())
|
.setColor(successColor)
|
||||||
.setColor(successColor)
|
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
],
|
||||||
],
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,9 +9,9 @@ import {
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
||||||
import fetchUser from "../../../../../../../helpers/userData";
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
|
import prisma from "../../../../../../../prisma";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -91,60 +91,52 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// toUser Information
|
const createGuildMember = await prisma.guildMember.upsert({
|
||||||
const toUser = await fetchUser(discordUser, guild);
|
where: {
|
||||||
|
userId_guildId: {
|
||||||
|
userId: discordUser.id,
|
||||||
|
guildId: guild.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update: { creditsEarned: creditAmount },
|
||||||
|
create: {
|
||||||
|
creditsEarned: creditAmount,
|
||||||
|
user: {
|
||||||
|
connectOrCreate: {
|
||||||
|
create: {
|
||||||
|
id: discordUser.id,
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: discordUser.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
guild: {
|
||||||
|
connectOrCreate: {
|
||||||
|
create: {
|
||||||
|
id: guild.id,
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: guild.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// If toUser does not exist
|
logger.silly(createGuildMember);
|
||||||
if (toUser === null) {
|
|
||||||
logger?.silly(`User does not exist`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Set)")
|
.setTitle("[:toolbox:] Manage - Credits (Set)")
|
||||||
.setDescription(`The user you provided does not exist.`)
|
.setDescription(
|
||||||
.setTimestamp(new Date())
|
`Set **${discordUser}**'s credits to **${creditAmount}**.`
|
||||||
.setColor(errorColor)
|
)
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
.setTimestamp(new Date())
|
||||||
],
|
.setColor(successColor)
|
||||||
});
|
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||||
}
|
],
|
||||||
|
|
||||||
// If toUser.credits does not exist
|
|
||||||
if (toUser?.credits === null) {
|
|
||||||
logger?.silly(`User does not have any credits`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Set)")
|
|
||||||
.setDescription(`The user you provided does not have any credits.`)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set toUser with amount
|
|
||||||
toUser.credits = creditAmount;
|
|
||||||
|
|
||||||
// Save toUser
|
|
||||||
await toUser?.save()?.then(async () => {
|
|
||||||
logger?.silly(`Saved user`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Set)")
|
|
||||||
.setDescription(
|
|
||||||
`Set **${discordUser}**'s credits to **${creditAmount}**.`
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(successColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,9 +10,9 @@ import {
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
||||||
// Helpers../../../../../../../helpers/userData
|
// Helpers../../../../../../../helpers/userData
|
||||||
import pluralize from "../../../../../../../helpers/pluralize";
|
import pluralize from "../../../../../../../helpers/pluralize";
|
||||||
import fetchUser from "../../../../../../../helpers/userData";
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
import logger from "../../../../../../../middlewares/logger";
|
||||||
|
import prisma from "../../../../../../../prisma";
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -45,7 +45,7 @@ export default {
|
||||||
const { guild, options } = interaction;
|
const { guild, options } = interaction;
|
||||||
|
|
||||||
// User option
|
// User option
|
||||||
const optionUser = options?.getUser("user");
|
const discordReceiver = options?.getUser("user");
|
||||||
|
|
||||||
// Amount option
|
// Amount option
|
||||||
const optionAmount = options?.getInteger("amount");
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
@ -82,7 +82,7 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionUser === null) {
|
if (discordReceiver === null) {
|
||||||
logger?.silly(`Discord receiver is null`);
|
logger?.silly(`Discord receiver is null`);
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
|
@ -111,59 +111,52 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// toUser Information
|
const createGuildMember = await prisma.guildMember.upsert({
|
||||||
const toUser = await fetchUser(optionUser, guild);
|
where: {
|
||||||
|
userId_guildId: {
|
||||||
// If toUser does not exist
|
userId: discordReceiver.id,
|
||||||
if (toUser === null) {
|
guildId: guild.id,
|
||||||
logger?.silly(`ToUser is null`);
|
},
|
||||||
|
},
|
||||||
return interaction?.editReply({
|
update: { creditsEarned: { decrement: optionAmount } },
|
||||||
embeds: [
|
create: {
|
||||||
new EmbedBuilder()
|
creditsEarned: -optionAmount,
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Take)")
|
user: {
|
||||||
.setDescription(`The user you provided does not exist.`)
|
connectOrCreate: {
|
||||||
.setTimestamp(new Date())
|
create: {
|
||||||
.setColor(errorColor)
|
id: discordReceiver.id,
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
},
|
||||||
],
|
where: {
|
||||||
});
|
id: discordReceiver.id,
|
||||||
}
|
},
|
||||||
|
},
|
||||||
// If toUser.credits does not exist
|
},
|
||||||
if (toUser?.credits === null) {
|
guild: {
|
||||||
logger?.silly(`ToUser.credits is null`);
|
connectOrCreate: {
|
||||||
|
create: {
|
||||||
return interaction?.editReply({
|
id: guild.id,
|
||||||
embeds: [
|
},
|
||||||
new EmbedBuilder()
|
where: {
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Take)")
|
id: guild.id,
|
||||||
.setDescription(`The user you provided does not have credits.`)
|
},
|
||||||
.setTimestamp(new Date())
|
},
|
||||||
.setColor(errorColor)
|
},
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
},
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Withdraw amount from toUser
|
|
||||||
toUser.credits -= optionAmount;
|
|
||||||
|
|
||||||
// Save toUser
|
|
||||||
await toUser?.save()?.then(async () => {
|
|
||||||
await interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Take)")
|
|
||||||
.setDescription(
|
|
||||||
`Took ${pluralize(optionAmount, "credit")} from ${optionUser}.`
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(successColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
logger.silly(createGuildMember);
|
||||||
|
await interaction?.editReply({
|
||||||
|
embeds: [
|
||||||
|
new EmbedBuilder()
|
||||||
|
.setTitle("[:toolbox:] Manage - Credits (Take)")
|
||||||
|
.setDescription(
|
||||||
|
`Took ${pluralize(optionAmount, "credit")} from ${discordReceiver}.`
|
||||||
|
)
|
||||||
|
.setTimestamp(new Date())
|
||||||
|
.setColor(successColor)
|
||||||
|
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
return;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,12 +6,10 @@ import {
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
PermissionsBitField,
|
PermissionsBitField,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import mongoose from "mongoose";
|
import transferCredits from "../../../../../../../helpers/transferCredits";
|
||||||
// Configurations
|
// Configurations
|
||||||
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
import getEmbedConfig from "../../../../../../../helpers/getEmbedData";
|
||||||
import fetchUser from "../../../../../../../helpers/userData";
|
|
||||||
// Handlers../../../../../../../helpers/userData
|
// Handlers../../../../../../../helpers/userData
|
||||||
import logger from "../../../../../../../middlewares/logger";
|
|
||||||
|
|
||||||
// Function
|
// Function
|
||||||
export default {
|
export default {
|
||||||
|
@ -54,188 +52,26 @@ export default {
|
||||||
const optionToUser = options?.getUser("to");
|
const optionToUser = options?.getUser("to");
|
||||||
const optionAmount = options?.getInteger("amount");
|
const optionAmount = options?.getInteger("amount");
|
||||||
|
|
||||||
// If amount is null
|
if (optionAmount === null) throw new Error("Amount is not specified");
|
||||||
if (optionAmount === null) {
|
|
||||||
logger?.silly(`Amount is null`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
if (optionAmount <= 0)
|
||||||
embeds: [
|
throw new Error("You need to set amount above zero to transfer.");
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(`You must provide an amount.`)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (guild === null) {
|
if (!guild) throw new Error(`We could not find this guild.`);
|
||||||
logger?.silly(`Guild is null`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
if (!optionFromUser)
|
||||||
embeds: [
|
throw new Error("You must provide a user to transfer from.");
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(`You must be in a guild.`)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (optionFromUser === null) {
|
|
||||||
logger?.silly(`From user is null`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
if (!optionToUser)
|
||||||
embeds: [
|
throw new Error("You must provide a user to transfer to.");
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(`You must provide a user to transfer from.`)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (optionToUser === null) {
|
|
||||||
logger?.silly(`To user is null`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
await transferCredits(guild, optionFromUser, optionToUser, optionAmount);
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(`You must provide a user to transfer to.`)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get fromUser object
|
|
||||||
const fromUser = await fetchUser(optionFromUser, guild);
|
|
||||||
|
|
||||||
// Get toUser object
|
|
||||||
const toUser = await fetchUser(optionToUser, guild);
|
|
||||||
|
|
||||||
// If toUser does not exist
|
|
||||||
if (fromUser === null) {
|
|
||||||
logger?.silly(`From user does not exist`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(
|
|
||||||
`The user you provided to transfer from does not exist.`
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// If toUser.credits does not exist
|
|
||||||
if (!fromUser?.credits) {
|
|
||||||
logger?.silly(`From user does not have credits`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(
|
|
||||||
`The user you provided to transfer from does not have credits.`
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// If toUser does not exist
|
|
||||||
if (toUser === null) {
|
|
||||||
logger?.silly(`To user does not exist`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(
|
|
||||||
`The user you provided to transfer to does not exist.`
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// If toUser.credits does not exist
|
|
||||||
if (toUser?.credits === null) {
|
|
||||||
logger?.silly(`To user does not have credits`);
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
|
||||||
embeds: [
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
|
||||||
.setDescription(
|
|
||||||
`The user you provided to transfer to does not have credits.`
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
|
||||||
.setColor(errorColor)
|
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const session = await mongoose.startSession();
|
|
||||||
|
|
||||||
session.startTransaction();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Withdraw amount from fromUserDB
|
|
||||||
fromUser.credits -= optionAmount;
|
|
||||||
|
|
||||||
// Deposit amount to toUserDB
|
|
||||||
toUser.credits += optionAmount;
|
|
||||||
|
|
||||||
await fromUser.save();
|
|
||||||
|
|
||||||
await toUser.save();
|
|
||||||
|
|
||||||
await session.commitTransaction();
|
|
||||||
} catch (error: unknown) {
|
|
||||||
await session.abortTransaction();
|
|
||||||
session.endSession();
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
"An error occurred while trying to gift credits. Please try again later."
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
// ending the session
|
|
||||||
session.endSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
return interaction?.editReply({
|
return interaction?.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
.setTitle("[:toolbox:] Manage - Credits (Transfer)")
|
||||||
.setDescription(`Transferred ${optionAmount} credits.`)
|
.setDescription(`Transferred ${optionAmount} credits.`)
|
||||||
.addFields(
|
|
||||||
{
|
|
||||||
name: `${optionFromUser?.username} Balance`,
|
|
||||||
value: `${fromUser?.credits}`,
|
|
||||||
inline: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: `${optionToUser?.username} Balance`,
|
|
||||||
value: `${toUser?.credits}`,
|
|
||||||
inline: true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.setTimestamp(new Date())
|
.setTimestamp(new Date())
|
||||||
.setColor(successColor)
|
.setColor(successColor)
|
||||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||||
|
|
Loading…
Add table
Reference in a new issue