54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
|
const prisma = require("../clients/prisma");
|
||
|
const megisTypes = {
|
||
|
0: "bcaa megis PoroSad",
|
||
|
7: "lemon sugar free megis BroBalt",
|
||
|
15: "sugar free megis! PogChamp",
|
||
|
30: "normal megis!!! AngelThump",
|
||
|
};
|
||
|
|
||
|
const command = {
|
||
|
name: "megis",
|
||
|
desc: "economy command: get megis once per hour",
|
||
|
restricted: false,
|
||
|
mod: false,
|
||
|
run: async (client, msg) => {
|
||
|
const megis =
|
||
|
Object.keys(megisTypes)[
|
||
|
Math.floor(Math.random() * Object.keys(megisTypes).length)
|
||
|
];
|
||
|
|
||
|
const user = await prisma.user.upsert({
|
||
|
where: {
|
||
|
userId: msg.senderUserID,
|
||
|
},
|
||
|
update: {
|
||
|
megis: {
|
||
|
update: {
|
||
|
megis: {
|
||
|
increment: parseInt(megis),
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
create: {
|
||
|
userId: msg.senderUserID,
|
||
|
megis: {
|
||
|
create: {
|
||
|
megis: parseInt(megis),
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
include: {
|
||
|
megis: true,
|
||
|
},
|
||
|
});
|
||
|
|
||
|
await client.say(
|
||
|
msg.channelName,
|
||
|
`${msg.displayName}, +${megis}! ${megisTypes[megis]} Total megis: ${user.megis.megis}`
|
||
|
);
|
||
|
},
|
||
|
};
|
||
|
|
||
|
module.exports = { command };
|