Browse Source

Adjust message

ghorsington 3 years ago
parent
commit
51177cc716
1 changed files with 6 additions and 3 deletions
  1. 6 3
      bot/src/plugins/give_role_for_react.ts

+ 6 - 3
bot/src/plugins/give_role_for_react.ts

@@ -9,6 +9,7 @@ import { Message, MessageReaction, ReactionCollector, ReactionEmoji, TextChannel
 import { client } from "src/client";
 
 const ReactRoleMessageParams = t.type({
+    title: t.string,
     message: t.string,
     roleId: t.string
 });
@@ -41,15 +42,17 @@ export class GiveRoleForReact {
 
         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!");
             return;
         }
 
         const msgSendResult = await tryDo(message.channel.send({
             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
             }
         }));