Skip to content

Commit

Permalink
Fix minecraft_id and discord name inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic-R authored Nov 25, 2023
1 parent 0049b08 commit ecb46b4
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions event/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ module.exports = {
async execute(args) {
if (args.author.id === args.client.user.id) return;
if (args.channel.id === process.env.SUBMISSION_CHANNEL) {
const user = await prisma.user.findUnique({
const dbUser = await prisma.user.findUnique({
where: {
id: BigInt(args.author.id),
},
});
if (!user) {
if (!dbUser) {
const botmessage = await args.channel.send({
content: "You are not registered! Please register with `/register`.",
messageReference: {
Expand All @@ -48,18 +48,13 @@ module.exports = {
})
.then(async (obj) => {
const user = args.author;
let dbUser = prisma.user.findUnique({
where: {
id: BigInt(args.author.id)
}
})
let embeds = [
{
title: `#${obj.id}`,
description: "Koordinaten: " + obj.location,
url: "https://bte-germany.de",
author: {
name: `${user.username}`,
name: `${dbUser.minecraft_id}`,
},
},
];
Expand Down Expand Up @@ -129,15 +124,15 @@ module.exports = {
await args.delete();
console.log(
new Date().toLocaleString(),
`Created new build by ${args.author.username} with id ${obj.id}`
`Created new build by ${dbUser.minecraft_id} with id ${obj.id}`
);
});
await prisma.user.update({
where: {
id: BigInt(args.author.id),
},
data: {
points: user.points + 10,
points: dbUser.points + 10,
},
});
} else {
Expand Down

0 comments on commit ecb46b4

Please sign in to comment.