-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (32 loc) · 1.03 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const Discord = require("discord.js");
const process = require("process");
const client = new Discord.Client();
client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on("message", msg => {
if (msg.content === "ping") {
msg.reply("pong");
} else if (msg.content === "pininfo") {
msg.reply("ピン留めくん - ピン留めBOT made by Dischanet Team");
}
});
client.on("messageReactionAdd", reacta => {
if (reacta.emoji.name === "pushpin") {
if (reacta.message.pinnable) {
reacta.message.pin();
} else {
reacta.message.channel.send(
"メッセージをピン留めする権限を持っていません。サーバ管理者に依頼して`メッセージの管理`権限を付与してください。"
);
}
}
});
client.on("messageReactionRemove", reactr => {
if (reactr.emoji.name === "pushpin") {
if (reactr.message.pinnable) {
reactr.message.unpin();
}
}
});
client.login(process.env.DISCORD_BOT_TOKEN);