Skip to content

Commit

Permalink
Update to 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chasyumen committed Aug 8, 2022
1 parent d4ad39a commit 4656b21
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 109 deletions.
9 changes: 9 additions & 0 deletions bot/commands/welcome_member.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
{name: "on", description: "メンバー参加通知を有効化します", type: 1, options: []},
{name: "off", description: "メンバー参加通知を無効化します", type: 1, options: []},
{name: "set_channel", description: "チャンネルをセットします。", type: 1, options: [ { "name": "channel", "description": "チャンネル", "type": 7, "required": true }]},
{name: "type", description: "チャンネルをセットします。", type: 1, options: [ { "name": "type", "description": "参加メッセージの種類", "type": 3, "choices": [{"name": "テキスト", "value": "text"}, {"name": "埋め込み", "value": "embed"}], "required": true }]},
]
},
exec: async function (interaction, i, res) {
Expand All @@ -28,6 +29,14 @@ module.exports = {
} else {
return await res.reply("指定されたチャンネルはテキストチャンネルではありません。");
}
} else if (interaction.options.getSubcommand() == "type") {
var type = interaction.options.getString("type");
if (type == "text" || type == "embed") {
await interaction.guild.setdb({memberJoinNotifyType: type});
return await res.reply(`メンバー参加通知の種類をを \`${type == "text" ? "テキスト" : type == "embed" ? "埋め込み" : null}\` に設定しました。`);
} else {
return await res.reply("指定されたオプションは無効です。");
}
}
}
}
13 changes: 12 additions & 1 deletion bot/events/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@ module.exports = {

client.emit("addLogQueue", "MEMBER", "JOIN", new Date(), logString);

return await channel.send(`${member.user.tag}さん!! いらっさい!!`);
if (serverData.memberJoinNotifyType == "embed") {
return await channel.send({embeds: [{
title: `${member.user.tag}さん!! いらっさい!!`,
color: config.colors.default_color,
description: `${member.user.tag}さんが${member.guild.name}に参加しました!`,
thumbnail: {
url: member.user.avatarURL({dynamic: true})
}
}]});
} else {
return await channel.send(`${member.user.tag}さん!! いらっさい!!`);
}
}
}
}
15 changes: 13 additions & 2 deletions bot/events/guildMemberRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ module.exports = {

client.emit("addLogQueue", "MEMBER", "LEAVE", new Date(), logString);
return;
}
}
var logString = `GUILD: \`${member.guild.name} (ID:${member.guild.id})\`, MEMBER: \`${member.user.tag} (ID:${member.user.id})\`, NOTIFY: \`true\``;

client.emit("addLogQueue", "MEMBER", "LEAVE", new Date(), logString);

return await channel.send(`${member.user.tag}さん... いってらっさい...`);
if (serverData.memberJoinNotifyType == "embed") {
return await channel.send({embeds: [{
title: `${member.user.tag}さん... いってらっさい...`,
color: config.colors.default_color,
description: `${member.user.tag}さんが${member.guild.name}から脱退しました...`,
thumbnail: {
url: member.user.avatarURL({dynamic: true})
}
}]});
} else {
return await channel.send(`${member.user.tag}さん... いってらっさい...`);
}
}
}
}
Loading

0 comments on commit 4656b21

Please sign in to comment.