generated from lucxjo/template
(#2) Members can now be in multiple guilds
Signed-off-by: Louis Hollingworth <louis@hollingworth.ch>
This commit is contained in:
parent
e8f797d1e0
commit
530e99a7d0
4 changed files with 27 additions and 22 deletions
|
|
@ -6,14 +6,7 @@ import {
|
|||
PermissionsBitField,
|
||||
Role,
|
||||
} from "discord.js";
|
||||
import {
|
||||
Discord,
|
||||
Guard,
|
||||
GuardFunction,
|
||||
Slash,
|
||||
SlashGroup,
|
||||
SlashOption,
|
||||
} from "discordx";
|
||||
import { Discord, Slash, SlashGroup, SlashOption } from "discordx";
|
||||
import { prisma } from "../main.js";
|
||||
|
||||
@Discord()
|
||||
|
|
@ -108,24 +101,28 @@ export class AdminCmds {
|
|||
) {
|
||||
let mem = await prisma.member.findUnique({
|
||||
where: {
|
||||
id: member.id,
|
||||
dgid_duid: {
|
||||
duid: member.id,
|
||||
dgid: member.guild.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (mem) {
|
||||
await prisma.member.update({
|
||||
where: {
|
||||
id: member.id,
|
||||
id: mem.id,
|
||||
},
|
||||
data: {
|
||||
name: mem.name != member.displayName ? member.displayName : undefined,
|
||||
booster_role_id: role.id,
|
||||
name: member.displayName,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
await prisma.member.create({
|
||||
data: {
|
||||
id: member.id,
|
||||
duid: member.id,
|
||||
dgid: interaction.guildId!,
|
||||
name: member.displayName,
|
||||
booster_role_id: role.id,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue