This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
206 lines (186 loc) · 5.56 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
const http = require('http');
http
.createServer(function(req, res) {
res.write('OK');
res.end();
})
.listen(8080);
const fs = require('fs');
const Discord = require('discord.js');
const client = new Discord.Client();
client.commands = new Discord.Collection();
const commandFiles = fs
.readdirSync('./commands')
.filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
const { prefix, zaimuid } = require('./config.json');
client.on('ready', message => {
console.log('botが起動しました');
});
const Keyv = require('keyv');
const sqlite = new Keyv('sqlite://db.sqlite', { table: 'db' });
client.on('guildMemberAdd', async member => {
const gjdb = (await sqlite.get(member.id)) || {
sm: 0,
join: 0
};
if (gjdb.sm == 0 && gjdb.join == 0) {
gjdb.join += 1;
gjdb.sm += 10000;
sqlite.set(member.id, gjdb);
}
});
client.on('message', async message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content
.slice(prefix.length)
.trim()
.split(/ +/);
const commandName = args.shift().toLowerCase();
const db = (await sqlite.get(message.author.id)) || {
nd: 0,
sm: 0,
join: 0,
fishga: 0,
fishco: 0,
fishun: 0,
fishra: 0,
twowc: 0,
twolc: 0,
twows: 0,
twols: 0
};
const homu = (await sqlite.get('823130006480748556')) || { sm: 0 };
const command =
client.commands.get(commandName) ||
client.commands.find(
cmd => cmd.aliases && cmd.aliases.includes(commandName)
);
if (!command) return;
try {
command.execute(message, args);
} catch (error) {
var embed = new Discord.MessageEmbed()
.setColor('#0099FF')
.setTitle(':x: 失敗')
.setDescription(`\`\`\`${error}\`\`\``)
.setTimestamp();
message.channel.send(embed);
}
});
client.on('message', async message => {
if (message.author.bot) {
if (message.author.id == '159985870458322944') {
if (message.content.startsWith('^levelup')) {
message.delete();
const lvupdata = message.content.split(',');
message.channel.send(
`<@!${lvupdata[1]}>さんが**Lv.${
lvupdata[2]
}**になりました\nおめでとうございます!`
);
if (lvupdata[2] === '3') {
var lv3mem = await message.guild.members.fetch(lvupdata[1]);
lv3mem.roles.add('823579630782906419');
message.channel.send(
'Lv.3に到達したので、宣伝が利用可能になりました!'
);
}
}
}
if (message.author.id == '302050872383242240') {
if (
message.embeds[0].color == '2406327' &&
message.embeds[0].url == 'https://disboard.org/' &&
(message.embeds[0].description.match(/表示順をアップしたよ/) ||
message.embeds[0].description.match(/Bump done/) ||
message.embeds[0].description.match(/Bump effectué/) ||
message.embeds[0].description.match(/Bump fatto/) ||
message.embeds[0].description.match(/Podbito serwer/))
) {
const noti = await message.channel.send({
embed: {
title: 'Bumpが実行されました!',
description: '再度実行可能になったらお知らせします。',
color: 7506394
}
});
noti.delete({ timeout: 60000 });
setTimeout(() => {
message.channel.send({
embed: {
title: 'Bumpできます!',
description: 'コマンド`!d bump`を送信できます。',
color: 7506394
}
});
}, 7200000);
} else if (
message.embeds[0].color == '15420513' &&
message.embeds[0].url == 'https://disboard.org/' &&
(message.embeds[0].description.match(
/このサーバーを上げられるようになるまで/
) ||
message.embeds[0].description.match(
/あなたがサーバーを上げられるようになるまで/
))
) {
var splcontent_a = message.embeds[0].description.split('と');
console.log(splcontent_a[1]);
var splcontent_b = splcontent_a[1].split('分');
console.log(splcontent_b[0]);
var waittime_bump = splcontent_b[0];
message.channel.send({
embed: {
title: 'Bumpに失敗したようです…',
description: waittime_bump + '分後にもう一度お試しください。',
color: 7506394
}
});
}
}
if (message.author.id == '761562078095867916') {
if (message.embeds[0].description.match(/をアップしたよ/)) {
const unoti = await message.channel.send({
embed: {
title: 'Upが実行されました!',
description: '再度実行可能になったらお知らせします。',
color: 7506394
}
});
unoti.delete({ timeout: 60000 });
setTimeout(() => {
message.channel.send({
embed: {
title: 'Upできます!',
description: 'コマンド`/dissoku up!`を送信できます。',
color: 7506394
}
});
}, 3600000);
} else if (
message.embeds[0].title ==
'ディスコード速報 | Discordサーバー・友達募集掲示板' &&
message.embeds[0].url == 'https://dissoku.net/' &&
message.embeds[0].description.match(/間隔をあけてください/)
) {
var splcontent_a = message.embeds[0].description.split('(');
console.log(splcontent_a[1]);
var splcontent_b = splcontent_a[1].split('分');
console.log(splcontent_b[0]);
var waittime_up = splcontent_b[0];
message.channel.send({
embed: {
title: 'Upに失敗したようです…',
description: waittime_up + '分後にもう一度お試しください。',
color: 7506394
}
});
}
}
}
});
client.login(process.env.TOKEN);