ソースを参照

Adjust message

ghorsington 3 年 前
コミット
51177cc716
1 ファイル変更6 行追加3 行削除
  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
             }
         }));