|
@@ -9,6 +9,7 @@ import { Message, MessageReaction, ReactionCollector, ReactionEmoji, TextChannel
|
|
import { client } from "src/client";
|
|
import { client } from "src/client";
|
|
|
|
|
|
const ReactRoleMessageParams = t.type({
|
|
const ReactRoleMessageParams = t.type({
|
|
|
|
+ title: t.string,
|
|
message: t.string,
|
|
message: t.string,
|
|
roleId: t.string
|
|
roleId: t.string
|
|
});
|
|
});
|
|
@@ -41,15 +42,17 @@ export class GiveRoleForReact {
|
|
|
|
|
|
const params = opts.result;
|
|
const params = opts.result;
|
|
|
|
|
|
- if (!message.guild?.roles.cache.has(params.roleId)) {
|
|
|
|
|
|
+ const role = message.guild?.roles.cache.get(params.roleId);
|
|
|
|
+
|
|
|
|
+ if (!role) {
|
|
await this.sendDM(message.author, "Sorry, the role ID is not a valid role on the server!");
|
|
await this.sendDM(message.author, "Sorry, the role ID is not a valid role on the server!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
const msgSendResult = await tryDo(message.channel.send({
|
|
const msgSendResult = await tryDo(message.channel.send({
|
|
embed: {
|
|
embed: {
|
|
- title: `React with ${REACT_EMOTE} to gain role`,
|
|
|
|
- description: params.message,
|
|
|
|
|
|
+ title: params.title,
|
|
|
|
+ description: `${params.message}\n\nReact with ${REACT_EMOTE} to gain role ${role.toString()}`,
|
|
color: MSG_COLOR
|
|
color: MSG_COLOR
|
|
}
|
|
}
|
|
}));
|
|
}));
|