-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
95 lines (73 loc) · 2.45 KB
/
index.ts
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
import * as dotenv from "dotenv";
dotenv.config();
import * as Honeybadger from "honeybadger";
import Croupier from "./croupier";
let croupier: Croupier;
async function main(): Promise<any> {
Honeybadger.configure({
apiKey: process.env.HONEYBADGER_API_KEY,
});
process.env.DEVELOPMENT = "true";
croupier = new Croupier({
botUsername: "devcroupier",
paperKey1: process.env.DEV_CROUPIER_PAPERKEY1,
paperKey2: process.env.DEV_CROUPIER_PAPERKEY2,
}, {
mongoDbHost: process.env.MONGODB_HOST,
mongoDbIsCluster: true,
mongoDbPassword: process.env.MONGODB_PASSWORD,
mongoDbUsername: process.env.MONGODB_USERNAME,
});
croupier.copyRulesToKeybase().catch((e) => {
console.log("Could not copy latest RULES.md to Keybase because ", e);
});
let giveaway: any;
setTimeout(() => {
console.log("Timeout called...");
const channel: ChatChannel = {
membersType: "team",
name: "mkbot",
public: false,
topicName: "cryptosnipe",
topicType: "chat",
};
let active1: boolean = false;
Object.keys(croupier.activeSnipes).forEach((stringifiedChannel: string) => {
const ch: ChatChannel = JSON.parse(stringifiedChannel);
if (ch.name === "mkbot" && ch.topicName === "cryptosnipe") {
active1 = true;
}
});
if (!active1) {
croupier.bot1.chat.sendMoneyInChat("cryptosnipe", "mkbot", "2.02",
croupier.botUsername, "for @here countdown:3600", false);
}
giveaway = setInterval(() => {
console.log("Interval called");
let active: boolean = false;
Object.keys(croupier.activeSnipes).forEach((stringifiedChannel: string) => {
const ch: ChatChannel = JSON.parse(stringifiedChannel);
if (ch.name === "mkbot" && ch.topicName === "cryptosnipe") {
if (croupier.activeSnipes[stringifiedChannel]) {
active = true;
}
}
});
if (!active) {
croupier.bot1.chat.sendMoneyInChat("cryptosnipe", "mkbot", "2.02",
croupier.botUsername, "for @here countdown:3600", false);
}
}, 1000 * 60 * 60 * 2.5);
}, 1000 * 10);
await croupier.run(true);
}
async function shutDown(): Promise<any> {
await croupier.shutdown();
process.exit();
}
process.on("SIGINT", shutDown);
process.on("SIGTERM", shutDown);
process.on("uncaughtException", (exception) => {
Honeybadger.notify(exception);
});
main();