Skip to content

Commit 91f16e8

Browse files
committed
update prefix resolver example
1 parent 8bb6057 commit 91f16e8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/website/docs/guide/02-commands/04-message-commands.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,17 @@ import { commandkit } from 'commandkit';
9898
import { database } from '../database'; // This is a mock database
9999

100100
commandkit.setPrefixResolver(async (message) => {
101+
if (!message.guildId) {
102+
return '!'; // Fallback to '!' if command is used in a DM
103+
}
104+
101105
const guildSettings = await database.findUnique({
102-
where: { guildId },
106+
where: {
107+
guildId: message.guildId,
108+
},
109+
select: {
110+
prefix: true,
111+
},
103112
});
104113

105114
return guildSettings?.prefix ?? '!'; // Fallback to '!' if no prefix is found

0 commit comments

Comments
 (0)