diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index b95d5db..bc7aa4f 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -17,6 +17,7 @@
     if ((!config.verify.enabled ) || (!config.verify.role)) return interaction.editReply({embeds: [new EmojiEmbed()
         .setTitle("Verify")
         .setDescription(`Verify is not enabled on this server`)
+        .setFooter({text: interaction.member.permissions.has("MANAGE_GUILD") ? "You can enable it by running /settings verify" : ""})
         .setStatus("Danger")
         .setEmoji("CONTROL.BLOCKCROSS")
     ], ephemeral: true, fetchReply: true});
diff --git a/src/reflex/welcome.ts b/src/reflex/welcome.ts
index 5b80fbd..9be71d5 100644
--- a/src/reflex/welcome.ts
+++ b/src/reflex/welcome.ts
@@ -1,41 +1,39 @@
-import log from '../utils/log.js'
 import convertCurlyBracketString from '../utils/convertCurlyBracketString.js'
 import client from '../utils/client.js';
+import EmojiEmbed from '../utils/generateEmojiEmbed.js';
 
 export async function callback(_, member) {
     if (member.bot) return
     let config = await client.database.guilds.read(member.guild.id);
     if (!config.welcome.enabled) return
 
-    if (!config.welcome.verificationRequired.role) {
-        if (config.welcome.welcomeRole) {
-            try {
-                await member.roles.add(config.welcome.welcomeRole)
-            } catch (err) {
-                console.error(err)
-            }
-        }
-    }
-
-    if (!config.welcome.verificationRequired.message && config.welcome.channel) {
+    if (config.welcome.channel) {
         let string = config.welcome.message
         if (string) {
             string = await convertCurlyBracketString(string, member.id, member.displayName, member.guild.name, member.guild.members)
-
             if (config.welcome.channel === 'dm') {
                 try {
-                    await member.send(string)
-                } catch (err) {
-                    console.error(err)
-                }
+                    await member.send({
+                        embeds: [new EmojiEmbed()
+                            .setDescription(string)
+                            .setStatus('Success')
+                        ]
+                    })
+                } catch {}
             } else {
-                let channel = await member.client.channels.fetch(config.welcome.channel)
+                let channel = await member.guild.channels.fetch(config.welcome.channel)
                 if (channel.guild.id !== member.guild.id) return
                 if (!channel) return
                 try {
-                    await channel.send(string)
+                    await channel.send({
+                        embeds: [new EmojiEmbed()
+                            .setDescription(string)
+                            .setStatus('Success')
+                        ],
+                        content: (config.welcome.ping ? `<@${config.welcome.ping}>` : '') + `<@${member.id}>`
+                    })
                 } catch (err) {
-                    console.error(err)
+                    console.error(err) // SEN
                 }
             }
         }
