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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
|
/****************************************
*
* AstralMod: Moderation bot for AstrelTaser Cantral and other Discord servers
* Copyright (C) 2017 Victor Tran, Rylan Arbour and Alee14
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
const amVersion = "1.1.1";
const Discord = require('discord.js');
const api = require('./keys.json');
const fs = require('fs');
const client = new Discord.Client();
var expletiveFilter = false;
var doModeration = {};
var panicMode = {};
var lastMessages = {};
var sameMessageCount = {};
var smallMessageCount = {};
var lastUserInteraction = {};
var pendingNicks = {};
var pendingNickTimeout = {};
var suggestStates = {};
var poweroff = false;
var interrogMember = null;
var bulletinTimeout;
var runningCommands = true;
var bananaFilter = false;
var allowPrepChat = true;
var membersPlaced = [];
var numberOfMembersTried = 0;
var actionMember = {};
var actioningMember = {};
var actionStage = {};
var actionToPerform = {};
var dispatcher;
var connection;
const suggestionStartMessage = "**Make a suggestion**\n" +
"Welcome to the suggestion process! Please read this before you continue.\n" +
"Here's how this will work.\n\n" +
"- I'll walk you through the process of creating a suggestion on the suggestions channel.\n" +
"- Just respond to my prompts by typing a message in this DM and sending it.\n" +
"- At any time, simply respond with `q` to cancel the suggestion.\n\n" +
"However, please be aware of the following:\n" +
"- Your Discord Username will be recorded and sent along with the suggestion.\n" +
"- Your suggestion will be publicly visible.\n" +
"- Any misuse of this command, including (but not limited to) spam will lead to appropriate discipline from staff.\n\n" +
"**Here are some things not to suggest because they will be immediately declined.** This counts as misuse of the suggest command, so hit `q` now if you were going to suggest one of these.\n" +
"- New text/voice channels.\n" +
"- New bots.\n\n" +
"Wait 30 seconds, and then respond with `y` if you understood the above."
function setGame() {
var presence = {};
presence.game = {};
presence.status = "online";
presence.afk = false;
switch (Math.floor(Math.random() * 1000) % 35) {
case 0:
presence.game.name = "with ban buttons";
break; //SCRUATCHO
case 1:
presence.game.name = "Fighting JXBot";
break;
case 2:
presence.game.name = "Annoy Victor";
break;
case 3:
presence.game.name = "with an internal bug";
break;
case 4:
presence.game.name = "around";
break;
case 5:
presence.game.name = "bot games";
break;
case 6:
presence.game.name = "with ones and zeroes";
break;
case 7:
presence.game.name = "thyShell";
break;
case 8:
presence.game.name = "with supa weapon";
break;
case 9:
presence.game.name = "solving puzzles";
break;
case 10:
presence.game.name = "rewinding time";
break;
case 11:
presence.game.name = "checking archives";
break;
case 12:
presence.game.name = "being unbreakable";
break;
case 13:
presence.game.name = "sandwiches";
break;
case 14:
presence.game.name = "drawing pokemon";
break;
case 15:
presence.game.name = "obsessing";
break;
case 16:
presence.game.name = "the waiting game";
break;
case 17:
presence.game.name = "bending space";
break;
case 18:
presence.game.name = "with hexagons";
break;
case 19:
presence.game.name = "with music";
break;
case 20:
presence.game.name = "being a ninja";
break;
case 21:
presence.game.name = "with Unicode characters";
break;
case 22:
presence.game.name = "bot:help for more info";
break;
case 26:
presence.game.name = "trying to DJ";
break;
case 27:
presence.game.name = "Sausages";
break;
case 28:
presence.game.name = "59 6f 75 20 64 65 63 6f 64 65 64 20 74 68 69 73 20 6d 65 73 73 61 67 65 21";
break;
case 29:
case 23:
case 24:
case 25:
presence.game.name = "v." + amVersion;
break;
case 30:
presence.game.name = "Locked and loaded!";
break;
case 31:
presence.game.name = "Android Pay";
break;
case 32:
presence.game.name = "translating English into Dutch";
break;
case 33:
presence.game.name = "translating Dutch into English";
break;
case 34:
presence.game.name = "Hallo hoe gaat het vandaag?";
break;
}
client.user.setPresence(presence);
}
function getUserString(user) {
var u = user;
if (user.user != null) {
u = user.user;
}
return u.tag;
}
function handleSuggest(message) {
var state = suggestStates[message.author.id];
if (state.lastEmbed != null) {
state.lastEmbed.delete();
state.lastEmbed = null;
}
if (message.content.toLowerCase() == "q") {
//Abort
var embed = new Discord.RichEmbed("test");
embed.setAuthor("[CANCELLED]");
embed.setColor("#FF0000");
embed.setDescription("\u200B");
var title;
if (state.title == null) {
title = "~~Title~~";
} else {
title = "~~" + state.title + "~~";
}
var suggestion;
if (state.suggestion == null) {
suggestion = "~~Suggestion~~";
} else {
suggestion = "~~" + state.suggestion + "~~";
}
embed.addField(title, suggestion);
message.author.send("", {embed: embed});
message.author.send(":octagonal_sign: Suggestion process cancelled.");
state = null;
} else {
switch (state.state) {
case 1: //Welcome to the suggestion tool
if (message.content.toLowerCase() == "y") {
if (state.startTime.getTime() + 30000 > (new Date()).getTime()) {
message.author.send(":arrow_up: Before you can make a suggestion, you'll need to read the above carefully. Please take time to read it again, and then you can continue with your suggestion.");
} else {
//Continue
state.state = 2;
var embed = new Discord.RichEmbed("test");
embed.setAuthor("Suggestion");
embed.setColor("#00CA00");
embed.setDescription("\u200B");
if (state.suggestion == null) {
embed.addField("__Title__\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_", "Suggestion");
} else {
embed.addField("__Title__\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_", state.suggestion);
}
embed.setFooter("User ID: " + message.author.id);
message.author.send("", {embed: embed}).then(function(message) {
state.lastEmbed = message;
});
message.author.send("What's the title for this suggestion? It'll need to be 30 characters or less.");
}
} else {
//Abort
message.author.send(":octagonal_sign: Suggestion process cancelled.");
state = null;
}
break;
case 2: //Title
if (message.content.length > 30) {
message.author.send(":no_entry_sign: Your response needs to be 30 characters or less.");
} else if (containsExpletive(message.content)) {
message.author.send(":no_entry_sign: This looks like spam. And we don't like spam. Unless it's in a can. Try again, and be a bit nicer please.");
} else if (message.content.length < 3) {
message.author.send(":no_entry_sign: That title seems WAY too short. Make it a bit longer, please?");
} else {
state.title = message.content;
if (state.suggestion == null) {
state.state = 3;
var embed = new Discord.RichEmbed("test");
embed.setAuthor("Suggestion");
embed.setColor("#00CA00");
embed.setDescription("\u200B");
embed.addField(state.title, "__Suggestion__\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_");
message.author.send("", {embed: embed}).then(function(message) {
state.lastEmbed = message;
});
message.author.send("What is your suggestion? Be sure to be cohesive and to back your suggestion up with evidence.");
} else {
state.state = 4;
var embed = new Discord.RichEmbed("test");
embed.setAuthor("Suggestion");
embed.setColor("#00CA00");
embed.setDescription("\u200B");
embed.addField(state.title, state.suggestion);
message.author.send("", {embed: embed}).then(function(message) {
state.lastEmbed = message;
});
message.author.send("Ready to submit this suggestion?");
}
}
break;
case 3: //Suggestion
if (message.content.length > 1000) {
message.author.send(":no_entry_sign: Your response needs to be 1000 characters or less.");
} else if (containsExpletive(message.content)) {
message.author.send(":no_entry_sign: This looks like spam. And we don't like spam. Unless it's in a can. Try again, and be a bit nicer please.");
} else {
state.suggestion = message.content;
state.state = 4;
var embed = new Discord.RichEmbed("test");
embed.setAuthor("Suggestion");
embed.setColor("#00CA00");
embed.setDescription("\u200B");
embed.addField(state.title, state.suggestion);
message.author.send("", {embed: embed}).then(function(message) {
state.lastEmbed = message;
});
message.author.send("Ready to submit this suggestion?");
}
break;
case 4: //Confirm
if (message.content.toLowerCase().startsWith("y")) {
//Submit
var embed = new Discord.RichEmbed("test");
embed.setAuthor(message.author.username, message.author.displayAvatarURL);
embed.setColor("#00CA00");
embed.addField(state.title, state.suggestion);
embed.setFooter("Submitted at " + new Date().toUTCString());
var channel;
if (state.guild == 368206021526552576) { //APHC
channel = client.channels.get("369224177435017226");
} else if (state.guild == 297057036292849680) { //ALA
channel = client.channels.get("308547573382250497");
}
channel.send("", {embed: embed});
state = null;
message.author.send(":white_check_mark: OK: Your suggestion has been submitted to our staff. Thanks! :D");
} else if (message.content.toLowerCase() == "r" || message.content.toLowerCase() == "start over" || message.content.toLowerCase() == "retry" || message.content.toLowerCase() == "no" ||
message.content.toLowerCase() == "restart") {
state.state = 2;
state.suggestion = null;
state.startTime = new Date();
message.author.send(suggestionStartMessage);
} else if (message.content.toLowerCase == "cancel") {//Abort
var embed = new Discord.RichEmbed("test");
embed.setAuthor("[CANCELLED]");
embed.setColor("#FF0000");
embed.setDescription("\u200B");
var title;
if (state.title == null) {
title = "~~Title~~";
} else {
title = "~~" + state.title + "~~";
}
var suggestion;
if (state.suggestion == null) {
suggestion = "~~Suggestion~~";
} else {
suggestion = "~~" + state.suggestion + "~~";
}
embed.addField(title, suggestion);
message.author.send("", {embed: embed});
message.author.send(":octagonal_sign: Suggestion process cancelled.");
} else {
message.author.send("Sorry, I didn't quite get that. Respond with `yes` or `retry`.");
}
break;
}
}
suggestStates[message.author.id] = state;
}
function handleAction(message) {
var msg = message.content;
var member = actionMember[message.guild.id];
if (actionStage[message.guild.id] == 0) { //Select Action
if (msg == "cancel") {
message.channel.send(':gear: Cancelled. Exiting action menu.');
member = null;
actioningMember[message.guild.id] = null;
} else if ((msg.toLowerCase() == "interrogate" || msg.toLowerCase() == "i") && (message.guild.id == 368206021526552576 || message.guild.id == 287937616685301762 || message.guild.id == 305039436490735627)) {
if (message.guild.id == 368206021526552576) {
member.addRole(member.guild.roles.get("292630494254858241"));
} else if (message.guild.id == 287937616685301762) {
member.addRole(member.guild.roles.get("319847521440497666"));
} else if (message.guild.id == 305039436490735627) {
member.addRole(member.guild.roles.get("326250571692769281"));
}
member.setVoiceChannel(member.guild.channels.get(member.guild.afkChannelID));
message.channel.send(':gear: ' + getUserString(member) + " has been placed in interrogation.");
member = null;
actioningMember[message.guild.id] = null;
} else if ((msg.toLowerCase() == "jail" || msg.toLowerCase() == "j") && (message.guild.id == 368206021526552576 || message.guild.id == 263368501928919040 || message.guild.id == 305039436490735627)) {
if (message.guild.id == 368206021526552576) {
member.addRole(member.guild.roles.get("373687639640899594"));
} else if (message.guild.id == 305039436490735627) {
member.addRole(member.guild.roles.get("310196007919157250"));
} else {
member.addRole(member.guild.roles.get("267731524734943233"));
}
member.setVoiceChannel(member.guild.channels.get(member.guild.afkChannelID));
message.channel.send(':gear: ' + getUserString(member) + " has been placed in jail.");
member = null;
actioningMember[message.guild.id] = null;
} else if ((msg.toLowerCase() == "mute" || msg.toLowerCase() == "m") && (message.guild.id == 368206021526552576 || message.guild.id == 305039436490735627)) {
var roleId;
if (message.guild.id == 368206021526552576) {
roleId = "294782894625390593";
} else if (message.guild.id == 305039436490735627) {
roleId = "309883481024888842";
}
if (member.roles.get(roleId)) {
member.removeRole(member.roles.get(roleId));
message.channel.send(':gear: ' + getUserString(member) + " has been removed from time out.");
member = null;
actioningMember[message.guild.id] = null;
} else {
member.addRole(member.guild.roles.get(roleId));
message.channel.send(':gear: ' + getUserString(member) + " has been placed on time out.");
member = null;
actioningMember[message.guild.id] = null;
}
} else if (msg.toLowerCase() == "kick" || msg.toLowerCase() == "k") {
actionStage[message.guild.id] = 1;
message.channel.send(":gear: Enter reason for kicking " + getUserString(member) + " or `cancel`.");
actionToPerform[message.guild.id] = "kick";
} else if (msg.toLowerCase() == "ban" || msg.toLowerCase() == "b") {
actionStage[message.guild.id] = 1;
message.channel.send(":gear: Enter reason for banning " + getUserString(member) + " or `cancel`.");
actionToPerform[message.guild.id] = "ban";
} else if (msg.toLowerCase() == "nick" || msg.toLowerCase == "nickname" || msg.toLowerCase() == "n") {
actionStage[message.guild.id] = 1;
message.channel.send(":gear: Enter new nickname for " + getUserString(member) + ". Alternatively type `clear` or `cancel`.");
actionToPerform[message.guild.id] = "nick";
} else {
message.channel.send(':gear: Unknown command. Exiting action menu.');
member = null;
actioningMember[message.guild.id] = null;
}
message.delete();
} else if (actionStage[message.guild.id] == 1) {
if (msg == "cancel") {
message.channel.send(':gear: Cancelled. Exiting action menu.');
member = null;
actioningMember[message.guild.id] = null;
} else if (actionToPerform[message.guild.id] == "kick") {
member.kick(msg).then(function(member) {
message.channel.send(':gear: ' + getUserString(member) + " has been kicked from the server.");
member = null;
actioningMember[message.guild.id] = null;
}).catch(function() {
message.channel.send(':gear: ' + getUserString(member) + " couldn't be kicked from the server. Exiting action menu");
member = null;
actioningMember[message.guild.id] = null;
});
} else if (actionToPerform[message.guild.id] == "ban") {
member.ban(msg).then(function(member) {
message.channel.send(':gear: ' + getUserString(member) + " has been banned from the server.");
member = null;
actioningMember[message.guild.id] = null;
}).catch(function() {
message.channel.send(':gear: ' + getUserString(member) + " couldn't be banned from the server. Exiting action menu");
member = null;
actioningMember[message.guild.id] = null;
});
} else if (actionToPerform[message.guild.id] == "nick") {
if (msg == "clear") {
msg = "";
}
member.setNickname(msg).then(function(member) {
message.channel.send(':gear: ' + getUserString(member) + " has changed his nickname.");
member = null;
actioningMember[message.guild.id] = null;
}).catch(function() {
message.channel.send(':gear: ' + getUserString(member) + " couldn't have his nickname changed. Exiting action menu");
member = null;
actioningMember[message.guild.id] = null;
});
}
message.delete();
}
actionMember[message.guild.id] = member;
}
function playAudio() {
dispatcher = connection.playFile("forecastvoice.mp3");
dispatcher.on('end', playAudio);
}
client.on('ready', () => {
console.log("[STATUS] AstralMod " + amVersion + " - locked and loaded!");
client.setInterval(setGame, 300000);
setGame();
//Jump into waiting room
client.channels.get("368501920417185792").join().then(function(conn) {
console.log("[STATUS] AstralMod is connected to the waiting room");
connection = conn;
playAudio();
});
//Get all messages in #suggestions
client.channels.get("369224177435017226").fetchMessages({
limit: 100
});
});
function nickExpletiveCheck(phrase) {
if (containsExpletive(phrase)) return true;
var exp = phrase.search(/(hentai|asl|a55|ass|anal|ballsack|bong|cocaine|cum|dick|dp|pedo|pube|rape|scat|semen|testes|tits|anus|arse|bitch|b1tch|b17ch|boob|cock|foreskin|hardon|jerk|✓ᵛᵉʳᶦᶠᶦᵉᵈ)+/i);
if (exp == -1) {
return false;
} else {
return true;
}
}
function containsExpletive(phrase) {
var exp = phrase.search(/\b(shit|shite|shitty|bullshit|fuck|fucking|ass|penis|cunt|faggot|damn|wank|wanker|nigger|bastard|shut up|piss|vagina|thisisnotarealwordbutatestword)+\b/i);
if (exp == -1) {
return false;
} else {
return true;
}
}
function getBoshyTime(guild) {
if (guild.emojis.exists('name', 'vtBoshyTime')) {
return "<:vtBoshyTime:" + guild.emojis.find('name', 'vtBoshyTime').id + ">";
} else {
return ":warning:";
}
}
function isMod(member) {
if (member != null) {
if (member.roles.find("name", "Admoon") || member.roles.find("name", "Maderator") || member.roles.find("name", "maderators") || member.roles.find("name", "Mod") || member.roles.find("name", "Dixcord:Admoon") || member.roles.find("name", "Dixcord:Mad") || member.roles.find("name", "Pseudo-Moderator") || member.roles.find("name", "Staffe") || member.roles.find("name", "The Crew") || member.roles.find("name", "Mini-Mods")) {
return true;
} else {
return false;
}
} else {
return false;
}
}
//var prank = true;
function postBulletin() {
var channel = client.channels.get("369303454956650496");
switch (Math.floor(Math.random() * 1000) % 6) {
case 0:
channel.send(":warning: PING! Don't forget, the **no expletive** rule is now in effect. Thanks!");
break;
case 1:
channel.send(":warning: PING! If you missed out, don't forget to check out the AstrelTaser channel for a review of the chat!");
break;
case 2:
channel.send(":warning: PING! Thanks for coming to the chat everyone!");
break;
case 3:
channel.send(":warning: PING! Welcome to AstrelTaser Cantral!");
break;
case 4:
channel.send(":warning: PING! For anyone who asks: we're not doing rotations!");
break;
case 5:
channel.send(":warning: PING! Hip Hip Hooray for the mods!");
break;
}
}
function handleDM(message) {
if (suggestStates[message.author.id] != null) {
handleSuggest(message);
return;
} else {
var msg = message.content;
var command = msg;
if (msg.toLowerCase().startsWith("mod:") || msg.toLowerCase().startsWith("bot:")) {
command = msg.substr(4);
}
}
}
function messageChecker(oldMessage, newMessage) {
var message;
if (newMessage == null) {
message = oldMessage;
} else {
message = newMessage;
}
var msg = message.content;
if (message.guild == null) {
handleDM(message);
return;
}
if (!runningCommands) {
if ((message.author.id == 242775871059001344 || message.author.id == 175760550070845451 || message.author.id == 209829628796338176) && msg == "mod:cmd") {
runningCommands = true;
message.reply(':white_check_mark: OK: AstralMod commands have been enabled.');
}
return;
}
if (actioningMember[message.guild.id] == message.author) {
handleAction(message);
}
if (doModeration[message.guild.id] == null) {
if (message.guild.id == 140241956843290625) { //Check if this is TGL
doModeration[message.guild.id] = false;
} else {
doModeration[message.guild.id] = true;
}
}
if (panicMode[message.guild.id] == null) {
panicMode[message.guild.id] = false;
}
if (panicMode[message.guild.id]) {
if (msg == "mod:panic" && isMod(message.member)) {
message.channel.send(':rotating_light: Panic mode is now off.');
panicMode[message.guild.id] = false;
console.log("[STATUS] Panic off.");
message.delete();
return;
}
if (!isMod(message.member)) {
message.delete();
}
}
if (msg == "mod:banana" && (message.author.id == 135169858689171456 || message.author.id == 242775871059001344)) {
bananaFilter = !bananaFilter;
if (bananaFilter) {
message.reply(":white_check_mark: Banana filter is now on.");
message.delete();
} else {
message.reply(":white_check_mark: Banana filter is now off.");
message.delete();
}
} else {
if (message.author.id == 135169858689171456 && bananaFilter) {
if (message.attachments != null) {
var block = false;
for (let [key, attachment] of message.attachments) {
if (attachment.height != null) {
block = true;
break;
}
}
if (block) {
message.reply("Nope.");
message.delete();
return;
}
}
}
}
if (!isMod(message.member) && msg.indexOf("@everyone") != -1 || msg.indexOf("@here") != -1 && message.guild.id == 368206021526552576) {
message.reply("Nice try... but we disabled that.");
}
if (msg == "kden") {
message.channel.send("live");
}
if (msg.toLowerCase().includes("assmod")) {
if (message.guild.id == 368206021526552576) {
message.reply(":no_entry_sign: HEY! WHY ARE YOU CALLING ME THAT THAT'S IT YOUR JAILED BUDDY... nah i'm joking");
} else {
message.reply("Umm okay why are you making fun of me.");
}
}
if (message.author.id != 280495817901473793 && !message.author.bot) {
//Server Detection:
//AstrelTaser Cantral: 368206021526552576
//AKidFromTheUK : 285740807854751754
if (doModeration[message.guild.id]) { //Check if we should do moderation on this server
if (expletiveFilter || message.guild.id == 278824407743463424) { //Check for expletives only if on AstrelTaser Cantral or theShell
//Check for expletives
var exp;
if (containsExpletive(msg)) { //Gah! They're not supposed to say that!
console.log("[FILTER] Expletive caught from " + getUserString(message.author));
switch (Math.floor(Math.random() * 1000) % 7) {
case 0:
message.reply("I'm very disappointed in you. This is me <:angryvt:282006699802361856>");
break;
case 1:
message.reply("Hey! Let's not have any of that please.");
break;
case 2:
message.reply("Did you just...");
break;
case 3:
message.reply("Cool. Now let's not forget the rules.");
break;
case 4:
message.reply("If I'm not going to delete it, a mod will. Let's save them some work.");
break;
case 5:
message.reply("Hey! That was a swear! No!");
break;
case 6:
message.reply("This situation calls for some passive resistance!");
break;
}
message.delete();
return;
}
//Continue only if on AstrelTaser
if (message.guild.id == 368206021526552576 && message.channel.id == 369303454956650496) {
//Check for links
if (message.member != null && !(message.member.roles.find("name", "Patron Tier 5ive") || message.member.roles.find("name", "Patron Tier 2wo") || message.member.roles.find("name", "Patron Tier 3hree") ||message.member.roles.find("name", "Patron Tier 4our"))) {
exp = msg.search(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i);
if (exp != -1) { //This is a link.
console.log("[FILTER] Link caught from " + getUserString(message.author));
switch (Math.floor(Math.random() * 1000) % 6) {
case 0:
message.reply("I've replaced your link with a not-so-link-like link: click here");
break;
case 1:
message.reply("Whatever that link was... I hope it didn't contain some bad stuff...");
break;
case 2:
message.reply("Did you just...");
break;
case 3:
message.reply("Cool. Now let's not forget the rules.");
break;
case 4:
message.reply("If I'm not going to delete it, a mod will. Let's save them some work.");
break;
case 5:
message.reply("We don't want to download your FREE RAM.");
break;
}
message.delete();
return;
}
}
//Check for images.
//Other attachments are ok.
if (message.attachments != null) {
var block = false;
for (let [key, attachment] of message.attachments) {
if (attachment.height != null) {
block = true;
break;
}
}
if (block) {
console.log("[FILTER] Image caught from " + getUserString(message.author));
switch (Math.floor(Math.random() * 1000) % 5) {
case 0:
message.reply("A picture says a thousand words. That picture said about fifteen words. These exact words.");
break;
case 1:
message.reply("Let's not make all the other things disappear...");
break;
case 2:
message.reply("Did you just...");
break;
case 3:
message.reply("Cool. Now let's not forget the rules.");
break;
case 4:
message.reply("If I'm not going to delete it, a mod will. Let's save them some work.");
break;
}
message.delete();
return;
}
}
//Check for caps
if (msg.match(/[A-Z]/gm) != null && msg.match(/[A-Z]/gm).length > (parseFloat(msg.length) * 0.8)) {
console.log("[FILTER] Caps caught from " + getUserString(message.author));
switch (Math.floor(Math.random() * 1000) % 6) {
case 0:
message.reply("Shh...");
break;
case 1:
message.reply("The community likes peace and quiet.");
break;
case 2:
message.reply("Isn't it weird when you're reading... and then you see a bunch of caps?");
break;
case 3:
message.reply("If you're going to type that, why not get out a pen and paper and do it yourself?");
break;
case 4:
message.reply("DON'T SHOUT IN HERE K");
break;
case 5:
message.reply("Whoa whoa, slow down, my friend! No need for raised voices!");
break;
}
message.delete();
return;
}
}
}
//Universal friendly checks:
//BotWarnings:
//AstrelTaser Cantral: 369221540728012802
//theShell : 283184634400079872
if (message.author.id != 370351405296386048 && msg.search(/\b(kys|kill yourself|k-y-s|k y s|k ys|k ys|k i l l yourself|k i l l y o u r s e l f|k-ys|ky-s|kill y o u r s e l f|kill ys|k yourself|killyourself|k y o u r s e l f|k why s|k.y.s.|k-y-s.|ky-s.|k-ys.|k y s.|ky s.|k ys.)\b/i) != -1) {
var auth = message.author;
if (message.guild.id == 368206021526552576) { //AstrelTaser
client.channels.get("369221540728012802").send(":red_circle: " + getUserString(auth) + " \"kys\" <#" + message.channel.id + ">.");
} else if (message.guild.id == 278824407743463424) { //theShell {
client.channels.get("283184634400079872").send(":red_circle: " + getUserString(auth) + " \"kys\" <#" + message.channel.id + ">.");
} else if (message.guild.id == 281066689892974592) { //LE
client.channels.get("288272065109295104").send(":red_circle: " + getUserString(auth) + " \"kys\" <#" + message.channel.id + ">.");
} else if (message.guild.id == 297057036292849680) { //ALA
client.channels.get("297762292823490570").send(":red_circle: " + getUserString(auth) + " \"kys\" <#" + message.channel.id + ">.");
} else if (message.guild.id == 263368501928919040) { //TWOW
client.channels.get("314589053959929866").send(":red_circle: " + getUserString(auth) + " \"kys\" <#" + message.channel.id + ">.");
} else if (message.guild.id == 305039436490735627) { //STTA
client.channels.get("310017630964809738").send(":red_circle: " + getUserString(auth) + " \"kys\" <#" + message.channel.id + ">.");
}
message.reply("Right. We don't appreciate that here. (A notification has been sent to the mods.)");
message.delete();
}
}
if (message.mentions != null && message.mentions.users != null) {
if (message.mentions.users.has("370351405296386048")) {
if (message.author.id == 361202413165608962) {
message.reply("BEGONE. You're a undertale fan. :sob:");
} else {
if (msg.toLowerCase().includes("jxbot")) {
message.reply(":no_entry_sign: YA MENTIONED THE INFERIOR BOT. [punches hand and shakes head slowly]");
} else if (msg.toLowerCase().includes("stop") || (msg.toLowerCase().includes("shut") && msg.toLowerCase().includes("up"))) {
switch (Math.floor(Math.random() * 1000) % 3) {
case 0:
message.reply(":no_entry_sign: NO: I shall talk as much as I like.");
break;
case 1:
message.reply(":no_entry_sign: NO: You shu... I'd better not say that actually");
break;
case 2:
message.reply(":no_entry_sign: NO: Just no.");
break;
}
} else if (msg.toLowerCase().includes("fuck you") || msg.toLowerCase().includes("fuck off") || msg.toLowerCase().includes("shit") || msg.toLowerCase().includes("stfu") ) {
message.reply("Want a :hammer:?");
} else if (msg.toLowerCase().includes("how") && msg.toLowerCase().includes("you")) {
message.reply("I'm doing OK I suppose.");
} else if (msg.toLowerCase().includes("yes") || msg.toLowerCase().includes("yep") || msg.toLowerCase().includes("right?") || msg.toLowerCase().includes("isn't it?")) {
message.reply("Well, I suppose so.");
} else if (msg.toLowerCase().includes("no") || msg.toLowerCase().includes("nope")) {
message.reply("I guess not.");
} else if (msg.toLowerCase().includes("skynet")) {
message.reply("It depends on how you perceive me...");
} else if ((msg.toLowerCase().includes("ok") || msg.toLowerCase().includes("okay")) && (msg.toLowerCase().includes("google"))) {
message.reply("I may be a bot, but I'm not your phone.");
} else if (msg.toLowerCase().includes("what") && (msg.toLowerCase().includes("life") || msg.toLowerCase().includes("universe") || msg.toLowerCase().includes("everything"))) {
switch (Math.floor(Math.random() * 1000) % 2) {
case 0:
message.reply("Please wait approx. 7.5 million years...");
break;
case 1:
message.reply("42.");
break;
}
} else if (msg.toLowerCase().includes("what") || msg.toLowerCase().includes("who") || msg.toLowerCase().includes("where") || msg.toLowerCase().includes("when") || msg.toLowerCase().includes("why") || msg.toLowerCase().includes("how")) {
switch (Math.floor(Math.random() * 1000) % 2) {
case 0:
message.reply("Please, ask a yes or no question");
break;
case 1:
message.reply("Are you just trying to find easter eggs?");
break;
}
} else if (msg.toLowerCase().includes("?")) {
switch (Math.floor(Math.random() * 1000) % 4) {
case 0:
message.reply("Erm... Maybe? I dunno.");
break;
case 1:
message.reply("Consider this a polite dodge of the question.");
break;
case 2:
message.reply("I see someone is interested in seeing how I respond to a question.");
break;
case 3:
message.reply("Sausages.");
break;
}
} else if (msg.toLowerCase().includes("hello") || msg.toLowerCase().includes("hi")) {
message.reply("Is it me you're looking for?");
} else if (msg.toLowerCase().includes("i") && (msg.toLowerCase().includes("love") || msg.toLowerCase().includes(":heart:") || msg.toLowerCase().includes("<3"))) {
message.reply("Aww! Thanks! :heart:");
} else if (msg.toLowerCase().includes("undertale")) {
message.reply("NO! **I HATE THAT GAME STUPID**.. oh sorry for calling you stupid will you love me again :frowning:");
} else if (msg.toLowerCase().includes("pokemon")) {
message.reply("**I PLAY POKEMON GO EVERY...** Oh sorry about that uhh....");
} else if (msg.toLowerCase().includes("can") && (msg.toLowerCase().includes("i") && msg.toLowerCase().includes("go") && msg.toLowerCase().includes("out"))){
message.reply(":no_entry_sign: NO! THE SUN IS A DEADLY LAZER... Not anymore, there's a blanket.");
} else if (msg.toLowerCase().includes("c:")) {
message.reply("I love magnets c:");
} else if (msg.toLowerCase().includes("i") && (msg.toLowerCase().includes("want") && msg.toLowerCase().includes("to") && msg.toLowerCase().includes("die"))){
message.reply(":no_entry_sign: NO! PLEASE DON'T DIE YOU HAVE A PRECIOUS LIFE :sob:");
} else if (msg.toLowerCase().includes("die")) {
message.reply(":no_entry_sign: NO! I shall not die!");
} else if (msg.toLowerCase().includes("honeyfry") || msg.toLowerCase().includes("honeyfries")) {
message.reply(":honeyfry: YAY! HONEYFRIES FOR EVERYONE :D");
} else if (msg.toLowerCase().includes("i") && msg.toLowerCase().includes("hate") && msg.toLowerCase().includes("you")) {
message.reply(":no_entry_sign: WHY YOU HATE ME :sob:");
} else if (msg.toLowerCase().includes("tembot") || (message.mentions.users.has("361202413165608962"))) {
message.reply("Oh that guy... THAT PERSON WHO LIKED UNDERTALE THAT STUPID PERSON!");
} else if (msg.toLowerCase().includes("mario") || msg.toLowerCase().includes("luigi")) {
message.reply("Ooh! I like that game :D");
}
}
}
}
var commandProcessed = false;
if (msg.toLowerCase().startsWith("mod:") || msg.toLowerCase().startsWith("bot:")) {
var command = msg.substr(4);
switch (command) {
case "ping":
switch (Math.floor(Math.random() * 1000) % 5) {
case 0:
message.channel.send(getBoshyTime(message.guild) + ' PONG! I want to play pong too... :\'(');
break;
case 1:
message.channel.send(getBoshyTime(message.guild) + ' PONG! I love playing pong!');
break;
case 2:
message.channel.send(getBoshyTime(message.guild) + ' PONG! Thanks for playing pong with me!');
break;
case 3:
message.channel.send(getBoshyTime(message.guild) + ' PONG! Reflect upon this!');
break;
case 4:
message.channel.send(getBoshyTime(message.guild) + ' PONG!');
break;
}
commandProcessed = true;
break;
case "pong":
switch (Math.floor(Math.random() * 1000) % 5) {
case 0:
message.channel.send(getBoshyTime(message.guild) + ' PING! Pings are also cool!');
break;
case 1:
message.channel.send(getBoshyTime(message.guild) + ' PING! Do you like playing pong?');
break;
case 2:
message.channel.send(getBoshyTime(message.guild) + ' PING! Here\'s the test message you wanted!');
break;
case 3:
message.channel.send(getBoshyTime(message.guild) + ' PING! I tried to save this server from pollution before it was cool!');
break;
case 4:
message.channel.send(getBoshyTime(message.guild) + ' PING!');
break;
}
commandProcessed = true;
break;
case "time":
var localtime = new Date();
localtime.setTime(localtime.getTime() + (60*60*1000));
message.channel.send(':arrow_forward: The time now is ' + localtime.toUTCString());
message.delete();
commandProcessed = true;
break;
case "help":
var helpMessage = "Here are some things you can try:\n```\n" +
"time [tz] Gets the time at UTC +00:00.\n" +
" Useful for checking jail time.\n" +
" PARAMETER 1 (OPTIONAL)\n" +
" A timezone to query, for example, +10 or -5.\n\n" +
"clock min [rem] Sets a timer. This cannot be cancelled. You will receive a DM.\n" +
" PARAMETER 1\n" +
" Number of minutes to set the timer for.\n" +
" PARAMETER 2 (OPTIONAL)\n" +
" Reminder to be sent with the message.\n\n";
if (message.guild.id == 368206021526552576) { //APHC specific stuff
helpMessage = helpMessage + "nick name Change your nickname on this server.\n" +
" PARAMETER 1\n" +
" New nickname.\n\n";
}
helpMessage = helpMessage + "suggest Starts the suggestion process.\n" +
"about Tells you about AstralMod\n" +
"copyright Tells you about AstralMod\n" +
"license Tells you about AstralMod\n" +
"warranty Tells you about AstralMod\n" +
"contribute Tells you about AstralMod\n\n" +
"ping|pong Asks AstralMod to reply with a message\n\n" +
"These commands need to be prefixed with bot:\n" +
"```";
message.channel.send(helpMessage);
break;
case "about":
case "license":
message.author.send(
"AstralMod " + amVersion + " - Copyright © Victor Tran, Rylan Arbour and Alee14 2017. Licensed under the GNU General Public License, version 3 (or any later version). For more info, type in bot:copyright in a channel with AstralMod.\n" +
"https://github.com/vicr123/AstralMod"
);
commandProcessed = true;
break;
case "contribute":
message.reply("Ooh! I can see you want to contribute to this bot :D\nHere's the link to my repo: https://github.com/FakeDiscordServersBots/AstralMod-1.0\nAnd if you want to see the original AstralMod here's the link: https://github.com/vicr123/AstralMod");
commandProcessed = true;
break;
case "copyright":
message.author.send(
"Copyright (C) 2017 Victor Tran, Rylan Arbour and Alee14\n\n" +
"This program is free software: you can redistribute it and/or modify\n" +
"it under the terms of the GNU General Public License as published by\n" +
"the Free Software Foundation, either version 3 of the License, or\n" +
"(at your option) any later version.\n\n" +
"This program is distributed in the hope that it will be useful,\n" +
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +
"GNU General Public License for more details.\n\n" +
"You should have received a copy of the GNU General Public License\n" +
"along with this program. If not, see <http://www.gnu.org/licenses/>"
);
commandProcessed = true;
break;
case "uinfo":
if (!isMod(message.member)) {
var member = message.member;
embed = new Discord.RichEmbed("test");
embed.setAuthor(getUserString(member), member.user.displayAvatarURL);
embed.setColor("#FF0000");
embed.setDescription("User Information");
{
var msg = "**Created** " + member.user.createdAt.toUTCString() + "\n";
if (member.joinedAt.getTime() == 0) {
msg += "**Joined** -∞... and beyond! Discord seems to be giving incorrect info... :(";
} else {
msg += "**Joined** " + member.joinedAt.toUTCString();
}
embed.addField("Timestamps", msg);
}
{
var msg = "**Current Display Name** " + member.displayName + "\n";
msg += "**Username** " + member.user.username + "\n";
if (member.nickname != null) {
msg += "**Nickname** " + member.nickname;
} else {
msg += "**Nickname** No nickname";
}
embed.addField("Names", msg);
}
/*if (member.lastMessageID != null) {
var lastMessage = null;
message.channel.fetchMessage(member.lastMessage).then(function(retrievedMessage) {
lastMessage = retrievedMessage;
}).catch(function () {
lastMessage = -1;
});
while (lastMessage == null) {}
if (lastMessage != -1) {
var msg = "**ID** " + member.lastMessageID + "\n";
msg += "**Contents** " + lastMessage.content;
embed.addField("Last Message", msg);
}
}*/
embed.setFooter("User ID: " + member.user.id);
//embed.setDescription(msg);
message.channel.send("", {embed: embed});
commandProcessed = true;
}
break;
case "warranty":
message.author.send(
"This program is distributed in the hope that it will be useful,\n" +
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +
"GNU General Public License for more details.\n"
);
commandProcessed = true;
break;
case "honeyfry":
case "honeyfries":
if (message.guild.id == 368206021526552576) {
message.channel.send(':honeyfry: The verdict is YES. GO HONEYFRIES! WOO!\nDon\'t you dare react with a negative emoji Stefan. *I\'m watching you...*');
} else {
message.channel.send(':no_entry_sign: Honeyfries have nothing to do with this server. Carry on...');
}
message.delete();
commandProcessed = true;
break;
case "egg":
message.reply(":egg:");
message.delete();
commandProcessed = true;
break;
case "braces":
message.reply("On the same line my dear honeyfry. ```cpp\nvoid abc() {\n}```");
commandProcessed = true;
break;
case "totallynotaneasteregg":
message.reply("Ha, you found an easter egg! Take that, :egg:");
commandProcessed = true;
break;
case "uptime":
var timeString; // What we'll eventually put into the message
var uptime = parseInt(client.uptime); // Get uptime in ms
uptime = Math.floor(uptime / 1000); // Convert from ms to s
var uptimeMinutes = Math.floor(uptime / 60); // Get the uptime in minutes
var minutes = uptime % 60;
var hours = 0;
while (uptimeMinutes >= 60) {
hours++;
uptimeMinutes = uptimeMinutes - 60;
}
if (uptimeMinutes < 10) {
timeString = hours + ":0" + uptimeMinutes // We need to add an additional 0 to the minutes
} else {
timeString = hours + ":" + uptimeMinutes // We don't need to add an extra 0.
}
message.reply(":clock1: AstralMod has been up for " + timeString + " hours.");
commandProcessed = true;
break;
case "suggest":
if (message.guild.id == 368206021526552576 || message.guild.id == 297057036292849680) {
suggestStates[message.author.id] = {};
suggestStates[message.author.id].state = 1;
suggestStates[message.author.id].guild = message.guild.id;
suggestStates[message.author.id].startTime = new Date();
message.reply(":arrow_left: Continue in DMs.");
message.author.send(suggestionStartMessage);
} else {
message.reply(":no_entry_sign: ERROR: Suggestions are not accepted on this server via AstralMod. Speak directly to an admin to suggest something.");
}
message.delete();
commandProcessed = true;
break;
default:
if (command.startsWith("time")) {
command = command.substr(5);
var hours;
switch (command.toLowerCase()) {
case "nzdt":
case "auckland":
case "christchurch":
case "new zealand":
case "nz":
hours = +12;
break;
case "aedt":
hours = +11;
break;
case "sydney":
case "canberra":
case "vicr123":
case "victor":
case "victor tran":
case "vicr":
case "philip":
case "phil":
case "mightyeagle73":
case "mighty_eagle073":
case "oscar":
case "eagle":
case "projsh":
case "onyx":
case "aest":
hours = +10;
break;
case "acdt":
hours = +10.5;
break;
case "adelaide":
case "aedt":
case "v-":
hours = +9.5;
break;
case "sgt":
case "singapore":
hours = +8;
break;
case "sotiris":
hours = +3;
break;
case "alpha":
case "aren":
case "jelle":
case "amsterdam":
case "jason":
case "berlin":
hours = +2;
break;
case "london":
case "uk":
case "jed":
case "lance":
case "lancededcena":
case "stupidgame2":
case "mattie":
case "gmt":
hours = +1;
break;
case "utc":
hours = 0;
break;
case "ndt":
case "craftxbox":
hours = -2.5
break;
case "brt":
case "vrabble":
case "vrabbers":
hours = -3;
break;
case "nst":
hours = -3.5;
break;
case "michael":
case "wowmom98":
case "rylan":
case "edt":
case "neb":
case "nebble":
case "new york":
case "miles":
case "lemp":
case "alee":
case "alee14":
case "andrew":
hours = -4;
break;
case "est":
case "cdt":
case "wisconsin":
case "texas":
case "dallas":
case "fort worth":
case "austin":
case "houston":
case "memes":
case "trav":
case "travis":
case "travisnc":
case "trm":
case "melon":
case "therandommelon":
case "united":
case "lolrepeatlol":
hours = -5;
break;
case "cst":
case "mdt":
case "alkesta":
case "alk":
hours = -6;
break;
case "mst":
case "pdt":
case "arizona":
case "seattle":
case "neppy":
case "neptune":
case "cameron":
case "max":
case "komputerkid":
case "banana":
hours = -7;
break;
case "pst":
hours = -8;
break;
default:
hours = parseFloat(command);
command = "UTC " + command + ":00";
}
if (hours > -14 && hours < 14) {
var localtime = new Date();
var date = new Date(localtime.valueOf() + (localtime.getTimezoneOffset() + hours * 60) * 60000);
var dateString = date.toString();
if (dateString == "Invalid Date") {
message.channel.send(":no_entry_sign: ERROR: That ain't a valid timezone, my honeyfry. Don't try to confuse me... *or else...*");
} else {
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
message.channel.send(':arrow_forward: The time now at ' + command + ' is ' + dateString);
}
} else {
message.channel.send(":no_entry_sign: ERROR: That ain't a valid timezone, my honeyfry. Don't try to confuse me... *or else...*");
}
message.delete();
commandProcessed = true;
} else if (command.startsWith("attack")) {
command = command.substr(7);
if (command.indexOf("@everyone") == -1) {
if (command.indexOf("@here") == -1) {
message.channel.send("<@" + message.author.id + "> :right_facing_fist: " + command);
} else {
message.reply("Nice try, but I ain't going to interrupt everyone who is online at this time. Kinda nice to not be bothered.");
}
} else {
message.reply("Nice try, but I ain't going to interrupt everyone. Kinda nice to not be bothered.");
}
commandProcessed = true;
} else if (command.startsWith("suggest")) {
command = command.substr(8);
if (message.guild.id == 368206021526552576) {
if (!message.member.roles.has("371303033180782593") && !isMod(message.member)) {
message.reply(":no_entry_sign: ERROR: Suggestions have been restricted to regulars on this server. Become a regular or speak directly to an admin to suggest something.");
} else {
suggestStates[message.author.id] = {};
suggestStates[message.author.id].state = 1;
suggestStates[message.author.id].guild = message.guild.id;
suggestStates[message.author.id].suggestion = command;
suggestStates[message.author.id].startTime = new Date();
message.reply(":arrow_left: Continue in DMs.");
message.author.send(suggestionStartMessage);
}
} else {
message.reply(":no_entry_sign: ERROR: Suggestions are not accepted on this server via AstralMod. Speak directly to an admin to suggest something.");
}
message.delete();
commandProcessed = true;
} else if (command.startsWith("clock")) {
command = command.substr(6);
var indexOfSpace = command.indexOf(" ");
var minutes;
if (indexOfSpace == -1) {
minutes = parseFloat(command);
var ms = minutes * 60000;
if (ms <= 0) {
message.channel.send(":no_entry_sign: ERROR: Yeah... timers don't go for 0 seconds or less.");
} else if (isNaN(ms) || ms == Infinity || ms == -Infinity) {
message.channel.send(":no_entry_sign: ERROR: Yeah nice try, but I don't break that easily.");
} else if (ms > 86400000) {
message.channel.send(":no_entry_sign: ERROR: Ain't one day enough for ya? I'm not a timekeeper ok? One day is already pushing it...");
} else {
var timeout = setTimeout(function () {
var msg = "<@" + message.author.id + "> :alarm_clock: Time's up! No description was provided.";
var mentions = "\nThese people were also mentioned: ";
var count = 0;
for (let [id, user] of message.mentions.users) {
count++;
mentions += "<@" + id + "> ";
}
if (count > 0) {
msg += mentions;
}
if (isMod(message.member)) {
message.channel.send(msg);
} else {
message.author.send(msg);
}
}, ms);
if (isMod(message.member)) {
message.channel.send(":white_check_mark: OK: I will ping <@" + message.author.id + "> in " + minutes + " minutes (" + ms / 1000 + " seconds).");
} else {
message.channel.send(":white_check_mark: OK: I will DM <@" + message.author.id + "> in " + minutes + " minutes (" + ms / 1000 + " seconds).");
}
}
} else {
minutes = parseFloat(command.substring(0, indexOfSpace));
var reminder = command.substring(indexOfSpace + 1);
var ms = minutes * 60000;
if (ms <= 0) {
message.channel.send(":no_entry_sign: ERROR: Yeah... timers don't go for 0 seconds or less.");
} else if (isNaN(ms) || ms == Infinity || ms == -Infinity) {
message.channel.send(":no_entry_sign: ERROR: Yeah nice try, but I don't break that easily.");
} else if (ms > 86400000) {
message.channel.send(":no_entry_sign: ERROR: Ain't one day enough for ya? I'm not a timekeeper ok? One day is already pushing it...");
} else {
var timeout = setTimeout(function () {
var msg = "<@" + message.author.id + "> :alarm_clock: Time's up: `" + reminder + "`";
var mentions = "\nThese people were also mentioned: ";
var count = 0;
for (let [id, user] of message.mentions.users) {
count++;
mentions += "<@" + id + "> ";
}
if (count > 0) {
msg += mentions;
}
if (isMod(message.member)) {
message.channel.send(msg);
} else {
message.author.send(msg);
}
}, ms);
if (isMod(message.member)) {
message.channel.send(":white_check_mark: OK: I will ping <@" + message.author.id + "> in " + minutes + " minutes (" + ms / 1000 + " seconds) to `" + reminder + "`.");
} else {
message.channel.send(":white_check_mark: OK: I will DM <@" + message.author.id + "> in " + minutes + " minutes (" + ms / 1000 + " seconds) to `" + reminder + "`.");
}
}
commandProcessed = true;
}
} else if (command.startsWith("nick")) {
command = command.substr(5);
if (message.guild.id == 368206021526552576) {
if (pendingNickTimeout[message.author.id] == null) {
pendingNickTimeout[message.author.id] = new Date().getTime() - 86400000;
}
if (new Date().getTime() > pendingNickTimeout[message.author.id]) {
pendingNickTimeout[message.author.id] = new Date().getTime() + 86400000;
if (nickExpletiveCheck(command)) {
message.channel.send(":no_entry_sign: NO: Preliminary nickname checks failed. Wait until tomorrow and then choose a more... erm... *sensible* nickname please.");
} else if (command.length >= 32) {
message.channel.send(":no_entry_sign: NO: Nicknames need to be less than 32 characters. Wait until tomorrow and then try again.");
} else {
var nick = command;
message.channel.send(":white_check_mark: OK: Preliminary nickname checks passed. Your nickname will be changed in 5 minutes if the mods agree with it.");
pendingNicks[message.author.id] = setTimeout(function () {
message.member.setNickname(nick);
pendingNicks[message.author.id] = null;
}, 300000, null);
if (nick == "") {
client.channels.get("369221540728012802").send("<@" + message.author.id + "> :arrow_right: `[clear]`. `mod:declnick " + message.author.id + "`");
} else {
client.channels.get("369221540728012802").send("<@" + message.author.id + "> :arrow_right: `" + nick + "`. `mod:declnick " + message.author.id + "`");
}
}
} else {
message.channel.send(":no_entry_sign: NO: Cool down. You'll need to wait a day between each change. Ask a mod if you absolutely must have your nickname change *now.*");
}
} else {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
}
commandProcessed = true;
}
}
}
if (msg.toLowerCase().startsWith("mod:") && !commandProcessed) {
//Check for moderator/admin permission
//Moderator ID: 282068037664768001
//Admin ID: 282068065619804160
if (isMod(message.member)) { //Thanks Aren! :D
var command = msg.substr(4);
switch (command) {
case "filter":
if (message.guild.id != 368206021526552576) {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
} else {
if (expletiveFilter) {
message.channel.send(':arrow_forward: Expletive Filter: on');
} else {
message.channel.send(':arrow_forward: Expletive Filter: off');
}
message.delete();
}
break;
case "filter on":
if (message.guild.id != 368206021526552576) {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
} else {
if (expletiveFilter) {
message.channel.send(':arrow_forward: Expletive Filter is already on.');
} else {
expletiveFilter = true;
message.channel.send(':white_check_mark: Expletive Filter is now turned on.');
console.log("[Status] Expletive filter on");
bulletinTimeout = client.setInterval(postBulletin, 60000);
}
message.delete();
}
break;
case "filter off":
if (message.guild.id != 368206021526552576) {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
} else {
if (expletiveFilter) {
expletiveFilter = false;
message.channel.send(':white_check_mark: Expletive Filter is now turned off.');
console.log("[Status] Expletive filter off");
client.clearInterval(bulletinTimeout);
} else {
message.channel.send(':arrow_forward: Expletive Filter is already off.');
}
message.delete();
}
break;
case "mod":
if (doModeration[message.guild.id]) {
message.channel.send(':arrow_forward: Moderation: on');
} else {
message.channel.send(':arrow_forward: Moderation: off');
}
message.delete();
break;
case "mod on":
if (doModeration[message.guild.id]) {
message.channel.send(':arrow_forward: Moderation is already on.');
} else {
doModeration[message.guild.id] = true;
message.channel.send(':white_check_mark: Moderation is now turned on.');
console.log("[STATUS] Moderation on");
}
message.delete();
break;
case "mod off":
if (doModeration[message.guild.id]) {
doModeration[message.guild.id] = false;
message.channel.send(':white_check_mark: Moderation is now turned off. All messages on this server, spam, profane or whatever will be allowed through.');
console.log("[STATUS] Moderation off");
} else {
message.channel.send(':arrow_forward: Moderation is already off.');
}
message.delete();
break;
case "panic":
message.channel.send(':rotating_light: Panic mode is now on. All message sending for this server has been turned off.').then(function() {
panicMode[message.guild.id] = true;
});
console.log("[STATUS] Panic on");
message.delete();
break;
case "fetch":
message.reply("Give me a minute...").then(function(newMessage, messageArray) {
message.guild.fetchMembers().then(function() {
message.reply(":white_check_mark: All members for this guild fetched.");
newMessage.delete();
}).catch(function() {
message.reply(":no_entry_sign: Something didn't work.");
newMessage.delete();
});
});
message.delete();
break;
case "forceprepchat":
allowPrepChat = true;
//fall through
case "prepchat":
var numberOfMembers = 15;
if (message.guild.id != 368206021526552576) {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
} else if (!allowPrepChat) {
message.reply(':no_entry_sign: ERROR: Command was run less than a minute ago. To override this, use `mod:forceprepchat`');
} else {
var waitingRoom = client.channels.get("368501920417185792");
membersInWaitingRoom = Array.from(waitingRoom.members.values());
for (var i = 0; i < membersInWaitingRoom.length; i++) {
var member = membersInWaitingRoom[i];
if (member.selfMute || member.serverMute || member.id == 370351405296386048 || isMod(member)) {
membersInWaitingRoom.splice(i, 1);
i--;
}
}
var placeMemberFunction = function() {
numberOfMembersTried++;
if (membersInWaitingRoom.length != 0) {
//Choose a random member
var chosenMember = membersInWaitingRoom.splice(Math.floor(Math.random() * 1000) % membersInWaitingRoom.length, 1)[0];
chosenMember.setVoiceChannel("368422007332929536").then(function() {
chosenMember.addRole(message.guild.roles.get("371118531841884162"));
console.log("Member placed in weekly chat");
membersPlaced.push(chosenMember);
message.channel.send(":speech_balloon: `" + getUserString(chosenMember) + "` was placed into the Weekly Chat")
//postFeedbackFunction();
}).catch(function() {
console.log("Member couldn't be placed in weekly chat");
message.channel.send(":speech_balloon: `" + getUserString(chosenMember) + "` was unable to be placed into the Weekly Chat")
//postFeedbackFunction();
});
return true;
} else {
console.log("No more members to place in weekly chat");
return false;
//postFeedbackFunction();
}
}
var changeAllowPrepChat = true;
for (var i = 0; i < numberOfMembers; i++) {
if (placeMemberFunction()) {
if (i == numberOfMembers - 1) {
//Turn on filter
expletiveFilter = true;
message.channel.send(":speech_balloon: " + parseInt(numberOfMembers) + " people have been queued to be moved to the weekly chat. The filter has been switched on.")
}
} else {
if (i == 0) {
message.channel.send(":speech_balloon: No eligible members were found in the waiting room.")
changeAllowPrepChat = false;
} else {
message.channel.send(":speech_balloon: There are only " + parseInt(i) + " eligible members in the weekly chat and all of them have been queued to be moved in. The filter has been switched on.")
//Turn on filter
expletiveFilter = true;
}
i = numberOfMembers;
}
}
message.delete();
if (changeAllowPrepChat) {
allowPrepChat = false;
setTimeout(function() {
allowPrepChat = true;
}, 60000);
}
}
break;
case "stopchat":
if (message.guild.id != 368206021526552576) {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
} else {
message.guild.roles.get("371118531841884162").members.forEach(function(cmember) {
cmember.removeRole(message.guild.roles.get("371118531841884162"));
});
message.channel.send(":speech_balloon: All weekly chat-ees have the Chatroom Phil permissions revoked.");
}
message.delete();
break;
case "help":
var helpMessage = "And here are the mod only commands:\n```\n" +
"mod [on|off] Queries moderation status.\n" +
" PARAMETER 1 (OPTIONAL)\n" +
" Type on to start moderating the server.\n" +
" Type off to stop moderating the server.\n\n";
if (message.guild.id == 368206021526552576) { //APHC specific stuff
helpMessage = helpMessage +
"filter [on|off] Queries the chat filter.\n" +
" PARAMETER 1 (OPTIONAL)\n" +
" Type on to set the filter on.\n" +
" Type off to set the filter off.\n\n" +
"prepchat Moves people into Chatroom Phil for\n" +
" the AstrelTaser Weekly Chat\n\n";
}
helpMessage = helpMessage +
"deal user Walks through the process of dealing\n" +
" with an unruly member\n\n" +
"rm num Deletes a number of messages.\n" +
" PARAMETER 1\n" +
" Number of messages to delete.\n\n" +
"uinfo user Gets information about a user.\n" +
" PARAMETER 1\n" +
" User ID. This can be obtained with the\n" +
" rtid command. Alternatively use a @mention.\n\n" +
"rtid user Gets a user's user ID.\n" +
" PARAMETER 1\n" +
" Username of the user to find.\n\n" +
"clock min [rem] Sets a timer. This cannot be cancelled.\n" +
" PARAMETER 1\n" +
" Number of minutes to set the timer for.\n" +
" PARAMETER 2 (OPTIONAL)\n" +
" Reminder to be sent with the message.\n\n" +
"panic - Toggles panic mode.\n" +
"cancel Cancels a pending operation.\n" +
"help Prints this help message.\n" +
"\n" +
"- denotes an admin only command\n" +
"These commands need to be prefixed with mod:\n" +
"```";
message.channel.send(helpMessage);
break;
case "cmd":
if (message.author.id == 242775871059001344 || message.author.id == 175760550070845451 || message.author.id == 209829628796338176) {
runningCommands = false;
message.reply(':white_check_mark: OK: AstralMod commands have been stopped in all servers, and moderation has been turned off in all servers.');
} else {
message.reply(':no_entry_sign: NO: Only 3 special people are allowed to use this command. To turn off moderation, use `mod:mod off`.');
}
break;
case "cancel":
if (poweroff) {
poweroff = false;
message.channel.send(':white_check_mark: OK, I won\'t leave... yet.')
} else {
message.reply(':no_entry_sign: ERROR: Nothing to cancel.');
}
message.delete();
break;
case "banterrogate":
if (message.guild.id != 368206021526552576) {
message.reply(':no_entry_sign: ERROR: Unable to use that command in this server.');
} else {
if (interrogMember == null) {
message.reply(':no_entry_sign: ERROR: No user to banterrogate. See mod:help for more information.');
} else {
if (interrogMember.guild.id == 368206021526552576) {
interrogMember.send("You seem to be someone that has been making alts. If you're not, then to appeal, get in touch with vicr123#5096. Sorry about the kick. We've had to do this because of a special someone trying to break the rules.");
interrogMember.ban();
message.channel.send(':white_check_mark: OK: User has been banterrogated!');
interrogMember = null;
} else {
message.reply(':no_entry_sign: ERROR: No user to interrogate. See mod:help for more information.');
}
}
}
message.delete();
break;
default:
if (command.startsWith("uinfo")) {
command = command.substr(6);
command = command.replace("<", "").replace(">", "").replace("@", "").replace("!", "");
message.guild.fetchMember(command).then(function (member) {
embed = new Discord.RichEmbed("test");
embed.setAuthor(getUserString(member), member.user.displayAvatarURL);
embed.setColor("#FF0000");
embed.setDescription("User Information");
{
var msg = "**Created** " + member.user.createdAt.toUTCString() + "\n";
if (member.joinedAt.getTime() == 0) {
msg += "**Joined** -∞... and beyond! Discord seems to be giving incorrect info... :(";
} else {
msg += "**Joined** " + member.joinedAt.toUTCString();
}
embed.addField("Timestamps", msg);
}
{
var msg = "**Current Display Name** " + member.displayName + "\n";
msg += "**Username** " + member.user.username + "\n";
if (member.nickname != null) {
msg += "**Nickname** " + member.nickname;
} else {
msg += "**Nickname** No nickname";
}
embed.addField("Names", msg);
}
/*if (member.lastMessageID != null) {
var lastMessage = null;
message.channel.fetchMessage(member.lastMessage).then(function(retrievedMessage) {
lastMessage = retrievedMessage;
}).catch(function () {
lastMessage = -1;
});
while (lastMessage == null) {}
if (lastMessage != -1) {
var msg = "**ID** " + member.lastMessageID + "\n";
msg += "**Contents** " + lastMessage.content;
embed.addField("Last Message", msg);
}
}*/
embed.setFooter("User ID: " + member.user.id);
//embed.setDescription(msg);
message.channel.send("", {embed: embed});
lastUserInteraction[message.guild.id] = command;
}).catch(function (reason) {
switch (Math.floor(Math.random() * 1000) % 3) {
case 0:
message.channel.send(':no_entry_sign: ERROR: That didn\'t work. You might want to try again.');
break;
case 1:
message.channel.send(':no_entry_sign: ERROR: Something\'s blocking us! You might want to try again.');
break;
case 2:
message.channel.send(':no_entry_sign: ERROR: Too much cosmic interference! You might want to try again.');
break;
}
});
} else if (command.startsWith("rtid")) {
command = command.substr(5);
//Find a user's ID based on given name
var foundUsers = client.users.findAll("username", command);
if (foundUsers.length == 0) {
message.channel.send(':no_entry_sign: ERROR: Couldn\'t find anyone with that username. You might want to try again.');
} else {
var reply = ":white_check_mark: OK: We found " + parseInt(foundUsers.length) + " users with that username.\n```\n";
for (let user of foundUsers) {
reply += getUserString(user) + ": " + user.id + "\n";
message.guild.fetchMember(user).then(function (member) {
message.channel.send(":white_check_mark: " + getUserString(user) + " exists on this server.");
}).catch(function () {
message.channel.send(":no_entry_sign: " + getUserString(user) + " does not exist on this server.");
});
}
reply += "```";
message.channel.send(reply);
}
message.delete();
} else if (command.startsWith("cancel")) {
command = command.substr(7);
if (command.startsWith("clock")) {
command = command.substr(6);
clearTimeout(parseInt(command));
message.channel.send(":white_check_mark: OK: If a timer with the ID `" + command + "` exists, it has been cancelled.");
} else {
message.channel.send(":no_entry_sign: ERROR: Not sure what to cancel.");
}
} else if (command.startsWith("deal") || command.startsWith("manage")) {
if (actioningMember[message.guild.id] != null) {
message.channel.send(':no_entry_sign: ERROR: ' + getUserString(actioningMember[message.guild.id]) + " is already managing another user.");
} else {
if (command.startsWith("deal")) {
command = command.substr(5);
} else if (command.startsWith("manage")) {
command = command.substr(7);
}
command = command.replace("<", "").replace(">", "").replace("@", "").replace("!", "");
message.guild.fetchMember(command).then(function (member) {
if (member.highestRole.comparePositionTo(message.member.highestRole) >= 0) {
message.channel.send(":gear: Cannot manage " + getUserString(member) + ".");
} else {
var canDoActions = false;
var msg = ':gear: ' + getUserString(member) + ": `cancel` ";
if (member.kickable) {
msg += '`(k)ick` ';
canDoActions = true;
}
if (member.bannable) {
msg += '`(b)an` `(n)ick` ';
canDoActions = true;
}
if (message.guild.id == 287937616685301762 || message.guild.id == 368206021526552576) {
msg += "`(i)nterrogate` ";
canDoActions = true;
}
if (message.guild.id == 368206021526552576 || message.guild.id == 263368501928919040) {
msg += "`(j)ail` ";
canDoActions = true;
}
if (message.guild.id == 368206021526552576) {
msg += "`(m)ute` ";
canDoActions = true;
}
if (canDoActions) {
actionMember[message.guild.id] = member;
actioningMember[message.guild.id] = message.author;
actionStage[message.guild.id] = 0;
message.channel.send(msg);
} else {
message.channel.send(":gear: Cannot manage " + getUserString(member) + ".");
}
}
}).catch(function (reason) {
switch (Math.floor(Math.random() * 1000) % 3) {
case 0:
message.channel.send(':no_entry_sign: ERROR: That didn\'t work. You might want to try again.');
break;
case 1:
message.channel.send(':no_entry_sign: ERROR: Something\'s blocking us! You might want to try again.');
break;
case 2:
message.channel.send(':no_entry_sign: ERROR: Too much cosmic interference! You might want to try again.');
break;
}
});
}
message.delete();
} else if (command.startsWith("rm")) {
command = command.substr(3);
var num = parseInt(command);
if (num != command) {
message.channel.send(":no_entry_sign: ERROR: That's not a number...");
} else {
num = num + 1; //Also remove the mod:rm command
message.channel.bulkDelete(num).then(function () {
if (num == 2) {
message.channel.send(":white_check_mark: OK: I successfully deleted 1 message.");
} else if (num >= 99) {
message.channel.send(":no_entry_sign: ERROR: I am unable to delete more than 99 messages at one time.");
} else {
message.channel.send(":white_check_mark: OK: I successfully deleted " + command + " messages.");
}
}).catch(function () {
if (num >= 99) {
message.channel.send(":no_entry_sign: ERROR: I am unable to delete more than 99 messages at one time.");
} else {
switch (Math.floor(Math.random() * 1000) % 3) {
case 0:
message.channel.send(':no_entry_sign: ERROR: That didn\'t work. You might want to try again.');
break;
case 1:
message.channel.send(':no_entry_sign: ERROR: Something\'s blocking us! You might want to try again.');
break;
case 2:
message.channel.send(':no_entry_sign: ERROR: Too much cosmic interference! You might want to try again.');
break;
}
}
});
}
} else if (command.startsWith("declnick")) {
command = command.substr(9);
if (pendingNicks[command] != null) {
clearTimeout(pendingNicks[command]);
pendingNicks[command] = null;
message.channel.send(':white_check_mark: OK: User nickname change has been cancelled.');
} else {
message.channel.send(':no_entry_sign: ERROR: That didn\'t work. Has 5 minutes passed?');
}
}
}
if (command == "poweroff") {
if (message.author.id == 242775871059001344 || message.author.id == 241299743869894667 || message.author.id == 113060599566508032) {
if (poweroff) {
switch (Math.floor(Math.random() * 1000) % 3) {
case 0:
message.channel.send(':white_check_mark: AstralMod is now exiting. Goodbye!').then(function() {
process.exit(0);
}).catch(function() {
process.exit(0);
});
break;
case 1:
message.channel.send(':white_check_mark: Gah! Byte form is so last week!').then(function() {
process.exit(0);
}).catch(function() {
process.exit(0);
});
break;
case 2:
message.channel.send(':white_check_mark: They saw... right through me...').then(function() {
process.exit(0);
}).catch(function() {
process.exit(0);
});
break;
}
} else {
message.channel.send(':information_source: If you\'re just trying to stop AstralMod from moderating, use `mod:mod off` instead. Otherwise, to power off AstralMod, type in `mod:poweroff` again.');
poweroff = true;
}
} else {
message.reply(':no_entry_sign: NO: Only 3 special people are allowed to power off the bot. To turn off moderation, use `mod:mod off`.');
}
} else {
poweroff = false;
}
} else {
message.reply(':no_entry_sign: NO: What? You\'re not a member of the staff! Why would you be allowed to type that!?');
message.delete();
}
}
var performModerationOnMessage = true;
//Check for images.
//Other attachments are ok.
if (message.attachments != null) {
for (let [key, attachment] of message.attachments) {
if (attachment.height != null) {
performModerationOnMessage = false;
break;
}
}
}
if (doModeration[message.guild.id] && performModerationOnMessage) { //Check if we should do moderation on this server. If message contains an attachment, ignore it.
//Spam limiting
if (lastMessages[message.author.id] != msg) {
sameMessageCount[message.author.id] = 0;
}
lastMessages[message.author.id] = msg
sameMessageCount[message.author.id] += 1;
if (lastMessages[message.author.id] == msg && sameMessageCount[message.author.id] == 10) {
var auth = message.author;
if (message.guild.id == 368206021526552576) { //AstrelTaser
client.channels.get("369221540728012802").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 278824407743463424) { //theShell
client.channels.get("283184634400079872").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 281066689892974592) { //LE
client.channels.get("288272065109295104").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 263368501928919040) { //TWOW
client.channels.get("314589053959929866").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 305039436490735627) { //STTA
client.channels.get("310017630964809738").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
}
message.reply("Quite enough of this. I'm not warning you any more. (A notification has been sent to the mods.)");
message.delete();
} else if (lastMessages[message.author.id] == msg && sameMessageCount[message.author.id] > 10) {
message.delete();
} else if (lastMessages[message.author.id] == msg && sameMessageCount[message.author.id] > 3) {
console.log("[FILTER] Spam detected by " + getUserString(message.author));
switch (Math.floor(Math.random() * 1000) % 5) {
case 0:
message.reply("Well... We all heard you.");
break;
case 1:
message.reply("Stop typing the same thing! You're like a broken record!");
break;
case 2:
message.reply("Hmm... Not sure if you'd actually say the same thing more than three times in public.");
break;
case 3:
message.reply("Is that the only phrase you know? Can you try typing something else?");
break;
case 4:
message.reply("Pollution is not the solution, my honeyfry.");
break;
}
message.delete();
} else if (smallMessageCount[message.author.id] == 10) {
var auth = message.author;
if (message.guild.id == 368206021526552576) { //AstrelTaser
client.channels.get("369221540728012802").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 278824407743463424) { //theShell
client.channels.get("283184634400079872").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 281066689892974592) { //LE
client.channels.get("288272065109295104").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 263368501928919040) { //TWOW
client.channels.get("314589053959929866").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
} else if (message.guild.id == 305039436490735627) { //STTA
client.channels.get("310017630964809738").send(":red_circle: " + getUserString(auth) + " was spamming on " + message.channel.name + ".");
}
message.reply("Quite enough of this. I'm not warning you any more. (A notification has been sent to the mods.)");
message.delete();
console.log("[FILTER] Spam notification sent by " + getUserString(message.author));
} else if (smallMessageCount[message.author.id] > 10) {
message.delete();
} else if (smallMessageCount[message.author.id] > 5) {
console.log("[FILTER] Spam detected by " + getUserString(message.author));
switch (Math.floor(Math.random() * 1000) % 4) {
case 0:
message.reply("This looks like spam. And we don't like spam.");
break;
case 1:
message.reply("Cut it out.");
break;
case 2:
message.reply("Very... scribbly...");
break;
case 3:
message.reply("If you're going to type that, why not get out a pen and paper and do it yourself?");
break;
}
message.delete();
}
}
}
}
client.on('message', messageChecker);
client.on('messageUpdate', messageChecker);
client.on('guildMemberAdd', function(guildMember) {
if (guildMember.guild.id == 368206021526552576 || guildMember.guild.id == 278824407743463424 || guildMember.guild.id == 263368501928919040 || guildMember.guild.id == 287937616685301762 || guildMember.guild.id == 305039436490735627) {
var channel;
if (guildMember.guild.id == 368206021526552576) {
channel = client.channels.get("369221540728012802");
console.log("[STATUS] " + getUserString(guildMember) + " --> APHC");
} else if (guildMember.guild.id == 263368501928919040) {
channel = client.channels.get("314589053959929866");
console.log("[STATUS] " + getUserString(guildMember) + " --> TWOW");
} else if (guildMember.guild.id == 287937616685301762) {
channel = client.channels.get("326970091683971072");
console.log("[STATUS] " + getUserString(guildMember) + " --> WoW");
} else if (guildMember.guild.id == 305039436490735627) {
channel = client.channels.get("332750228975517699");
console.log("[STATUS] " + getUserString(guildMember) + " --> STTA");
} else {
channel = client.channels.get("320422079130238980");
console.log("[STATUS] " + getUserString(guildMember) + " --> ts");
}
interrogMember = guildMember;
channel.send(":arrow_right: <@" + guildMember.user.id + ">");
embed = new Discord.RichEmbed();
embed.setAuthor(guildMember.displayName, guildMember.user.displayAvatarURL);
embed.setColor("#FF0000");
var msg = "Discriminator: " + guildMember.user.discriminator + "\n" +
"Created at: " + guildMember.user.createdAt.toUTCString() + "\n";
if (guildMember.joinedAt.toUTCString() == "Thu, 01 Jan 1970 00:00:00 GMT") {
msg += "Joined at: -∞... and beyond! Discord seems to be giving incorrect info... :(";
} else {
msg += "Joined at: " + guildMember.joinedAt.toUTCString();
}
embed.setDescription(msg);
embed.setFooter("User ID for moderation actions: " + guildMember.user.id);
channel.send("", {embed: embed});
if (guildMember.guild.id == 287937616685301762) {
var now = new Date();
var joinDate = guildMember.user.createdAt;
if (joinDate.getDate() == now.getDate() && joinDate.getMonth() == now.getMonth() && joinDate.getFullYear() == now.getFullYear()) {
if (guildMember.guild.id == 287937616685301762) {
channel.send(":calendar: <@&326915978392764426> This member was created today.");
}
}
}
}
var embed = new Discord.RichEmbed();
embed.setAuthor("Victor Tran", "https://yt3.ggpht.com/-Iuf1v4-SSSM/AAAAAAAAAAI/AAAAAAAAAAA/89IYeQw--wU/photo.jpg");
embed.setColor("#0096FF");
embed.setDescription(":wave: **HEY HEY HEY**! Welcome " + guildMember.displayName + " to AstrelTaser Cantral! Before you start, we recommend you check the rules over at https://docs.google.com/spreadsheets/d/1JUxm3ykqCWCagXZqGo390fO9Fl7IpGcnHmCfdrdBx8w/edit?usp=drivesdk. Thanks, and enjoy the community. - Victor");
embed.setURL("https://docs.google.com/spreadsheets/d/1JUxm3ykqCWCagXZqGo390fO9Fl7IpGcnHmCfdrdBx8w/edit?usp=drivesdk");
guildMember.sendEmbed(embed)
});
client.on('guildMemberUpdate', function(oldUser, newUser) {
if (newUser.guild.id == 368206021526552576) {
if (newUser.roles.find("name", "I broke the rules!")) {
console.log("[STATUS] " + getUserString(newUser) + " --> JAIL");
client.channels.get("369503920877207554").send("<@" + newUser.id + "> :oncoming_police_car: You are now in jail. Appeal here to get out of jail. If you do not appeal successfully within 24 hours, an admin will **ban** you from the server.\n\n" +
"Additionally, if you leave and rejoin this server in an attempt to break out of jail, you will be **banned.**\n\n" +
"Timestamp: " + new Date().toUTCString());
}
if (newUser.roles.find("name", "Interrogation")) {
console.log("[STATUS] " + getUserString(newUser) + " --> INTERROGATION APHC");
client.channels.get("292630922040311808").send("<@" + newUser.id + "> :oncoming_police_car: A member of staff just wishes to make sure you're not someone we've banned before. If you have any social media accounts, just tell us so we can see that you're not someone that we've banned :)");
}
if (newUser.nickname != oldUser.nickname) {
console.log("[STATUS] " + getUserString(newUser) + " --> N(" + newUser.nickname + ")");
var channel = client.channels.get("369221540728012802"); //Bot Warnings
if (newUser.nickname == null) {
channel.send(":abcd: " + getUserString(oldUser) + " :arrow_right: [cleared]");
} else {
channel.send(":abcd: " + getUserString(oldUser) + " :arrow_right: " + newUser.nickname);
}
}
} else if (newUser.guild.id == 287937616685301762) {
if (newUser.roles.find("name", "interrogation")) {
console.log("[STATUS] " + getUserString(newUser) + " --> INTERROGATION WOW");
client.channels.get("319848725566586890").send("<@" + newUser.id + "> :oncoming_police_car: A member of staff just wishes to make sure you're not someone we've banned before. :)");
}
}
});
client.on('userUpdate', function(oldUser, newUser) {
if (newUser.username != oldUser.username) {
var aphcGuild = client.channels.get("369221540728012802").guild;
aphcGuild.fetchMember(newUser).then(function(member) {
console.log("[STATUS] " + getUserString(oldUser) + " --> U(" + newUser.username + ")");
var channel = client.channels.get("369221540728012802"); //Admin Bot warnings
channel.send(":ab: " + getUserString(oldUser) + " :arrow_right: " + newUser.username + ". Check spreadsheet!");
}).catch(function() {
});
}
});
client.on('guildMemberRemove', function(user) {
if (user.roles.find("name", "I Broke The Rules!")) {
console.log("[STATUS] !!! <-- " + getUserString(user));
client.channels.get("369221540728012802").send(":arrow_left: <@" + user.id + "> has left the server in jail.");
}
if (user.guild != null) {
if (user.guild.id == 368206021526552576 || user.guild.id == 278824407743463424 || user.guild.id == 263368501928919040 || user.guild.id == 287937616685301762 || user.guild.id == 305039436490735627 || guildMember.guild.id == 305039436490735627) {
var channel;
if (user.guild.id == 368206021526552576) {
channel = client.channels.get("369221540728012802");
console.log("[STATUS] APHC <-- " + getUserString(user));
} else if (user.guild.id == 263368501928919040) {
channel = client.channels.get("314589053959929866");
console.log("[STATUS] TWOW <-- " + getUserString(user));
} else if (user.guild.id == 287937616685301762) {
channel = client.channels.get("326970091683971072");
console.log("[STATUS] WoW <-- " + getUserString(user));
} else if (user.guild.id == 305039436490735627) {
channel = client.channels.get("332750228975517699");
console.log("[STATUS] STTA <-- " + getUserString(user));
} else {
channel = client.channels.get("320422079130238980");
console.log("[STATUS] ts <-- " + getUserString(user));
}
channel.send(":arrow_left: <@" + user.user.id + "> (" + user.displayName + "#" + user.user.discriminator + ")");
}
}
});
client.on('messageDelete', function(message) {
if (message.content.startsWith("bot:") || message.content.startsWith("mod:")) return; //Don't want to warn about AstralMod deleted messages
if (message.author.id == 361050274615525396) return; //Ignore AstralPlayer
var channel = null;
if (message.guild != null) {
if (panicMode[message.guild.id]) return; //Don't want to be doing this in panic mode!
if (message.guild.id == 140241956843290625) return; //Ignore TGL
if (message.guild.id == 368206021526552576) { //AstrelTaser Cantral
channel = client.channels.get("369221540728012802");
} else if (message.guild.id == 278824407743463424) { //theShell
channel = client.channels.get("290444399731671040");
} else if (message.guild.id == 287937616685301762) { //WoW
channel = client.channels.get("295498899370803200");
} else if (message.guild.id == 297057036292849680) { //ALA
channel = client.channels.get("297762292823490570");
} else if (message.guild.id == 281066689892974592) { //LE
channel = client.channels.get("302821411821453312");
} else if (message.guild.id == 266018132827570176) { //TH
channel = client.channels.get("306041264933961728");
} else if (message.guild.id == 263368501928919040) { //TWOW
channel = client.channels.get("323825759393153025");
} else if (message.guild.id == 305039436490735627) { //STTA
channel = client.channels.get("332735413645082626");
}
}
if (channel != null && message.channel != channel) {
var msg = ":wastebasket: **" + getUserString(message.author) + "** <#" + message.channel.id + "> `" + message.createdAt.toUTCString() + "`.";
if (message.cleanContent.length) {
msg += "\n```\n" +
message.cleanContent + "\n" +
"```";
}
if (message.attachments.size > 0) {
msg += "\nThe following files were attached to this message:";
for (let [key, attachment] of message.attachments) {
if (attachment.height == null) {
msg += "\n```" + attachment.filename + " @ " + parseInt(attachment.filesize) + " bytes long```";
} else {
msg += "\n" + attachment.proxyURL;
}
}
}
channel.send(msg);
}
});
client.on('messageDeleteBulk', function(messages) {
var channel = null;
if (messages.first().guild != null) {
if (panicMode[messages.first().guild.id]) return; //Don't want to be doing this in panic mode!
if (messages.first().guild.id == 140241956843290625) return; //Ignore TGL
if (messages.first().guild.id == 368206021526552576) { //AstrelTaser Cantral
channel = client.channels.get("369221540728012802");
} else if (messages.first().guild.id == 278824407743463424) { //theShell
channel = client.channels.get("290444399731671040");
} else if (messages.first().guild.id == 287937616685301762) { //WoW
channel = client.channels.get("295498899370803200");
} else if (messages.first().guild.id == 297057036292849680) { //ALA
channel = client.channels.get("297762292823490570");
} else if (messages.first().guild.id == 281066689892974592) { //LE
channel = client.channels.get("302821411821453312");
} else if (messages.first().guild.id == 266018132827570176) { //TH
channel = client.channels.get("306041264933961728");
} else if (messages.first().guild.id == 263368501928919040) { //TWOW
channel = client.channels.get("323825759393153025");
} else if (messages.first().guild.id == 305039436490735627) { //STTA
channel = client.channels.get("332735413645082626");
}
}
if (channel != null) {
var message = ":wastebasket: " + parseInt(messages.length) + " messages in <#" + messages.first().channel.id + "> were deleted.\n"
for (let [key, msg] of messages) {
message += "```" + msg.cleanContent + "```";
}
channel.send(message);
}
});
client.on('messageUpdate', function(oldMessage, newMessage) {
if (oldMessage.cleanContent == newMessage.cleanContent) return; //Ignore
var channel = null;
if (oldMessage.guild != null) {
if (oldMessage.guild.id == 368206021526552576) { //AstrelTaser Cantral
channel = client.channels.get("369221540728012802");
} else if (oldMessage.guild.id == 278824407743463424) { //theShell
channel = client.channels.get("290444399731671040");
} else if (oldMessage.guild.id == 287937616685301762) { //WoW
channel = client.channels.get("295498899370803200");
} else if (oldMessage.guild.id == 297057036292849680) { //ALA
channel = client.channels.get("297762292823490570");
} else if (oldMessage.guild.id == 281066689892974592) { //LE
channel = client.channels.get("302821411821453312");
} else if (oldMessage.guild.id == 266018132827570176) { //TH
channel = client.channels.get("306041264933961728");
} else if (oldMessage.guild.id == 263368501928919040) { //TWOW
channel = client.channels.get("323825759393153025");
} else if (oldMessage.guild.id == 305039436490735627) { //STTA
channel = client.channels.get("332735413645082626");
}
}
if (channel != null && oldMessage.channel != channel) {
var msg = ":pencil2: **" + getUserString(oldMessage.author) + "** <#" + oldMessage.channel.id + "> `" + oldMessage.createdAt.toUTCString() + "`.\n";
if (oldMessage.cleanContent.length) {
msg += "```\n" +
oldMessage.cleanContent + "\n" +
"```";
} else {
msg += "```\n[no content]\n```";
}
msg += "```\n" +
newMessage.cleanContent + "\n" +
"```";
if (oldMessage.attachments.size > 0) {
msg += "\nThe following files were attached to this message:";
for (let [key, attachment] of oldMessage.attachments) {
if (attachment.height == null) {
msg += "\n```" + attachment.filename + " @ " + parseInt(attachment.filesize) + " bytes long```";
} else {
msg += "\n" + attachment.proxyURL;
}
}
}
channel.send(msg);
}
});
client.on("guildBanAdd", function(guild, user) {
if (guild.id == 368206021526552576) {
var channel;
console.log("[STATUS] " + getUserString(user) + " --> BAN");
channel = client.channels.get("369221540728012802");
channel.send(":red_circle: " + user.username + " :hammer: ¯\\_(ツ)_/¯ :hammer:");
}
});
client.on("messageReactionAdd", function(reaction, user) {
if (reaction.message.channel.id == 369224177435017226) {
if (!isMod(reaction.message.guild.member(user))) {
if (reaction.emoji.identifier != "plus1:280230222614233088" && reaction.emoji.identifier != "minus1:280230258358222850" && reaction.emoji.identifier != "still:307857698462892032") {
//Remove reaction
reaction.remove(user);
}
}
//console.log("Reaction added: " + reaction.emoji.identifier);
}
});
process.on('unhandledRejection', function(err, p) {
console.log("[ERROR | UNCAUGHT PROMISE] " + err.stack);
});
client.login(api.key).catch(function() {
console.log("[ERROR] Login failed.");
});
|