From b7877fea195472269f11ba0d52c3d44c52dae936 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 24 Jun 2017 18:56:38 +0000 Subject: [PATCH] Cats --- XiaoBot.js | 25 ++++++++++++++----------- html/carbonuse.html | 2 +- html/discordbots.html | 2 +- package.json | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/XiaoBot.js b/XiaoBot.js index 4c21cddb..55dcb86e 100644 --- a/XiaoBot.js +++ b/XiaoBot.js @@ -56,7 +56,7 @@ client.on('message', (msg) => { if (!msg.guild) return; if (msg.author.bot || msg.member.hasPermission('ADMINISTRATOR')) return; const topic = msg.guild.defaultChannel.topic || ''; - if (!topic.includes('')) return; + if (!topic.toLowerCase().includes('')) return; if (/(discord(\.gg\/|app\.com\/invite\/|\.me\/))/gi.test(msg.content)) { if (msg.channel.permissionsFor(client.user).has('MANAGE_MESSAGES')) msg.delete(); msg.reply('Invites are prohibited from being posted here.'); @@ -64,15 +64,16 @@ client.on('message', (msg) => { }); client.on('guildMemberAdd', (member) => { - const channel = member.guild.channels.filter((channel) => { - const topic = channel.topic || ''; + const channel = member.guild.channels.filter((c) => { + const topic = c.topic || ''; if (topic.includes('')) return true; + else return false; }).first() || member.guild.channels.find('name', 'member-log'); if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; const parseMsg = (topic) => { - if (!topic || !/()/gi.test(topic)) return ''; - const setting = topic.match(/()/gi)[0]; - return setting.slice(13, setting.length - 1) + if (!topic || !/(.+<\/joinmessage>)/gi.test(topic)) return ''; + const setting = topic.match(/(.+<\/joinmessage>)/gi)[0]; + return setting.slice(13, setting.length - 14) .replace(/(\(member\))/gi, member.user.username) .replace(/(\(server\))/gi, member.guild.name) .replace(/(\(mention\))/gi, member.toString()); @@ -82,15 +83,16 @@ client.on('guildMemberAdd', (member) => { }); client.on('guildMemberRemove', (member) => { - const channel = member.guild.channels.filter((channel) => { - const topic = channel.topic || ''; + const channel = member.guild.channels.filter((c) => { + const topic = c.topic || ''; if (topic.includes('')) return true; + else return false; }).first() || member.guild.channels.find('name', 'member-log'); if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return; const parseMsg = (topic) => { - if (!topic || !/()/gi.test(topic)) return ''; - const setting = topic.match(/()/gi)[0]; - return setting.slice(14, setting.length - 1) + if (!topic || !/(.+<\/leavemessage>)/gi.test(topic)) return ''; + const setting = topic.match(/(.+<\/leavemessage>)/gi)[0]; + return setting.slice(14, setting.length - 15) .replace(/(\(member\))/gi, member.user.username) .replace(/(\(server\))/gi, member.guild.name) .replace(/(\(mention\))/gi, member.toString()); @@ -99,6 +101,7 @@ client.on('guildMemberRemove', (member) => { channel.send(msg || `Bye ${member.user.username}...`); }); + client.on('guildCreate', async (guild) => { console.log(`[GUILD] I have joined ${guild.name}! (${guild.id})`); const guilds = await client.shard.fetchClientValues('guilds.size'); diff --git a/html/carbonuse.html b/html/carbonuse.html index 59566e72..2693f24d 100644 --- a/html/carbonuse.html +++ b/html/carbonuse.html @@ -13,7 +13,7 @@

Notes

  1. Moderation commands require a channel named mod-log to send Ban/Kick/Softban/Unban/Warn logs.
  2. -
  3. To use member join/leave logging, place <memberlog> in the channel topic. Custom messages can be set with <joinmessage:messagegoeshere> and <leavemessage:messagegoeshere>
  4. +
  5. To use member join/leave logging, place <memberlog> in the channel topic. Custom messages can be set with <joinmessage<messagegoeshere</joinmessage> and <leavemessage<messagegoeshere</leavemessage>
  6. To use invite guard, place <inviteguard> in the default channel topic.
  7. Use x;help to view a command list
  8. Visit my home server for more support, or for updates, or if you just want to hang out.
  9. diff --git a/html/discordbots.html b/html/discordbots.html index 431b9613..2c026a5e 100644 --- a/html/discordbots.html +++ b/html/discordbots.html @@ -68,7 +68,7 @@

    Notes

    1. Moderation commands require a channel named mod-log to send Ban/Kick/Softban/Unban/Warn logs.
    2. -
    3. To use member join/leave logging, place <memberlog> in the channel topic. Custom messages can be set with <joinmessage:messagegoeshere> and <leavemessage:messagegoeshere>
    4. +
    5. To use member join/leave logging, place <memberlog> in the channel topic. Custom messages can be set with <joinmessage<messagegoeshere</joinmessage> and <leavemessage<messagegoeshere</leavemessage>
    6. To use invite guard, place <inviteguard> in the default channel topic.
    7. Use x;help to view a command list
    8. Visit my home server for more support, or for updates, or if you just want to hang out.
    9. diff --git a/package.json b/package.json index 2e764b69..1fb66372 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "25.1.0", + "version": "25.1.1", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {