Repository navigation
Expand file tree
/
Copy pathbot.js
More file actions
103 lines (78 loc) · 3.01 KB
/
Copy pathbot.js
File metadata and controls
103 lines (78 loc) · 3.01 KB
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
// Show time to next splash - discord.gg/potions
function msToTime(duration) {
var milliseconds = parseInt((duration % 1000) / 100),
seconds = Math.floor((duration / 1000) % 60),
minutes = Math.floor((duration / (1000 * 60)) % 60),
hours = Math.floor((duration / (1000 * 60 * 60)));
// hours = Math.floor((duration / (1000 * 60 * 60)) % 24);
hours = (hours < 10) ? "0" + hours : hours;
minutes = (minutes < 10) ? "0" + minutes : minutes;
seconds = (seconds < 10) ? "0" + seconds : seconds;
return hours + "h " + minutes + "m " ;
}
function RemaningTime(now) {
let closestSplash = new Date(now)
if (now.getHours() < splashDates[days[now.getDay()]]) {
closestSplash.setHours(splashDates[days[now.getDay()]], 0, 0)
}
else {
closestSplash.setHours(splashDates[days[(now.getDay() + 1) % 7]], 0, 0)
closestSplash.setDate(closestSplash.getDate() + 1)
}
const remaning = new Date(closestSplash - now)
return remaning
}
const Discord = require('discord.js');
const client = new Discord.Client();
client.on("ready", () =>{
console.log(`Logged in as ${client.user.tag}!`);
client.user.setPresence({
status: "online", //You can show online, idle....
game: {
name: "nice stories with Farmans", //The message shown
type: "LISTENING" //PLAYING: WATCHING: LISTENING: STREAMING:
}
});
});
const splashDates = {
'Sun': 12,
'Mon': 19,
'Tue': 19,
'Wed': 18,
'Thu': 19,
'Fri': 18,
'Sat': 12,
}
const days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
client.setInterval(function() {
let statsChannel = client.channels.get("684500101267325108"); //honza
statsChannel.setName(`Planned Splash: ${msToTime(RemaningTime(new Date()))}`)
}, 10000);
//trades
client.on("message", (message) => {
if (message.channel.name == '🤝trades' && ! message.content.match(
/IGN:.*\nWant:.*\nHave:.*/i
)) {
message.author.send(`__You had mistake in your message in__ <#693391520862175323>. Your previous message was:\n**${message.content} **\nPlease correct it this way:\nIGN: *[nickname]* *[shift+enter]*\nWant: *[What you want]* *[shift+enter]*\nHave: Coins\nVisit me/Dm me`)
message.delete();
}
})
//auction
client.on("message", (message) => {
if (message.channel.name == '📜auctions' && ! message.content.match(
/Ah.*/i
)) {
message.author.send(`__You had mistake in your message in__ <#692733839830679602>. You previous message was:\n**${message.content}**\nPlease correct it this way:\n/ah *[nickname]* *[AOTD]* *[10hours]* *[500coins]*`)
message.delete();
}
})
//other splashes
client.on("message", (message) => {
if (message.channel.name == '💦other-splashes' && ! message.content.match(
/.*@.*/i
)) {
message.author.send(`__You had mistake in your message in__ <#699326593989869691>. You previous message was:\n**${message.content} **\nPlease use *@Free Splash* or *@Payed Splash*`)
message.delete();
}
})
client.login(process.env.BOT_TOKEN);