· 6 years ago · Aug 09, 2019, 06:54 PM
1// Load up the discord.js library
2const Discord = require("discord.js");
3const RetroText = require("retrotext");
4const {
5 version
6} = require("discord.js");
7const QUERY_STRING_SETTINGS = [
8 'client=chrome',
9 'rls=en',
10 'ie=UTF-8',
11 'oe=UTF-8'
12].join('&');
13
14function getText(children) {
15 if (children.children) return getText(children.children);
16 return children.map(c => {
17 return c.children ? getText(c.children) : c.data;
18 }).join('');
19}
20const {
21 letterTrans
22} = require('custom-translate');
23const snekfetch = require('snekfetch');
24const fetch = require('node-fetch');
25const types = ['top'];
26const fs = require("fs");
27const sqlite3 = require("sqlite3").verbose();
28const clocks = ["?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?"]
29const momenttimezone = require("moment-timezone");
30const ImageRegex = /(?:([^:/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*\.(?:png|jpe?g|gifv?|webp|bmp|tiff|jfif))(?:\?([^#]*))?(?:#(.*))?/gi;
31const LinkRegex = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
32const Kitsu = require('kitsu.js');
33const oneLine = require('common-tags');
34const kitsu = new Kitsu();
35const math = require('mathjs');
36const wiki = require('wikijs').default;
37var aq = require('animequote');
38const clock = require("node-emoji-clock");
39const moment = require("moment");
40const m = require("moment-duration-format");
41const os = require('os')
42const cpuStat = require("cpu-stat")
43const ms = require("ms")
44const superagent = require('superagent');
45const translate = require('google-translate-api');
46const YouTube = require('simple-youtube-api');
47const ytdl = require('ytdl-core');
48const catFacts = require('cat-facts');
49const google = require('google-search-results-nodejs')
50const got = require('got');
51const Cleverbot = require("cleverbot-node");
52const var_dump = require('var_dump');
53const mysql = require('mysql');
54var TinyURL = require('tinyurl');
55const eco = require("./discordeco.js");
56var cheerio = require('cheerio');
57let db = JSON.parse(fs.readFileSync("./database.json", "utf8"));
58var coni = {
59 host: '178.33.140.140',
60 user: 'gast',
61 port: '3306',
62 password: 'mymusicgast1234Q%&(*',
63 database: 'Gast',
64 supportBigNumbers: true,
65 bigNumberStrings: true
66
67};
68
69var today = new Date();
70var date = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate();
71var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
72var dateTime = date + ' ' + time;
73var con;
74
75function handleDisconnect() {
76 con = mysql.createConnection(coni); // Recreate the connection, since the old one cannot be reused.
77 con.connect(function (err) {
78 console.log("Datenbank Verbindung aktiv.") // The server is either down
79 if (err) { // or restarting (takes a while sometimes).
80 console.log('Fehler beim Verbindungsaufbau zur Datenbank.', err);
81 setTimeout(handleDisconnect, 2000); // We introduce a delay before attempting to reconnect,
82 }
83 }); // to avoid a hot loop, and to allow our node script to process asynchronous requests in the meantime. If you're also serving http, display a 503 error.
84 con.on('error', function (err) {
85 console.log('Datenbank Fehler.', err);
86 if (err.code === 'PROTOCOL_CONNECTION_LOST') { // Connection to the MySQL server is usually
87 handleDisconnect(); // lost due to either server restart, or a
88 } else { // connnection idle timeout (the wait_timeout
89 throw err; // server variable configures this)
90 }
91 });
92}
93handleDisconnect();
94
95
96// Pass the entire Canvas object because you'll need to access its width, as well its context
97const applyText = (canvas, text) => {
98 const ctx = canvas.getContext('2d');
99
100 // Declare a base size of the font
101 let fontSize = 70;
102
103 do {
104 // Assign the font to the context and decrement it so it can be measured again
105 ctx.font = `${fontSize -= 10}px sans-serif`;
106 // Compare pixel width of the text to the canvas minus the approximate avatar size
107 } while (ctx.measureText(text).width > canvas.width - 300);
108
109 // Return the result to use in the actual canvas
110 return ctx.font;
111};
112
113
114const youtube = new YouTube('AIzaSyBFRmZj5hCapbZ8LQga2J7EdJCC1P9roYU');
115
116const queue = new Map();
117
118
119require('http').createServer(function (request, response) {
120 response.end("Hello! I'm the main module of **THE SECURITY V2** and i`m online.");
121}).listen(process.env.PORT);
122// This is your client. Some people call it `bot`, some people call it `self`,
123// some might call it `cootchie`. Either way, when you see `client.something`, or `bot.something`dk,
124// this is what we're refering to. Your client.
125const client = new Discord.Client();
126const request = require("request")
127
128// Here we load the config.json file that contains our token and our prefix values.
129const config = require("./config.json");
130//Databases
131
132
133
134
135//Functions
136function doMagic8BallVoodoo() {
137 var rand = [':8ball: Absolutely.', ':8ball: Certainly not.', ':8ball: It\'s true.', ':8ball: Can\'t be.', ':8ball: Obviously.', ':8ball: I don\'t think so.', ':8ball: It is a lie.', ':8ball: It is not true.', ':8ball: I doubt it.', ':8ball: I strongly doubt that.', ':8ball: My sources say otherwise.', ':8ball: Edward Snowden says so.', ':8ball: That confuses me. Please explain it again, but slowly.', ':8ball: My contract with the CIA doesn\'t allow me to speak up about that.', ':8ball: You really don\'t want to know that, trust me.', ':8ball: I\'m not sure.', ':8ball: Next time, focus when asking me something.'];
138
139 return rand[Math.floor(Math.random() * rand.length)];
140}
141
142function tossThisCoin() {
143 var rand = ['You flipped a coin. It landed on heads', 'You flipped a coin. It landed on tails.'];
144 return rand[Math.floor(Math.random() * rand.length)];
145}
146
147function wait(ms) {
148 var start = new Date().getTime();
149 var end = start;
150 while (end < start + ms) {
151 end = new Date().getTime();
152 }
153}
154
155function getStatData(location, $) {
156
157 var selector = $('.stats-stat .value').eq(location).text();
158
159 var stat_array = $.parseHTML(selector);
160
161 var stat = 0;
162
163 if (stat_array == null || stat_array.lengh == 0) {
164 return -1;
165
166 } else {
167 stat = stat_array[0].data;
168 }
169
170 return stat;
171}
172var Responses = [
173 "yes",
174 "no",
175 "maybe",
176 "dont know, try again",
177 "Of course no, try again maybe",
178 "i mean, i guess so",
179 "if you say so",
180 "im not saying anything but you know the answer",
181 "definately not",
182 "its a possibility",
183 "a huge chance",
184 "a small chance",
185 "you better hope so",
186 "you better not hope so"
187];
188var jokes = [
189 "What time did the man go to the dentist? Tooth hurt-y",
190 "I'm reading a book about anti-gravity. It's impossible to put down!",
191 "Want to hear a joke about a piece of paper? Never mind... it's tearable.",
192 "I just watched a documentary about beavers. It was the best dam show I ever saw!",
193 "If you see a robbery at an Apple Store does that make you an iWitness?",
194 "Spring is here! I got so excited I wet my plants!",
195 "A ham sandwich walks into a bar and orders a beer. The bartender says, \"Sorry we don’t serve food here.\"",
196 "What’s Forrest Gump’s password? 1forrest1",
197 "I bought some shoes from a drug dealer. I don't know what he laced them with, but I was tripping all day!",
198 "Why do chicken coops only have two doors? Because if they had four, they would be chicken sedans!",
199 "What do you call a factory that sells passable products? A satisfactory.",
200 "A termite walks into a bar and asks, \"Is the bar tender here?\"",
201 "When a dad drives past a graveyard: Did you know that's a popular cemetery? Yep, people are just dying to get in there!",
202 "Two peanuts were walking down the street. One was a salted.",
203 "Why did the invisible man turn down the job offer? He couldn't see himself doing it.",
204 "I used to have a job at a calendar factory but I got the sack because I took a couple of days off.",
205 "How do you make holy water? You boil the hell out of it.",
206 "A three-legged dog walks into a bar and says to the bartender, \"I’m looking for the man who shot my paw.\"",
207 "When you ask a dad if he's alright: \"No, I’m half left.\"",
208 "I had a dream that I was a muffler last night. I woke up exhausted!",
209 "How do you tell the difference between a frog and a horny toad? A frog says, \"Ribbit, ribbit\" and a horny toad says, \"Rub it, rub it.\"",
210 "Did you hear the news? FedEx and UPS are merging. They’re going to go by the name Fed-Up from now on.",
211 "5/4 of people admit that they’re bad with fractions.",
212 "MOM: \"How do I look?\" DAD: \"With your eyes.\"",
213 "What is Beethoven’s favorite fruit? A ba-na-na-na.",
214 "What did the horse say after it tripped? \"Help! I’ve fallen and I can’t giddyup!\”",
215 "Did you hear about the circus fire? It was in tents!",
216 "Don't trust atoms. They make up everything!",
217 "What do you get when you cross an elephant with a rhino? Elephino.",
218 "How many tickles does it take to make an octopus laugh? Ten-tickles.",
219 "What's the best part about living in Switzerland? I don't know, but the flag is a big plus.",
220 "What do prisoners use to call each other? Cell phones.",
221 "Why couldn't the bike standup by itself? It was two tired.",
222 "What do you call a dog that can do magic? A Labracadabrador.",
223 "Why didn't the vampire attack Taylor Swift? She had bad blood.",
224 "NURSE: \"Blood type?\" DAD: \"Red.\"",
225 "SERVER: \"Sorry about your wait.\" DAD: \"Are you saying I’m fat?\”",
226 "What do you call a fish with two knees? A “two-knee” fish.",
227 "I was interrogated over the theft of a cheese toastie. Man, they really grilled me.",
228 "What do you get when you cross a snowman with a vampire? Frostbite.",
229 "Can February March? No, but April May!",
230 "When you ask a dad if they got a haircut: \"No, I got them all cut!\"",
231 "What does a zombie vegetarian eat? “GRRRAAAAAIIIINNNNS!”",
232 "What does an angry pepper do? It gets jalapeño your face.",
233 "Why wasn't the woman happy with the velcro she bought? It was a total ripoff.",
234 "What did the buffalo say to his son when he dropped him off at school? Bison.",
235 "What do you call someone with no body and no nose? Nobody knows.",
236 "Where did the college-aged vampire like to shop? Forever 21.",
237 "You heard of that new band 1023MB? They're good but they haven't got a gig yet.",
238 "Why did the crab never share? Because he's shellfish."
239];
240var memes = [ // sets the answers to an memes
241 "https://cdn.discordapp.com/attachments/527163634237833217/530939977752641546/2qeoo7.png",
242 "https://cdn.discordapp.com/attachments/527163634237833217/530939878830243911/2qeoxa.png",
243 "https://cdn.discordapp.com/attachments/527163634237833217/530939766750052372/2qep8w.png",
244 "https://cdn.discordapp.com/attachments/527163634237833217/530939568619257856/download-1.png",
245 "https://cdn.discordapp.com/attachments/527163634237833217/530940251246690305/synzmeme.png",
246 "https://cdn.discordapp.com/attachments/527163634237833217/530940430158659585/36136696_218502575462231_6228406073368248320_n.png",
247 "https://cdn.discordapp.com/attachments/527163634237833217/530941015826235412/3b853feb-eb79-4376-a341-2a76356f8f07.png",
248 "https://cdn.discordapp.com/attachments/527163634237833217/530952073978839051/CrispShorttermDassie-max-1mb.gif",
249 "https://cdn.discordapp.com/attachments/527163634237833217/530952291704897577/13359-023ee43d-small.png",
250 "https://cdn.discordapp.com/attachments/527163634237833217/530952708098621445/hqdefault.png",
251 'https://images.app.goo.gl/VCWdGwBro6tTXM6C7',
252 'https://images.app.goo.gl/zJ8tJ4VBzy8opAn8A',
253 'https://images.app.goo.gl/cb8uVJqxifvwMkqt5',
254 "https://cdn.discordapp.com/attachments/380758425493176331/381133359331540994/IMG_20171117_193127.jpg",
255 "https://cdn.discordapp.com/attachments/380758425493176331/381133680317300746/IMG_20171102_184348.jpg",
256 "https://cdn.discordapp.com/attachments/380758425493176331/381133680762159104/FB_IMG_1510517360603.jpg",
257 "https://cdn.discordapp.com/attachments/380758425493176331/381133681261150208/FB_IMG_1510489202551.jpg",
258 "https://cdn.discordapp.com/attachments/380758425493176331/381133681261150210/Screenshot_20171111-231640.png",
259 "https://cdn.discordapp.com/attachments/270195186846531585/375657514680844289/DNaJJDSV4AAMttn.jpg",
260 "no meme for you",
261 "https://pbs.twimg.com/media/DO6EN55WsAEb-Rs.jpg",
262 "https://pbs.twimg.com/media/DO4xwBPX0AAHs0X.jpg",
263 "https://pbs.twimg.com/media/DO4kAIyXUAAozT-.jpg",
264 "https://pbs.twimg.com/media/DO1jmbwX0AEHUdX.jpg",
265 "https://pbs.twimg.com/media/DOzFlcuW0AA81Ad.jpg",
266 "https://pbs.twimg.com/media/DOycWnxVwAA37LJ.jpg",
267 "https://pbs.twimg.com/media/DOw8IHCXcAAldFD.jpg",
268 "https://pbs.twimg.com/media/DOuk8n0XkAAzNnN.jpg",
269 "https://pbs.twimg.com/media/DOtSehTWAAMcCtO.jpg",
270 "https://pbs.twimg.com/media/DOp9drtW4AAMY9r.jpg",
271 "https://pbs.twimg.com/media/DOph_E2WAAUNqCP.jpg",
272 "https://pbs.twimg.com/media/DOoWZpNWkAADvaj.jpg",
273 "https://pbs.twimg.com/media/DOm9CW0WsAEnsku.jpg",
274 "https://pbs.twimg.com/media/DOkzmWiW4AA7YYl.jpg",
275 "https://cdn.discordapp.com/attachments/376996612293132289/381391374907604992/3804.PNG",
276 "https://cdn.discordapp.com/attachments/376996612293132289/381391679627984898/Screenshot_35.png",
277 "https://cdn.discordapp.com/attachments/376996612293132289/381392169271033857/Screenshot_20171117-133950.png",
278 "https://cdn.discordapp.com/attachments/376996612293132289/381392265324789762/oo.PNG",
279 "https://pbs.twimg.com/media/DOkYG_LVQAAnUze.jpg",
280 "https://cdn.discordapp.com/attachments/373529215179554817/381397207225466882/2_trans_NvBQzQNjv4Bqbh83xQqW0npElK_R5P3zK9B_zX9vg1_kZZbrPuH9DEA.jpg",
281 "https://i.redd.it/i8u6hdm2ujyz.png",
282 "https://i.imgur.com/cRJASiN.png",
283 "https://i.redd.it/zsq19me8ikyz.jpg",
284 "https://i.redd.it/djyl7e3zujyz.jpg",
285 "https://i.redd.it/kq7bwqumwkyz.png",
286 "https://i.redd.it/lgx21l2b1lyz.jpg",
287 "https://i.redd.it/6vrtquojaoyz.jpg",
288 "https://i.redd.it/9skppp7dfkyz.jpg",
289 "https://i.redd.it/0rleeumvrlyz.jpg",
290 "https://i.redd.it/ikd7rec4okyz.jpg",
291 "https://i.redd.it/luys3k2o9kyz.jpg",
292 "https://i.redd.it/9q0fipz7qpyz.jpg",
293 "https://i.redd.it/qvactvivqkyz.png",
294 "https://i.redd.it/wn8rctmnnlyz.jpg",
295 "https://i.redd.it/3izl4vzmokyz.jpg",
296 "https://i.redd.it/yzs86cyjulyz.png",
297 "https://i.imgur.com/pWgHgea.png",
298 "https://i.redd.it/zr12x6au3kyz.png",
299 "https://i.redd.it/gnqcmeicnjyz.jpg",
300 "https://i.redd.it/472rhn3pllyz.jpg",
301 "https://i.redd.it/ssjgwh71ikyz.png",
302 "https://i.redd.it/fcd1tpsq2nyz.jpg",
303 "https://i.redd.it/xfmvi6b0skyz.png",
304 "https://i.redd.it/hbjzv7uf8nyz.jpg",
305 "https://i.redd.it/ul44ebpgzkyz.png",
306 "https://i.redd.it/z12t5quh4oyz.jpg",
307 "https://i.redd.it/vab7mng8pjyz.jpg",
308 "https://i.imgur.com/ab76I0j.png",
309 "https://i.redd.it/8poui08afnyz.jpg",
310 "https://i.redd.it/k4bwg7csxjyz.jpg",
311 "https://i.redd.it/o247ar2gmjyz.jpg",
312 "https://i.imgur.com/wtKJoLb.jpg",
313 "https://i.redd.it/qm7819rh4nyz.jpg",
314 'no meme for you',
315 "https://i.imgur.com/pMTYs0n.jpg"
316];
317var emoji = [ // sets the answers to an emoji
318 "?",
319 "?",
320 "?",
321 "?",
322 "?",
323];
324var busy = [
325 "http://s2.quickmeme.com/img/c0/c0dd57c40909e0589e638288983426cad8e083b3084bb69788ab3614c2842828.jpg",
326 "http://www.relatably.com/m/img/too-busy-memes/26736dbd86884bf385462bb541123161.jpg",
327 "https://img.memecdn.com/meincraft_c_1074973.jpg",
328 "https://i.imgflip.com/nin5g.jpg",
329 "http://images.memes.com/meme/868357",
330 "https://i.imgflip.com/swzcx.jpg",
331 "https://img.memecdn.com/busy_o_424301.jpg",
332 "http://s2.quickmeme.com/img/47/47d1a9865afa9788dd0291ed906321d9e89e042fd3f7b31035e4cb6dd085f63e.jpg",
333 "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRoPCHhqmusFbTQ1s3_OUbmYMQfQ_kIdLEW7ffuIM3f2AWiUVSqdA"
334];
335var gif = [
336 "https://media.giphy.com/media/Eg2Noq3e44cvK/giphy.gif",
337 "http://p.fod4.com/p/media/b808431fbb/m8YD3waBSPCsYzvwLDcj_donald%20trump%20electrocuted.gif",
338 "https://media.giphy.com/media/PmpA5ohOUl1xC/giphy.gif",
339 "http://www.teamjimmyjoe.com/wp-content/uploads/2017/02/funny-Little-Kim-Jong-un.gif",
340 "http://68.media.tumblr.com/f57839187069c4c1bc65e268840559f7/tumblr_oq96fi4zu51udh5n8o1_250.gif",
341 "http://img62.laughinggif.com/pic/HTTPS9tZWRpYS50ZW5vci5jby9pbWFnZXMvZjFmYWE4ZmJmMzk2NzVkZDhlMWJkOTMxYmMxNTFkMWYvdGVub3IuZ2lm.gif",
342 "http://www.best-gif.com/wp-content/uploads/2016/04/funny-gifs-Stop-the-clown-mom-it-driving-me-crazyyy.gif",
343 "http://9to5animations.com/wp-content/uploads/2017/01/Donald-Trump-funny-gif-image.gif",
344 "https://media.tenor.com/images/4b5f35b6033e266a524a029a61a4d1c6/tenor.gif",
345 "https://media.tenor.com/images/0e2ff58eb8d23a3d22b9b00505c057dd/tenor.gif",
346 "https://media.tenor.com/images/1d4cefd98877009a93f0f09556ffa5a2/tenor.gif",
347 "http://www.teamjimmyjoe.com/wp-content/uploads/2016/02/giphy.gif",
348 "https://media.giphy.com/media/m80Q4HTDNPFHq/giphy.gif",
349 "http://cdn2-www.craveonline.com/assets/mandatory/legacy/2016/05/man_file_1067410_6Funny-GIFS-at-Radass-001.gif",
350 "https://media.tenor.com/images/c26e863624ee27ba7489d2514e9a6418/tenor.gif",
351 "http://teamjimmyjoe.com/wp-content/uploads/2016/11/trump-clinton-godzilla-funny-gifs.gif",
352 "https://s-media-cache-ak0.pinimg.com/originals/50/72/40/507240a9542ffa2663eafb74f49372a9.gif",
353 "http://gifsec.com/wp-content/uploads/2017/04/3gr23bdyqad.gif",
354 "http://www.teamjimmyjoe.com/wp-content/uploads/2015/06/men-in-black-sunglasses.gif",
355 "http://cdn3-www.craveonline.com/assets/mandatory/legacy/2016/06/man_file_1109297_10_mandatory_gifs_of_the_week.gif",
356 "https://media.giphy.com/media/wW95fEq09hOI8/giphy.gif",
357 "https://media.giphy.com/media/l3zoKeX8bMG5sMP4s/giphy.gif",
358 "https://media.giphy.com/media/P8XNUbh3Wuwa4/giphy.gif",
359 "https://media.giphy.com/media/N95FS0GTW33Z6/giphy.gif",
360 "http://68.media.tumblr.com/tumblr_m4uzpgCgx11qhjnqgo1_500.gif",
361 "https://s-media-cache-ak0.pinimg.com/originals/29/1f/c0/291fc0a981073af5c734b50db261ce43.gif",
362 'https://images.app.goo.gl/Fe7dZoH2YpNdjdePA'
363];
364
365var joke = [
366 'Ein Junge hilft einer alten Nonne über die Straße. Sie: Vielen Dank, mein Kleiner. Er: Kein Problem. Batmans Freunde, sind auch meine Freunde.',
367 'Er:Ich war doch gestern gar nicht so betrunken, oder? Sie:Alter, du hast den Duschkopf in den Arm genommen und gesagt er soll aufhören zu weinen!',
368 'Ein Angler geht aufs Eis, um zu Angeln. Mit einer Spitzhacke will er ein Loch in das Eis schlagen. Nach dem ersten Schlag hört er eine Stimme: Hier gibt es keinen Fisch! Er schaut sich um und sieht niemanden. Er schlägt ein zweites Mal zu und wieder diese Stimme: Es gibt hier keinen Fisch! Er schaut sich wieder um und sieht niemanden. Er schlägt zum dritten Mal zu und wieder diese Stimme: Hier gibt es keine Fische! Der Angler ist verwundert und sagt: Gott bist Du es? Darauf die Stimme: Nein! Der Stadion-Sprecher des Eishockey Klubs.',
369 'Beim Doktor: Haben Sie meinen Ratschlag befolgt und mit offenem Fenster geschlafen? Ja, habe ich.Und, ist der Husten verschwunden Das einzige was verschwunden ist, ist mein Laptop und mein Smartphone.',
370 'Ich habe vor Jahren einen Bumerang weggeschmissen. Jetzt lebe ich in ständiger Angst.',
371 'Pappi was ist ein Alkoholiker? Siehst du die 4 Bäume da hinten. Ein Alkoholiker würde 8 Bäume sehen. Aber Papi, dort stehen doch nur 2 Bäume.',
372 'Bin so traurig in letzter Zeit. Ein Freund schlug vor, ich solle mal in den Streichelzoo zur Aufmunterung. War heute dort, aber niemand wollte mich dort streicheln.'
373
374]
375var token = [
376 'Du nix Token kriegen!!!!',
377 'Ne hässliche leute kriegen keinen Token',
378 'Klar hier: NT392..... Warte???? **NE DU BIST NICHT MEIN BESTIZER DU KRIEGST IHN NICHT!!!**'
379
380]
381var join = [
382 'Ach lässt dich auch mal blicken mister?',
383 'Och nö ich wusste es doch...',
384 'Für hässliche leute ist kein Platz'
385]
386var leave = [
387 'Ha! Hattest wohl angst!',
388 'Tja hier ist nur platz für einen Fetten!!'
389]
390let randomFact = catFacts.random();
391
392
393//
394
395
396
397// config.token contains the bot's token
398// config.prefix contains the message prefix.
399//HIER
400
401client.on("ready", () => {
402 //Für die Statusseite
403 setInterval(function () {
404 var data = "MODULE=main";
405
406 var url = 'https://www.open-media.tk/Modulestatus/setstatus.php';
407
408 request({
409 headers: {
410 'Content-Type': 'application/x-www-form-urlencoded'
411 },
412 uri: url,
413 body: data,
414 method: 'POST'
415 }, function (err, res, body) {});
416 }, 10000);
417 // ende
418 con.query('CREATE TABLE IF NOT EXISTS Gast.Botsettings(setting text, value text)', function (error, results, fields) {
419 /*if (error) throw error;
420 console.log('The solution is: ', results[0].solution);*/
421 });
422
423 console.log("Ready! The time is " +
424 momenttimezone().tz("Europe/Copenhagen").format("HH:mm z") + ", " +
425 momenttimezone().tz("America/New_York").format("HH:mm z") + ", and " +
426 momenttimezone().tz("America/Los_Angeles").format("HH:mm z") + ".");
427
428 function switchPresence2() {
429
430 var rand = Math.random();
431
432 rand = rand * 5;
433
434 rand = Math.round(rand);
435
436 if (rand == 0 || rand == 1) {
437
438 client.user.setPresence({
439 status: 'online'
440 });
441
442 }
443
444 if (rand == 2 || rand == 3) {
445
446 client.user.setPresence({
447 status: 'idle'
448 });
449
450 }
451
452 if (rand == 4 || rand == 5) {
453
454 client.user.setPresence({
455 status: 'dnd'
456 });
457
458 }
459
460 }
461
462 // This event will run if the bot starts, and logs in, successfully.
463 console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds. bot Name: ${client.user.tag}`);
464
465 // Example of changing the bot's playing game to something useful. `client.user` is what the
466 // docs refer to as the "ClientUser".
467 let statuses = ["With Cool Commands", `with ${client.users.size} Users`, "on " + client.guilds.size + " Servers", "Need help? then", "Prefix: %", 'Shorten URL available!', '%shorten <your_url>']
468
469 setInterval(function () {
470
471 let status = statuses[Math.floor(Math.random() * statuses.length)];
472
473 client.user.setActivity("" + status + " | %help | m%help")
474
475 }, 30000)
476
477});
478
479
480
481client.on("guildCreate", guild => {
482 // This event triggers when the bot joins a guild.
483 console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`);
484});
485
486client.on("guildDelete", guild => {
487 // this event triggers when the bot is removed from a guild.
488 console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
489});
490
491client.on("guildCreate", guild => {
492
493
494
495 let join = new Discord.RichEmbed()
496
497 .setAuthor(`Added to guild (#${client.guilds.size})`)
498
499 .setColor("00ad14")
500
501 .addField("Guild Name", guild.name, true)
502
503 .addField("Guild ID", guild.id, true)
504
505 .addField("Member Count", guild.memberCount, true)
506
507 .setFooter("Joined on " + new Date());
508
509
510
511 client.channels.get('544259302345670657').send(join);
512
513});
514
515
516
517client.on("guildDelete", guild => {
518
519 let remove = new Discord.RichEmbed()
520
521 .setAuthor(`Removed from guild (#${client.guilds.size})`)
522
523 .setColor("ff0000")
524
525 .addField("Guild Name", guild.name, true)
526
527 .addField("Guild ID", guild.id, true)
528
529 .addField("Member Count", guild.memberCount, true)
530
531 .setFooter("Removed on " + new Date());
532
533
534
535 client.channels.get('544259302345670657').send(remove);
536
537});
538let userCooldown = {};
539
540client.on("message", async message => {
541 if (!db[message.author.id]) db[message.author.id] = {
542 xp: 0,
543 level: 0
544 };
545 db[message.author.id].xp++;
546 let userInfo = db[message.author.id];
547 if(userInfo.xp > 100) {
548 userInfo.level++
549 userInfo.xp = 0
550 message.reply(`Congrats, you leveled up, you're now ${userInfo.level}`)
551 }
552
553 //Wartungen
554
555
556 //wartungen
557
558
559 if (message.channel.type === "dm") return;
560
561 // This event will run on every single message received, from any channel or DM.
562
563 // It's good practice to ignore other bots. This also makes your bot ignore itself
564 // and not get into a spam loop (we call that "botception").
565 if (message.channel.name === "globalchat") {
566 return;
567 }
568 if (message.author.bot) return;
569
570 /*if (userCooldown[message.author.id]) {
571 userCooldown[message.author.id] = false;
572 // run command...
573 setTimeout(() => {
574 userCooldown[message.author.id] = true;
575 }, 300000) // 5 minutes
576 }*/
577 //message counter
578 //global
579 //db.add(`globalMessages_${message.author.id}`, 1);
580 //guild
581 //db.add(`guildMessages_${message.guild.id}_${message.author.id}`, 1);
582 // Also good practice to ignore any message that does not start with our prefix,
583 // which is set in the configuration file.
584 if (message.content.indexOf(config.prefix) !== 0) return;
585
586 // Here we separate our "command" name, and our "arguments" for the command.
587 // e.g. if we have the message "+say Is this the real life?" , we'll get the following:
588 // command = say
589 // args = ["Is", "this", "the", "real", "life?"]
590 const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
591 const command = args.shift().toLowerCase();
592
593 // Let's go with a few common example commands! Feel free to delete or change those.
594
595
596 if (/good job/i.test(message.content)) {
597 message.channel.send('Good job everyone :smirk:'); // sendMessage is deprecated, use send instead
598 }
599
600 // if the user is not on db add the user and change his values to 0
601
602
603
604 var input = message.content.toUpperCase();
605
606 if (input.startsWith(config.prefix + "PMSAY")) {
607 var mes = message.content.split(" ").slice(2).join(" ");
608 var user = message.mentions.users.first();
609 if (user == null) return;
610 var server = message.guild.name;
611 user.send("``" + mes + "``" + " sent by ``" + message.author.username + "`` in the server ``" + server + "``. To message him back, go to a server with the The Security V2 bot added to it and type `[PmSay (user) (message)`` or just privately message him back.");
612 }
613 if (input.startsWith(config.prefix + "SHORTEN HTTP://") || input.startsWith(config.prefix + "SHORTEN HTTPS://")) {
614 var mes = message.content.split(" ").slice(1).join(" ");
615 var mes = encodeURI(message.content.split(" ").slice(1).join(" "))
616 TinyURL.shorten(mes, function (res) {
617 message.channel.send(message + " shortened is: " + res)
618 })
619 };
620 console.log("After PMSAY");
621
622
623 if (message.content.toString().startsWith("feelsbadman")) {
624 message.channel.send("https://openclipart.org/image/2400px/svg_to_png/222252/feels.png");
625 }
626
627 console.log("After feelsbadman");
628
629 if (command === "ping") {
630 // Calculates ping between sending a message and editing it, giving a nice round-trip latency.
631 // The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)
632 const m = await message.channel.send("Ping?");
633 m.edit(`Pong! My ping is: ${m.createdTimestamp - message.createdTimestamp}ms. The Discord API has ${Math.round(client.ping)}ms`);
634 }
635
636 console.log("After ping");
637
638 if (command === "say") {
639 // makes the bot say something and delete the message. As an example, it's open to anyone to use.
640 // To get the "message" itself we join the `args` back into a string with spaces:
641 const sayMessage = args.join(" ");
642 // Then we delete the command message (sneaky, right?). The catch just ignores the error with a cute smiley thing.
643 message.delete().catch(O_o => {});
644 // And we get the bot to say the thing:
645 message.channel.send(sayMessage);
646 }
647
648 console.log("After say");
649
650 if (command === "kick") {
651 // This command must be limited to mods and admins. In this example we just hardcode the role names.
652 // Please read on Array.some() to understand this bit:
653 // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some?
654 if (!message.member.permissions.has("KICK_MEMBERS"))
655 return message.reply("Sorry, you don't have permissions to use this!");
656
657 // Let's first check if we have a member and if we can kick them!
658 // message.mentions.members is a collection of people that have been mentioned, as GuildMembers.
659 // We can also support getting the member by ID, which would be args[0]
660 let member = message.mentions.members.first() || message.guild.members.get(args[0]);
661 if (!member)
662 return message.reply("Please mention a valid member of this server");
663 if (!member.kickable)
664 return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
665
666 // slice(1) removes the first part, which here should be the user mention or ID
667 // join(' ') takes all the various parts to make it a single string.
668 let reason = args.slice(1).join(' ');
669 if (!reason) reason = "No reason provided";
670
671 // Now, time for a swift kick in the nuts!
672 await member.kick(reason)
673 .catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
674 message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
675
676 message.channel.send("https://media1.tenor.com/images/eaad1315b368d5aa1fea7f19bf6b47df/tenor.gif?itemid=8055436")
677
678 }
679
680 console.log("After kick");
681
682 if (command === "ban") {
683 // Most of this command is identical to kick, except that here we'll only let admins do it.
684 // In the real world mods could ban too, but this is just an example, right? ;)
685 if (!message.member.permissions.has("BAN_MEMBERS"))
686 return message.reply("Sorry, you don't have permissions to use this!");
687
688 let member = message.mentions.members.first();
689 if (!member)
690 return message.reply("Please mention a valid member of this server");
691 if (!member.bannable)
692 return message.reply("I cannot ban this user! Do they have a higher role? Do I have ban permissions?");
693
694 let reason = args.slice(1).join(' ');
695 if (!reason) reason = "No reason provided";
696
697 await member.ban(reason)
698 .catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));
699 message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`);
700
701 message.channel.send("https://media1.tenor.com/images/7a9fe7f23548941c33b2ef1609c3d31c/tenor.gif?itemid=10045949")
702 }
703
704 console.log("After ban");
705
706 if (command === "messages") {
707 let member = message.mentions.members.first();
708 if(!member) {
709 member = message.member;
710 }
711 let global = await db.fetch(`globalMessages_${member.id}`);
712 let guild = await db.fetch(`guildMessages_${member.guild.id}_${member.id}`);
713
714 message.channel.send(`**Global Messages:** \`${global}\`\n**Guild Messages:**\`${guild}\``)
715 }
716
717 console.log("After messages");
718
719 if (command === "clear") {
720 // This command removes all messages from all users in the channel, up to 100.
721
722 // get the delete count, as an actual number.
723 const deleteCount = parseInt(args[0], 10);
724
725 // Ooooh nice, combined conditions. <3
726 if (!deleteCount || deleteCount < 2 || deleteCount > 100)
727 return message.reply("Please provide a number between 2 and 100 for the number of messages to delete");
728
729 // So we get our messages, and delete them. Simple enough, right?
730 const fetched = await message.channel.fetchMessages({
731 limit: deleteCount
732 });
733 message.channel.bulkDelete(fetched)
734 .catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
735
736 message.channel.send("https://media1.tenor.com/images/d79c82f556a950f1b131dd7c19bd74f8/tenor.gif?itemid=13878405")
737 }
738
739 console.log("After clear");
740 if (command === "echo") {
741 let msg = args.join(" ")
742 if (!msg) return message.reply(`Nutzung: %echo (nachricht)`)
743 message.channel.send(msg)
744 message.delete()
745 return
746 }
747 console.log("After echo");
748 if (command === "softban") {
749 if (!message.member.permissions.has("BAN_MEMBERS"))
750 return message.channel.send("Sorry, you don't have the permission to use this Command!")
751 try {
752
753 let toban = message.mentions.members.first()
754 let reason = args.slice(1).join(" ")
755 if (!message.member.permissions.has("KICK_MEMBERS")) {
756 message.reply("Du brauchst die KICK_MEMBERS Berechtigung!").then(msg => msg.delete(4000));
757 return;
758 }
759 if (!toban) {
760 message.reply("Please mention a valid member of this Server").then(msg => msg.delete(4000));
761 return;
762 }
763 if (toban.permissions.has("BAN_MEMBERS")) {
764 message.reply("I can not ban this user! Do I have a Higher Role?.").then(msg => msg.delete(4000));
765 return;
766 }
767 if (!reason) reason = "No reason peovided."
768 var reportch = message.guild.channels.find(ch => ch.name === "reports")
769
770 toban.ban(1, reason).then(toban => {
771 message.guild.unban(toban.user.id)
772 message.reply("**" + toban.user.username + "** has been Softbanned: " + reason)
773 if (reportch) {
774 let embed = new Discord.RichEmbed()
775 .setTitle("~Softban~")
776 .setColor("#ff0000")
777 .addField("Softbanned User:", toban.user.username + " with ID: " + toban.id)
778 .addField("Softbanned from:", "<@" + message.author.id + ">")
779 .addField("Time:", message.createdAt.toString())
780 .addField("Reason:", reason)
781 .setFooter("softbanlog")
782 reportch.send(embed)
783 }
784 })
785
786
787
788 } catch (err) {
789 message.respond("Whoopsie, there was an Error please Contact the Developer Team.");
790 console.log("*" + command + " - Error! Stack:\n " + err.stack);
791 }
792 return
793 }
794 console.log("After softban");
795 if (command === "selfdestroy") {
796 try {
797 message.channel.send("5...?").then(msg => {
798
799 var msg = msg
800
801 setTimeout(function () {
802 msg.edit("4...?")
803 }, 1000)
804
805 setTimeout(function () {
806 msg.edit("3...?")
807 }, 2000)
808
809 setTimeout(function () {
810 msg.edit("2...?")
811 }, 3000)
812
813 setTimeout(function () {
814 msg.edit("1...?")
815 }, 4000)
816
817 setTimeout(function () {
818 msg.edit("BOOOOOM!!! ???")
819 }, 5000)
820
821
822 var x = Math.floor((Math.random() * 2) + 1);
823
824 if (x == 1) {
825
826 setTimeout(function () {
827 msg.edit("BOOOOOM!!! ???\n\nHmmmm,")
828 }, 8000)
829
830 setTimeout(function () {
831 msg.edit("BOOOOOM!!! ???\n\nHmmmm,that did")
832 }, 10000)
833
834 setTimeout(function () {
835 msg.edit("BOOOOOM!!! ???\n\nHmmmm,that did not work")
836 }, 11000)
837
838 setTimeout(function () {
839 msg.edit("BOOOOOM!!! ???\n\nHmmmm, that did not work out somehow,")
840 }, 12000)
841
842 setTimeout(function () {
843 msg.edit("BOOOOOM!!! ???\n\nHmmmm, that did not work out somehow I'm still there")
844 }, 13000)
845 } else if (x == 2) {
846 setTimeout(function () {
847 msg.edit("BOOOOOM!!! ???\n\nHmmmm,")
848 }, 8000)
849
850 setTimeout(function () {
851 msg.edit("BOOOOOM!!! ???\n\nHmmmm, that")
852 }, 10000)
853
854 setTimeout(function () {
855 msg.edit("BOOOOOM!!! ???\n\nHmmmm, that looked")
856 }, 12000)
857
858 setTimeout(function () {
859 msg.edit("BOOOOOM!!! ???\n\nHmmmm, that looked cooler in the cinema")
860 }, 13000)
861
862 setTimeout(function () {
863 msg.edit("BOOOOOM!!! ???\n\nHmmmm, that looked cooler in the cinema https://tenor.com/uDdW.gif")
864 }, 14000)
865
866 }
867 message.channel.send("https://media1.tenor.com/images/6e87720a1678f9ab3abce1f161fb30c7/tenor.gif?itemid=11966482")
868 })
869
870
871 } catch (err) {
872 message.respond("Whoopsie, there was an error.");
873 console.log("*" + command + " - Error! Stack:\n " + err.stack);
874
875
876 }
877 return
878 }
879 console.log("After selfdestroy");
880 if (command === "connectedservers") {
881 if (message.author.id === "265912060007677953" || message.author.id === "510104921887211533") {
882 var hembed = new Discord.RichEmbed()
883
884 .setTitle("**Connected Servers** (_" + client.guilds.size + " Servers_)")
885 .setThumbnail('https://goo.gl/images/RR1tkp')
886 .setColor("#2E64FE");
887
888 var guildids = client.guilds.keyArray();
889 for (var i = 0; i < guildids.length; i = i + 1) {
890 var joinedat = new Date(client.guilds.get(guildids[i]).joinedTimestamp);
891 hembed.addField("● " + client.guilds.get(guildids[i]).name, " ○ Owner: " + client.guilds.get(guildids[i]).owner.user.username + "#" + client.guilds.get(guildids[i]).owner.user.discriminator + "\n ○ Gejoined am: " + joinedat.getDate() + "." + (joinedat.getMonth() + 1) + "." + joinedat.getFullYear() + " um " + joinedat.getHours() + ":" + joinedat.getMinutes() + ":" + joinedat.getSeconds() + " Uhr");
892 }
893 message.channel.send(hembed);
894 }
895 return
896 }
897 console.log("After connectedservers");
898 if (command === "restart") {
899 if (message.author.id === "510104921887211533" || message.author.id === "265912060007677953") {
900
901 console.log(message.author.name + " has restarted the Bot!");
902 client.user.setPresence({
903 status: 'idle',
904 game: {
905 name: 'Loading Code..',
906 type: 4
907 }
908 });
909
910 let hembed = new Discord.RichEmbed()
911
912 .setTitle("**RESTART**")
913 .setThumbnail('https://infobot.lima-city.de/BotPictures/TAC_NETWORK/restart.gif')
914 .setColor("#2E64FE")
915 .addField("Bot is Restarting", "Please wait...")
916 message.channel.send(hembed).then(msg => process.exit(1));
917
918 message.channel.send("https://media1.tenor.com/images/0dc1fc221b67b8ba5e1102f4c246fd7d/tenor.gif?itemid=4771017")
919 }
920 return
921 }
922 console.log("After restart");
923 if (command === "serverinfo") {
924 try {
925 var server = message.guild
926
927 var textChannels = 0
928 var voiceChannels = 0
929 var categoryChannels = 0
930
931 for (channel in server.channels.array()) {
932 var channel = server.channels.array()[channel]
933 if (channel.type == 'text') textChannels += 1
934 if (channel.type == 'voice') voiceChannels += 1
935 if (channel.type == 'category') categoryChannels += 1
936 }
937
938 var online = 0
939 var offline = 0
940
941 for (member in server.members.array()) {
942 var member = server.members.array()[member]
943 if (!member.user) continue
944 if (member.user.presence.status == 'offline') {
945 offline += 1
946 } else {
947 online += 1
948 }
949 }
950
951 var rolecount = 0
952 var roles = []
953 for (role in server.roles.array()) {
954 var role = server.roles.array()[role]
955 rolecount += 1
956 roles += `<@&${role.id}> `
957 }
958
959
960 var admins = ''
961 for (member in server.members.array()) {
962 member = server.members.array()[member]
963 try {
964 if (member.hasPermission('ADMINISTRATOR') && !member.user.bot) {
965 admins += `<@${member.id}>\n`
966 }
967 } catch (error) {
968 continue
969 }
970 }
971
972 var createdAt = server.createdAt.getDate() + '/' + (server.createdAt.getMonth() + 1) + '/' + server.createdAt.getFullYear()
973
974 var rolecounter = 0
975 let rolelist = ''
976 for (role in server.roles.array()) {
977 rolecounter += 1
978 rolelist += `<@&${server.roles.array()[role].id}> `
979 }
980 message.guild.fetchBans()
981 .then(bans => {
982 let embed = new Discord.RichEmbed()
983 .setColor("#28f57d")
984 .setThumbnail(server.iconURL)
985 .setAuthor(server.name, server.iconURL)
986 .setFooter(`ID: ${server.id} | Erstellt: ${createdAt}`)
987 .addField("Owner:", "<@" + message.guild.ownerID + ">")
988 .addField("Admins:", admins)
989 .addField("Region:", server.region)
990 .addField("TextChannels:", textChannels.toString())
991 .addField("voicechannels:", voiceChannels.toString())
992 .addField("Categorys:", categoryChannels.toString())
993 .addField("Members:", (server.members.array().length).toString())
994 .addField("Online:", online.toString())
995 .addField("Offline:", offline.toString())
996 .addField("Role:", rolecounter - 1)
997 .addField("Bans:", bans.size)
998 message.channel.send({
999 embed
1000 })
1001 })
1002 } catch (err) {
1003 message.respond("Whoopsie, there was an error.");
1004 console.log("*" + command + " - Error! Stack:\n " + err.stack);
1005 }
1006 return
1007 }
1008 console.log("After serverinfo");
1009
1010 console.log("After help");
1011 if (command === "change-log") {
1012 var embed = new Discord.RichEmbed()
1013 .setTitle("Alle Change Logs")
1014 .addField("Version: 2.0.0", 'Bot translated to english')
1015 .setFooter("Change Log | by Tayron, Felixprogram and McCookieHD")
1016 .setColor("GREEN")
1017 message.channel.send(embed)
1018
1019 message.channel.send("https://media1.tenor.com/images/8967d0cb47a158f1a6b9e0d4639ac5d1/tenor.gif?itemid=9610015")
1020 }
1021 console.log("After change-log");
1022 if (command === "developers") {
1023 var embed = new Discord.RichEmbed()
1024 .setTitle("My Fat Developers")
1025 .addField("H-Dev:", "Tayron M.#2233 , м¢¢σσкιє卄∂ | ¢няιѕ ツ#0742 and UltimatumGamer#4693")
1026 .addField("Co-developer:", "Professor Varox#3625")
1027 .setColor("RED")
1028 message.channel.send(embed);
1029
1030 return;
1031 }
1032 console.log("After developers");
1033
1034
1035
1036 if (command === 'userinfo') {
1037 const moment = require('moment');
1038 message.delete()
1039 let user = message.mentions.users.first() || client.users.get(args[0]) || message.author;
1040 let member = message.guild.member(user);
1041 moment.locale('de');
1042 const joinDiscord = moment(user.createdAt).format('llll');
1043 const joinServer = moment(user.joinedAt).format('llll');
1044 const tick = client.emojis.find(emoji => emoji.name === "dcbt");
1045 const cross = client.emojis.find(emoji => emoji.name === "dcbx");
1046 if (user.presence.status === 'online') {
1047 st = 'Online'
1048 }
1049 if (user.presence.status === 'dnd') {
1050 var st = 'DND'
1051 }
1052 if (user.presence.status === 'idle') {
1053 var st = 'Abwesend'
1054 }
1055 if (user.presence.status === 'offline') {
1056 var st = 'Offline'
1057 }
1058 if (user.bot == true) {
1059 var bo = tick
1060 }
1061 if (user.bot == false) {
1062 var bo = cross
1063 }
1064
1065 rl = member.roles.map(roles => `${roles.name}`).join(` \`\`||\`\` `)
1066 if (rl.length > 500) {
1067 var rl = "To much roles to list it here."
1068 }
1069
1070
1071 let embed = new Discord.RichEmbed()
1072 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
1073 .setColor(`RANDOM`)
1074 .setThumbnail(`${user.displayAvatarURL}`)
1075 .setTitle('__**User - Info**__')
1076 .addField('**Name**', user.username + '#' + user.discriminator, true)
1077 .addField('**ID**', user.id, true)
1078 .addField('**Status**', st, true)
1079 .addField("**Game**", `${user.presence.game ? user.presence.game.name : '-'}`, true)
1080 .addField('**Nickname**', `${member.nickname !== null ? `${member.nickname}` : '-'}`, true)
1081 .addField("**Bot**", `${bo}`, true)
1082 .addField('**joined at**', `${moment.utc(user.joinedAt).format('dddd, Do MMMM YYYY')}`, true)
1083 .addField('**Created at**', `${moment.utc(user.createdAt).format('dddd, Do MMMM YYYY')}`, true)
1084 .addField("**Roles**", `${rl} (${member.roles.size})`, true)
1085 .setFooter(`For: ${message.author.username}`, message.author.displayAvatarURL)
1086 .setTimestamp();
1087
1088 message.channel.send({
1089 embed: embed
1090 });
1091
1092 message.channel.send("https://media1.tenor.com/images/5ee174df2f751a6a69e6819ec731bfec/tenor.gif?itemid=14144276");
1093
1094
1095 };
1096 console.log("After userinfo");
1097 if (command === "invite") {
1098 var embed = new Discord.RichEmbed()
1099 .setTitle("Invite")
1100 .addField("Invite me", 'to invite me klick [here](https://discordapp.com/oauth2/authorize?client_id=576803002841825314&scope=bot&permissions=8)!')
1101 message.channel.send(embed)
1102
1103 message.channel.send("https://media1.tenor.com/images/9fb6989e2257777f6edb4fcf2984fcca/tenor.gif?itemid=5275330");
1104
1105
1106 }
1107 console.log("After invite");
1108 //Um diesen CMD zu nutzen bitte erstmal "npm install request" eingeben in die Console und oben noch "const request = require("request")" in den Code hinzufügen
1109 if (command === "stats") {
1110
1111 var bot = client
1112 let cpuLol;
1113 cpuStat.usagePercent(function (err, percent, seconds) {
1114 if (err) {
1115 return console.log(err);
1116 }
1117 const duration = moment.duration(bot.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
1118 const embedStats = new Discord.RichEmbed()
1119 .setTitle("**__= STATISTIKEN =__**")
1120 .setColor("RANDOM")
1121 .addField("• Bot Owner", `[**The Coder Crew**](https://glitch.com)`)
1122 .addField("• Uptime ", `${duration}`, true)
1123 .addField("• Users", `${bot.users.size.toLocaleString()}`, true)
1124 .addField("• Servers", `${bot.guilds.size.toLocaleString()}`, true)
1125 .addField("• Channels ", `${bot.channels.size.toLocaleString()}`, true)
1126 .addField("• Discord.js", `v${version}`, true)
1127 .addField("• Node", `${process.version}`, true)
1128 .addField("• Mem usage", `\`\`\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} / ${(os.totalmem() / 1024 / 1024).toFixed(2)} MB\`\`\``, true)
1129 .addField("• CPU", `\`\`\`md\n${os.cpus().map(i => `${i.model}`)[0]}\`\`\``)
1130 .addField("• CPU usage", `\`${percent.toFixed(2)}%\``, true)
1131 .addField("• Arch", `\`${os.arch()}\``, true)
1132 .addField("• Platform", `\`\`${os.platform()}\`\``, true)
1133 .addField("• API Latency", `${Math.round(bot.ping)}ms`)
1134 .addField("• Servers in", `${bot.guilds.size}`, true)
1135 .addField("• Total Users", `${bot.users.size}`, true)
1136 .addField("• Total Channels", `${bot.channels.size}`, true)
1137 .addField("<:accesspointnetwork:603714856851603472> Ping", `${Math.round(client.ping)}ms`)
1138 .setTimestamp()
1139 .setFooter(bot.user.username, bot.user.displayAvatarURL)
1140 .setThumbnail(bot.user.displayAvatarURL)
1141
1142
1143 message.channel.send(embedStats)
1144 });
1145 }
1146
1147 console.log("After stats");
1148
1149
1150 if (command === "weather") {
1151 try {
1152
1153 if (!args[0]) {
1154 message.reply('Please enter a city!');
1155 return;
1156 }
1157
1158 let apiKey = '71afa79e8bd5513a690c807da7d09a15';
1159 let city = args.join(' ')
1160 let url = 'http://api.openweathermap.org/data/2.5/weather?q=' + city + '&lang=en&units=imperial&appid=' + apiKey
1161
1162 request(url, function (err, response, body) {
1163 if (err) {
1164 console.log('error:', err);
1165 } else {
1166 let weather = JSON.parse(body)
1167 if (!weather.main) return message.reply("There is no data available for the entered value")
1168
1169 let temperature_min = Math.round((weather.main.temp_min - 32) / 1.8).toString()
1170 let temperature_max = Math.round((weather.main.temp_max - 32) / 1.8).toString()
1171 let temperature = Math.round((weather.main.temp - 32) / 1.8).toString()
1172 let windspeed = (Math.round(weather.wind.speed * 1.609344)).toString()
1173
1174 let iconurl = "http://openweathermap.org/img/w/" + weather.weather[0].icon + ".png";
1175
1176 embed = new Discord.RichEmbed()
1177 embed.setTitle("Weather for: " + weather.name + ", " + weather.sys.country)
1178 embed.setColor(0x33bbff)
1179 embed.setThumbnail(iconurl)
1180 embed.addField('Weather condition: ', weather.weather[0].description)
1181 embed.addField("Current temperature: ", temperature + " °C")
1182 embed.addField("Temperature Min/Max:", "**Min:** " + temperature_min + " °C\n**Max:** " + temperature_max + " °C")
1183 embed.addField('Wind speed', windspeed + ' km/h')
1184 embed.addField('Humidity: ', weather.main.humidity + "%")
1185 embed.setFooter("Powered by: OpenWeatherMap", "https://alternative.me/icons/openweathermap.jpg")
1186
1187
1188 message.channel.send(embed)
1189 }
1190 });
1191 } catch (err) {
1192 message.respond("Something went wrong here!");
1193 console.log("*" + command + " - Error! Stack:\n " + err.stack);
1194 }
1195 return
1196 }
1197 console.log("After weather");
1198 if (command === 'trigger') {
1199 var embed = new Discord.RichEmbed()
1200 .setTitle("?:warning:?")
1201 .addField("error.detected", "Your life is now destroyed")
1202 .setColor('RED')
1203 message.channel.send(embed)
1204 message.channel.send('https://tenor.com/view/dog-trigger-triggered-gif-12729162')
1205 }
1206 console.log("After trigger");
1207 if (command === 'billig') {
1208 var embed = new Discord.RichEmbed()
1209 .setTitle('Billig?')
1210 .addField(' ich Bin billig')
1211 .setColor('GREEN')
1212 .setFooter('?????????')
1213 message.channel.send(embed)
1214
1215 message.channel.send('https://tenor.com/view/tourette-jan-gewitter-im-kopf-billig-ich-bin-billig-gif-13954294');
1216
1217 }
1218 console.log("After billig");
1219 if (command === 'fly') {
1220 var embed = new Discord.RichEmbed()
1221 .setTitle('Fly')
1222 .setDescription('I belive i can Fly')
1223 .setFooter('?????')
1224 .setColor('RANDOM')
1225 .setImage('https://tenor.com/view/lol-baby-cute-toddler-funny-gif-11493121')
1226 message.channel.send(embed);
1227 }
1228 console.log("After fly");
1229 if (command === '13') {
1230 var embed = new Discord.RichEmbed()
1231 .setTitle('Artikel 13')
1232 .setDescription('F€CK Artikel 13')
1233 .setFooter('?????')
1234 message.channel.send(embed)
1235 message.channel.send('` https://tenor.com/view/article13-artikel13-axel-voss-meme-memes-gif-13078634');
1236 }
1237 console.log("After 13");
1238 if (command === "8ball") {
1239 if (!args[2]) return message.reply("Error: Bitte stell mir nur Ja/Nein Fragen!");
1240 let replies = ["Ja!", "Nein!", "Keine Ahnung!", "Frag mich später erneut!", "Das sage ich jetzt besser nicht!", "Vermutlich!", "Stell mir bitte einfachere Fragen.",
1241 "Das kann ich so jetzt nicht genau sagen!", "So viel steht fest!", "Das ist eindeutig der Fall!", "Meine Quellen verneinen dies!", "Ohne jeden Zweifel!",
1242 "Konzentriere dich und frag noch mal!", "Meine Antwort lautet: Nein", "Das kann ich jetzt nicht so genau bestätigen!", "Stell mir bitte eine andere Frage!"
1243 ]
1244 let result = Math.floor((Math.random() * replies.length))
1245 let question = args.slice(0).join(" ");
1246
1247 let ballembed = new Discord.RichEmbed()
1248 .setTitle("8Ball")
1249 .addField("Frage:", question)
1250 .addField("Antwort:", replies[result])
1251 .setColor("#00c1cc")
1252 message.channel.send(ballembed);
1253 }
1254 console.log("After 8ball");
1255 if (command === 'ssp') {
1256 var test = args[0]
1257 if (!test) return message.channel.send(`Du musst \`%ssp <stein|papier|schere>\` machen.`)
1258
1259 var choice = test.toLowerCase();
1260 if (choice == "papier" || choice == "p") {
1261 message.channel.send(`Du hast *${args[0].toUpperCase()}* genommen.`)
1262 var numb = Math.floor(Math.random() * 100);
1263 if (numb <= 50) {
1264 var choice2 = "papier";
1265 } else if (numb > 50) {
1266 var choice2 = "stein";
1267 } else {
1268 var choice2 = "schere";
1269 }
1270 if (choice2 == "schere") {
1271 var response = "Ich nehme **Schere**! :v: Ich habe Gewonnen!"
1272 } else if (choice2 == "papier") {
1273 var response = "Ich nehme **Papier**! :hand_splayed: Unentschieden!"
1274 } else {
1275 var response = "Ich nehme **Stein**! :punch: Du hast gewonnen!"
1276 }
1277 message.channel.send(response);
1278 } else if (choice == "stein" || choice == "st") {
1279 message.channel.send(`Du hast *${args[0].toUpperCase()}* genommen.`)
1280 var numb = Math.floor(Math.random() * 100);
1281 if (numb <= 50) {
1282 var choice2 = "papier";
1283 } else if (numb > 50) {
1284 var choice2 = "stein";
1285 } else {
1286 var choice2 = "schere";
1287 }
1288 if (choice2 == "papier") {
1289 var response = "Ich nehme **Papier**! :hand_splayed: Ich habe gewonnen!"
1290 } else if (choice2 == "stein") {
1291 var response = "Ich nehme **Stein**! :punch: Unentschieden!"
1292 } else {
1293 var response = "Ich nehme **Schere**! :v: Du hast gewonnen!"
1294 }
1295 message.channel.send(response);
1296 } else if (choice == "schere" || choice == "sc") {
1297 message.channel.send(`Du hast *${args[0].toUpperCase()}* genommen.`)
1298 var numb = Math.floor(Math.random() * 100);
1299 if (numb <= 50) {
1300 var choice2 = "papier";
1301 } else if (numb > 50) {
1302 var choice2 = "stein";
1303 } else {
1304 var choice2 = "schere";
1305 }
1306 if (choice2 == "stein") {
1307 var response = "Ich nehme **Papier**! :hand_splayed: Du hast gewonnen!"
1308 } else if (choice2 == "schere") {
1309 var response = "Ich nehme **Schere**! :v: Unentschieden!"
1310 } else {
1311 var response = "Ich nehme **Stein**! :punch: Ich habe gewonnen!"
1312 }
1313 message.channel.send(response);
1314 } else {
1315 message.channel.send(`Du musst \`%ssp <stein|papier|schere>\` machen.`);
1316 }
1317 }
1318
1319 console.log("After ssp");
1320 if (command === 'archivement') {
1321
1322
1323 message.channel.send(new Discord.RichEmbed()
1324 .setColor(1435)
1325 .setImage("https://www.minecraftskinstealer.com/achievement/a.php?i=7&h=Erfolg+erzielt%21&t=" + args.join('+')));
1326 }
1327 console.log("After erfolg");
1328 if (command === "idee") {
1329 let msg = args.join(" ")
1330 if (!msg)
1331 return message.channel.send("Bitte schreibe eine Idee!")
1332 var embed = new Discord.RichEmbed()
1333 .setTitle("Neue Idee :bulb:")
1334 .setDescription(`${args.join(" ")}`)
1335 .setFooter("Name: " + `${message.author.tag}` + " ID: " + `${message.author.id}`)
1336 .setColor("GREEN")
1337 client.channels.get("581944246567698452").send(embed)
1338 message.channel.send("Danke, für deine Idee! :pencil: \n Sie wurde bei uns gespeichert! :bulb: ")
1339 message.delete();
1340 }
1341 console.log("After idee");
1342 if (command === "patch") {
1343 var patch = new Discord.RichEmbed()
1344 .setTitle("**Last Patch**")
1345 .addField("Version *(BETA)*", "```0.10.1```")
1346 .addField("Patch: *0.11.0*", "**%patch** Command published!")
1347 .addField("BugFixes: *0.11.* [0]", "/No/")
1348 .setFooter("[.patch] | by HerukanBOT")
1349 .setColor("BLACK")
1350 message.channel.send(patch);
1351 }
1352 console.log("After patch");
1353 //Hier
1354
1355 //BIS HIER
1356 if (command === "toss") {
1357 message.channel.send(tossThisCoin());
1358 message.delete();
1359 }
1360 console.log("After toss");
1361 if (command === "lock-in-their-room") {
1362 if (!args[1]) {
1363 message.channel.send("No!");
1364 //Hier
1365
1366
1367 //Bis hier
1368 message.channel.send(":no_entry: " + args[1] + " is now locked up in their room!");
1369 }
1370 }
1371 console.log("After lock-in-their-room");
1372 if (command === 'avatar') {
1373 let user = message.mentions.users.first() || client.users.get(args[0]) || message.author;
1374
1375 let embed = new Discord.RichEmbed()
1376 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
1377 .setColor(`RANDOM`)
1378 .setImage(`${user.displayAvatarURL}`)
1379 .setTitle(`Avatar von ${user.username}`)
1380 .setFooter(`Angefragt von: ${message.author.username}`, message.author.displayAvatarURL)
1381 .setTimestamp();
1382
1383 message.channel.send({
1384 embed: embed
1385 });
1386 }
1387 console.log("After avatar");
1388 if (command === 'icon') {
1389 let embed = new Discord.RichEmbed()
1390 .setAuthor(`${message.guild.name}`, message.guild.iconURL)
1391 .setColor(`RANDOM`)
1392 .setImage(`${message.guild.iconURL}`)
1393 .setTitle(`Icon von ${message.guild.name}`)
1394 .setFooter(`Angefragt von: ${message.author.username}`, message.author.displayAvatarURL)
1395 .setTimestamp();
1396
1397 message.channel.send({
1398 embed: embed
1399 });
1400
1401
1402
1403
1404
1405
1406
1407
1408 }
1409
1410 console.log("After icon");
1411
1412 if (command === "lenny") {
1413 message.delete().catch(O_o => {})
1414 message.channel.send("( ͡° ͜ʖ ͡°)");
1415 }
1416 console.log("After lenny");
1417 if (command === 'memes') {
1418 let memesembed = new Discord.RichEmbed()
1419 .setAuthor("Die Secruity V2", 'https://cdn.discordapp.com/avatars/576803002841825314/e23414d5d9e2d434aebde5e0d29db601.png?size=2048')
1420 .setColor('RANDOM')
1421 .setImage(memes[Math.floor(Math.random() * memes.length).toString(16)])
1422 .addField('MEMES ARE AMAZING!', 'hehe')
1423 .setFooter("Bot made by Tayron", 'https://cdn.discordapp.com/avatars/510104921887211533/1b9f7b39b2236bec86124c7301bddc98.png?size=2048')
1424 .setThumbnail('https://cdn.discordapp.com/avatars/576803002841825314/e23414d5d9e2d434aebde5e0d29db601.png?size=2048')
1425 message.channel.send(memesembed)
1426
1427 .then(function (message) {
1428 message.react(emoji[Math.floor(Math.random() * emoji.length).toString(16)])
1429 }).catch(function () {
1430 //Something
1431 })
1432 };
1433 console.log("After memes");
1434 if (command === "token") {
1435 message.channel.sendMessage(token[Math.floor(Math.random() * token.length)]);
1436 }
1437 //HIERfr
1438 console.log("After token");
1439
1440 if (command == "cookie") { // creates the command cookie
1441 if (args[0]) message.channel.send(message.author.toString() + " has given " + args[0].toString() + " a cookie! :cookie:") // sends the message saying someone has given someone else a cookie if someone mentions someone else
1442 else message.channel.send("Who do you want to give a cookie to? :cookie: (Correct usage: =cookie @username)"); // sends the error message if no-one is mentioned
1443 }
1444 console.log("After cookie");
1445
1446 if (command == "milk") { // creates the command milk
1447 if (args[0]) message.channel.send(message.author.toString() + " has given " + args[0].toString() + " a glass of milk! :milk:") // sends the message saying someone has given someone else a cookie if someone mentions someone else
1448 else message.channel.send("Who do you want to give a glass of milk to? :milk: (Correct usage: =milk @username)"); // sends the error message if no-one is mentioned
1449 }
1450 console.log("After milk");
1451 if (command == "kill") { // creates the command kill
1452 if (args[0]) message.channel.send(message.author.toString() + " just killed " + args[0].toString() + " holy shizzle! :gun:") // sends the message saying someone has given someone else a cookie if someone mentions someone else
1453 else message.channel.send("Who do you want to kill? :gun: (Correct usage: =kill @username)"); // sends the error message if no-one is mentioned
1454 }
1455 console.log("After kill");
1456 if (command == "snickers") { // creates the command milk
1457 if (args[0]) message.channel.send(message.author.toString() + " has given " + args[0].toString() + " a snickers :chocolate_bar: ") // sends the message saying someone has given someone else a cookie if someone mentions someone else
1458 else message.channel.send("Who do you want to give a snickerd to? :chocolate_bar: (Correct usage: %snickers @username)"); // sends the error message if no-one is mentioned
1459 }
1460 console.log("After snickers");
1461 //HIER
1462
1463
1464 if (command === 'poll') {
1465
1466
1467
1468 if (!args[1]) return message.channel.send('Proper Usage: `=poll <text> (Atleast two words is needed.)`')
1469
1470
1471 let embed = new Discord.RichEmbed()
1472 .setColor('RANDOM')
1473 .setAuthor("Die Secruity V2", 'https://cdn.discordapp.com/avatars/576803002841825314/e23414d5d9e2d434aebde5e0d29db601.png?size=2048')
1474 .addField("| " + args.join(' ') + " |", 'React to vote!')
1475 .setDescription(`Poll Created By ${message.member.user.tag}`)
1476 .setFooter("Bot made by Tayron", 'https://cdn.discordapp.com/avatars/510104921887211533/1b9f7b39b2236bec86124c7301bddc98.png?size=2048')
1477 .setThumbnail('https://images.app.goo.gl/ds5aopYxdEL45CCc8')
1478
1479 let msg = await message.channel.send(embed)
1480
1481
1482 .then(function (message) {
1483 message.react("?")
1484 message.react("?")
1485 }).catch(function () {
1486 //Something
1487 })
1488
1489 message.delete({
1490 timeout: 1000
1491 })
1492 };
1493
1494 console.log("After poll");
1495
1496 if (command === 'spotify') {
1497 message.delete()
1498 // if(!message.member.hasPermission("ADMINISTRATOR" || message.member.id === botconfig.ow1.ow1 || message.member.id === botconfig.ow2.ow2)) return efe.ADHEmbed(client, message, Discord, cperm)
1499
1500
1501 var user = message.mentions.users.first() || message.author;
1502 if (!user.presence.game) {
1503 return message.channel.send(`${user.username} hört nichts auf Spotify`).then(msg => {
1504 msg.delete(8000)
1505 }).catch(console.error)
1506 }
1507 if (user.presence.game.name === 'Spotify' && user.presence.game.type === 2) {
1508 try {
1509 var trackImg = user.presence.game.assets.largeImageURL;
1510 var trackUrl = `https://open.spotify.com/track/${user.presence.game.syncID}`;
1511 var trackName = user.presence.game.details;
1512 var trackAlbum = user.presence.game.assets.largeText;
1513 var trackAuthor = user.presence.game.state;
1514
1515 const embed = new Discord.RichEmbed()
1516 .setTitle('__Spotify - Info__')
1517 .setColor('FF0000')
1518 .setThumbnail(trackImg)
1519 .setFooter(`for: ${message.author.username || message.author.displayName}`, message.author.displayAvatarURL)
1520 .setTimestamp()
1521 .setDescription(`
1522\`?\` **Titel :** \`${trackName}\`
1523\`?\` **Album :** \`${trackAlbum}\`
1524\`?\` **Künstler :** \`${trackAuthor}\`
1525`)
1526 .addField(`${user.username} is listening on Spotify to:`, `[${trackUrl}](${trackUrl})`, false);
1527
1528 return message.channel.send(embed);
1529
1530 } catch (error) {
1531 return message.channel.send('Error').then(msg => {
1532 msg.delete(8000)
1533 }).catch(console.error);
1534 }
1535
1536 } else {
1537 return message.channel.send(`${user.username} is nothing listening on Spotify`).then(msg => {
1538 msg.delete(8000)
1539 }).catch(console.error);
1540 }
1541 }
1542
1543 console.log("After spotify");
1544
1545 if (command === "busy") {
1546 message.channel.sendMessage(busy[Math.floor(Math.random() * busy.length)]);
1547 return
1548 }
1549 if (command === "randomgif") {
1550 message.channel.sendMessage(gif[Math.floor(Math.random() * gif.length)]);
1551 return;
1552 }
1553 if (command === "joke") {
1554 message.channel.sendMessage(joke[Math.floor(Math.random() * joke.length)]);
1555 return;
1556 }
1557 if (command === "asl") {
1558 let [age, gender, location] = args;
1559 message.reply(`Hello ${message.author.username}, I see you're a ${age} year old ${gender} from ${location}. Wanna date?`);
1560 return;
1561 }
1562 if (command === "test-nsfw") {
1563 console.log(message.channel.nsfw); // false
1564
1565 if (message.channel.nsfw === false) {
1566 return message.reply(":warning: This channel isn't marked as NSFW");
1567 } else
1568 if (message.channel.nsfw === true) {
1569 return message.reply(":white_check_mark: This Channel is marked as NSFW");
1570 return;
1571 }
1572 }
1573 if (command === 'nsfw') {
1574
1575 if (!message.channel.nsfw) message.channel.send("⚠ This channel is not marked as NSFW");
1576 if (message.channel.nsfw) {
1577 let {
1578 body
1579 } = await superagent
1580 .get('https://nekos.life/api/v2/img/hentai');
1581
1582 let BotIcon = client.user.username;
1583 let EmbedLewd = new Discord.RichEmbed()
1584 .setColor("#ffa500")
1585 .setImage(body.url)
1586 .setFooter(`,the bot made by Tayron`)
1587
1588 message.channel.send(EmbedLewd);
1589 return;
1590 }
1591 }
1592 if (command == "botinfo") {
1593 let bicon = client.user.displayAvatarURL;
1594 let helpmember = new Discord.RichEmbed()
1595 .setDescription("Bot Info:")
1596 .setColor('RANDOM')
1597 .addField("<:bottag:575051047429472270> Bot Name", `${client.user.tag}`)
1598 .addField("? Creator", "<@510104921887211533> |[ᴛᴀᴄ] ᴛᴀʏʀᴏɴ [ᴊᴀᴠᴀꜱᴄʀɪᴘᴛ ᴄᴏᴅɪɴɢ]#2233 ")
1599 .addField("?️ Created At", `${client.user.createdAt}`)
1600 .addField('<:nodejs:446922023529086976> Node', `${process.version}`)
1601 .addField('<:nodejs:446922023529086976> Library', 'discord.js')
1602 .addField('? Operating System', 'linux')
1603 .addField('? Want to see last update ${bot.user.username}?', 'Usage $changelog (not ready)')
1604 .addField('? Found any bug?', 'Usage $bug <specify a bug> (Not Ready)')
1605 .addField("? **Usefull link**", "[Invite me](https://discordapp.com/oauth2/authorize?client_id=576803002841825314&scope=bot&permissions=8) | [Support Server](https://discord.gg/bPgG3xt)")
1606 .setThumbnail(bicon)
1607 .setFooter(`Requested by: ${message.author.tag}`)
1608 message.channel.send(helpmember);
1609 };
1610 console.log("After botinfo");
1611 if (command === 'gayrate') {
1612
1613 let user = message.mentions.users.first() || message.author;
1614
1615 let gayembed = new Discord.RichEmbed()
1616
1617 .setAuthor(`${user.username}`)
1618
1619 .addField(`Gay Rate`, `You Are **${Math.floor(Math.random() * 101)}% Gay**! :gay_pride_flag:`)
1620
1621 .setColor('RANDOM')
1622
1623 .setFooter(`AH! GAYYYYYY | Requested by ${message.author.tag}`)
1624
1625 return message.channel.send(gayembed)
1626
1627 }
1628 if (command === "cat-fact") {
1629 message.channel.send(":smiley_cat: | " + randomFact + ".");
1630
1631 }
1632 if (command === "nick") {
1633 if (message.author.id === "586156083165397004");
1634 let newNickname = args.join(" ");
1635
1636
1637 message.guild.members.get(client.user.id).setNickname(newNickname)
1638
1639
1640
1641
1642 }
1643 console.log("After nick");
1644 if (command === 'everyone') {
1645
1646 message.channel.send('HA! You ')
1647
1648 };
1649
1650 if (command === 'roblox') {
1651 if (args.length < 1) {
1652 message.channel.send("Please specify a user!")
1653 return;
1654 }
1655 if (args.length > 1) return message.channel.send("My systems are telling me Roblox usernames dont have spaces in their names");
1656 const idjson = await got(`https://api.roblox.com/users/get-by-username?username=${args}`, {
1657 json: true
1658 });
1659 const id = idjson.body.Id
1660 if (!id) return message.channel.send(`User **${args[0]}** was not found`)
1661 const userjson = await got(`https://api.roblox.com/users/${id}`, {
1662 json: true
1663 });
1664 const friendsjson = await got(`https://www.roblox.com/friends/json?userId=${id}¤tPage=0&pageSize=20&imgWidth=110&imgHeight=110&imgFormat=jpeg&friendsType=BestFriends`, {
1665 json: true
1666 });
1667
1668
1669
1670 try {
1671 var embed2 = new Discord.RichEmbed()
1672 const username = userjson.body.Username;
1673 const friends = friendsjson.body.TotalFriends
1674 const online = userjson.body.IsOnline
1675 console.log(online)
1676 embed2.setTitle('__**Roblox - Info**__')
1677 embed2.addField('Name', `${username}`, true)
1678 embed2.setColor("RANDOM")
1679 embed2.setTimestamp()
1680 embed2.setThumbnail(`https://www.roblox.com/bust-thumbnail/image?userId=${id}&width=420&height=420&format=png`)
1681 embed2.addField("ID", `${id}`, true)
1682 if (online === 'true') {
1683 embed2.addField("Online:", `Ja`, true)
1684 } else {
1685 embed2.addField("Online:", `Nein`, true)
1686 }
1687 embed2.addField("Freunde", `${username} hat **${friends}** Freunde.`, true)
1688 embed2.setFooter(`Angefragt von: ${message.author.username}`)
1689
1690 message.channel.send({
1691 embed: embed2
1692 })
1693
1694 } catch (err) {
1695 console.error(err)
1696
1697 }
1698 }
1699 if (command === 'roleinfo') {
1700 let subtext = message.content.split(/\s+/g).slice(1).join(" ");
1701 var role = message.guild.roles.find("name", subtext) || message.mentions.roles.first();
1702 if (role) {
1703 var RichEmbed = new Discord.RichEmbed()
1704 .setTitle(`roleinfo for ${role.name}`)
1705 .setThumbnail(message.guild.iconURL)
1706 .setTimestamp()
1707 .setColor(`${role.hexColor}`)
1708 .setFooter(`Requested by: ${message.member.displayName}`, `${message.author.avatarURL}`)
1709 .addField(`**hoist:**`, `${role.hoist}`)
1710 .addField(`**hexcolor:**`, `${role.hexColor}`)
1711 .addField(`**role id:**`, `${role.id}`)
1712 .addField(`**position:**`, `${role.position}`)
1713 .addField(`**mentionable:**`, `${role.mentionable}`)
1714 .addField(`**editable:**`, `${role.editable}`)
1715 .addField(`**role members:**`, `${role.members.map(m => m.displayName).join(` ,\n`)}`, true)
1716 .addField(`**created at:**`, `${role.createdAt}`)
1717 message.channel.send({
1718 embed: RichEmbed
1719 });
1720 }
1721 if (!role) {
1722 message.channel.send(`either that wasn't a role in this server, or the name is incorrect`);
1723 }
1724 console.log(`${message.author.username} used the roleinfo command to get info about the role "${subtext}" in the server "${message.guild}"`)
1725
1726
1727 }
1728 console.log("After roleinfo");
1729 if (command === 'eval') {
1730 // Put your userID here
1731 if (message.author.id !== '510104921887211533') return;
1732
1733 let evaled;
1734 try {
1735 evaled = await eval(args.join(' '));
1736 var_dump(evaled);
1737 } catch (error) {
1738 console.error(error);
1739 return message.reply('there was an error during evaluation.');
1740 }
1741 }
1742
1743 //NICHT LÖSCHEN! Erstellt von Felixprogram#6960
1744 if (command === 'run' || command === 'run--withoutfeedback') {
1745 if (message.author.id !== '265912060007677953' || message.author.id !== '510104921887211533') return;
1746
1747 if (command === 'run--withoutfeedback') {
1748 let evaled = "";
1749 try {
1750 evaled = await eval(args.join(' '));
1751 } catch (error) {
1752 console.error(error);
1753 }
1754 } else {
1755 let evaled = "";
1756 try {
1757 evaled = await eval(args.join(' '));
1758 var_dump(evaled);
1759 message.reply('done!');
1760 } catch (error) {
1761 console.error(error);
1762 return message.reply('an error occured: ' + error);
1763 }
1764 }
1765 }
1766 // /--/
1767
1768 if (command === 'setavatar') {
1769 if (args.length < 2) {
1770 message.channel.send("no new avatar url specified");
1771 return;
1772 }
1773 client.user.setAvatar(args[1])
1774 .then(user => console.log("--> New avatar: " + user.avatarURL))
1775 .catch(console.error);
1776 };
1777 if (command === 'serverlink') {
1778 replyWithInvite(message)
1779
1780 async function replyWithInvite(message) {
1781 let ch = client.channels.get('587624376225103884')
1782 let invite = await ch.createInvite({
1783 maxAge: 10000, //maximum time for the invite, in milliseconds
1784 maxUses: 2 //maximum times it can be used
1785 }).catch(console.log);
1786
1787 message.reply(invite ? `Here's your invite: ${invite}` : "There has been an error during the creation of the invite.");
1788 }
1789 }
1790
1791
1792 if (command === "support") {
1793 var Support = new Discord.RichEmbed()
1794 .setTimestamp()
1795 .setTitle("❗Support❗")
1796 .addField("Our Support Server", "You found a bug? A command does not respond? You have an idea? You have Feedback? Then join Our Support Server!")
1797 .addField("⬇⬇Check out the Link Below⬇⬇", "https://discord.gg/QtmHD8e")
1798 .setColor("#FFFF99")
1799 .setFooter("Your Open-Bots Team")
1800 message.channel.send(Support)
1801 }
1802 console.log("After support");
1803 if (command === "date") {
1804 var options = {
1805 timeZone: 'UTC+1',
1806 timeZoneName: 'short'
1807 };
1808 message.channel.send("Current Date: " + moment().locale('de').tz("Europe/Copenhagen").format('LLLL'))
1809 }
1810 if (command === "csgo") {
1811 var UR_L = "http://csgo.tracker.network/profile/" + args[0];
1812
1813 if (!args[0]) {
1814 return message.channel.send("Please Enter a valid STEAMID64 or custom url");
1815 }
1816
1817 request(UR_L, function (err, resp, body) {
1818
1819 $ = cheerio.load(body);
1820
1821 var KD = getStatData(0, $);
1822 if (KD == -1) {
1823 return message.channel.send("Invalid, make sure your profile is not private and you have entered a valid STEAMID64 or Custom URL!");
1824 }
1825
1826 var WIN = getStatData(1, $);
1827 var HS = getStatData(4, $);
1828 var MONEY = getStatData(5, $);
1829 var SCORE = getStatData(6, $);
1830 var KILLS = getStatData(7, $);
1831 var DEATHS = getStatData(8, $);
1832 var MVP = getStatData(9, $);
1833 var BS = getStatData(13, $);
1834 var BD = getStatData(14, $);
1835 var HR = getStatData(15, $);
1836
1837 var embed = new Discord.RichEmbed()
1838 .setTitle("__***CSGO Stats***__")
1839 .setURL(UR_L)
1840 .addField("Current stats",
1841 "Total KD: " + "__**" + KD + "**__" + "\n" +
1842 "Total Win%: " + "__**" + WIN + "**__" + "\n" +
1843 "Total MVPs: " + "__**" + MVP + "**__" + "\n" +
1844 "Total Score: " + "__**" + SCORE + "**__" + "\n" +
1845 "Total Kills: " + "__**" + KILLS + "**__" + "\n" +
1846 "Total Deaths: " + "__**" + DEATHS + "**__" + "\n" +
1847 "Total Bombs Set: " + "__**" + BS + "**__" + "\n" +
1848 "Total Bombs Defused: " + "__**" + BD + "**__" + "\n" +
1849 "Total Headshots: " + "__**" + HS + "**__" + "\n" +
1850 "Total Money Earned: " + "__**" + MONEY + "**__" + "\n" +
1851 "Total Hostages Rescued: " + "__**" + HR + "**__", true)
1852 .addField("Powered by:", `**[csgo.tracker.network](http://csgo.tracker.network)**`, false)
1853 .setTimestamp()
1854 .setColor("0x#FF0000")
1855 message.channel.send(embed);
1856
1857 })
1858 }
1859 console.log("After csgo");
1860 if (command === "addRole") {
1861 let rMember = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
1862
1863 if (!message.member.hasPermission("MANAGE_ROLES_OR_PERMISSIONS")) {
1864 message.channel.send("You don't have the permissions to use this command!");
1865 } else {
1866
1867 if (!rMember)
1868 return message.channel.send("Couldn't find that user, yo.");
1869
1870 let role = args.join(" ").slice(22);
1871 if (!role)
1872 return message.channel.send("Specify a role!");
1873
1874 let gRole = message.guild.roles.find('name', role);
1875 if (!gRole)
1876 return message.channel.send("Couldn't find that role.");
1877
1878
1879 if (rMember.roles.has(gRole.id))
1880 return message.channel.send("They already have that role.");
1881
1882 else {
1883 rMember.addRole(gRole.id).catch(console.error);
1884
1885 try {
1886 rMember.send(`Congrats, you have been given the role ${gRole.name}`);
1887 message.channel.send(`The user ${rMember} has a new role ${gRole.name}`);
1888 } catch (e) {
1889 console.log(e.stack);
1890 message.channel.send(`Congrats to <@${rMember.id}>, they have been given the role ${gRole.name}.`)
1891 }
1892 }
1893 }
1894 }
1895
1896
1897
1898
1899 if (command === "mute") {
1900
1901 if (!message.member.hasPermission('MANAGE_MESSAGES')) {
1902 return message.channel.send('Missing Permissions');
1903 }
1904
1905 let toMute = message.mentions.members.first() || message.guild.members.get(args[0]);
1906
1907 if (!toMute) {
1908 return message.channel.send('You did not specifc a user mention ID!');
1909 }
1910
1911 if (toMute.id == message.author.id) {
1912 return message.channel.send('You cannot mute yourself!');
1913 }
1914
1915 if (toMute.highestRole.position >= message.member.highestRole.position) {
1916 return message.channel.send('You cannot mute a member who is higher or has the same role as you!');
1917 }
1918
1919 let role = message.guild.roles.find(r => r.name == 'Muted');
1920
1921 if (!role) {
1922 try {
1923 role = await message.guild.createRole({
1924 name: 'Muted',
1925 color: '#000000',
1926 permissions: [],
1927 });
1928
1929 message.guild.channels.forEach(async (channel, id) => {
1930 await channel.overwritePermissions(role, {
1931 SEND_MESSAGES: false,
1932 ADD_REACTIONS: false,
1933 });
1934 });
1935 } catch (e) {
1936 console.log(e.stack);
1937 }
1938 }
1939
1940 if (toMute.roles.has(role.id)) {
1941 return message.channel.send('This user is already muted!');
1942 }
1943 await toMute.addRole(role);
1944 await message.channel.send("User has been Muted!");
1945 }
1946
1947 console.log("After mute");
1948 //-------------------------------------------------------------------------------------------------------
1949 if (command === "unmute") {
1950 if (!message.member.hasPermission('MANAGE_MESSAGES')) {
1951 return message.channel.send('Missing Permissions');
1952 }
1953
1954 let toUnMute = message.mentions.members.first() || message.guild.members.get(args[0]);
1955
1956 if (!toUnMute) {
1957 return message.channel.send('You did not specifc a user mention ID!');
1958 }
1959
1960 if (toUnMute.highestRole.position >= message.member.highestRole.position) {
1961 return message.channel.send('You cannot unmute a member who is higher or has the same role as you!');
1962 }
1963
1964 let role = message.guild.roles.find(r => r.name == 'Muted');
1965
1966 if (!toUnMute.roles.has(role.id)) {
1967 return message.channel.send('This user isn\'t muted!');
1968 }
1969 await toUnMute.removeRole(role);
1970 await message.channel.send("User has been Unmuted!");
1971 }
1972
1973
1974 if (command === 'balance') {
1975
1976 var output = await eco.FetchBalance(message.author.id)
1977 message.channel.send(`Hey ${message.author.tag}! You own ${output.balance} coins.`);
1978 }
1979
1980 if (command === 'daily') {
1981
1982 var output = await eco.Daily(message.author.id)
1983 //output.updated will tell you if the user already claimed his/her daily yes or no.
1984
1985 if (output.updated) {
1986
1987 var profile = await eco.AddToBalance(message.author.id, 100)
1988 message.reply(`You claimed your daily coins succesfully! You now own ${profile.newbalance} coins.`);
1989
1990 } else {
1991 message.channel.send(`Sorry, you already claimed your daily coins!\nBut no worries, over ${output.timetowait} you can daily again!`)
1992 }
1993
1994 }
1995 console.log("After daily");
1996 if (command === 'resetdaily') {
1997
1998 var output = await eco.ResetDaily(message.author.id)
1999
2000 message.reply(output) //It wil send 'Daily Reset.'
2001
2002 }
2003
2004 if (command === 'leaderboard') {
2005
2006 //If you use discord-economy guild based you can use the filter() function to only allow the database within your guild
2007 //(message.author.id + message.guild.id) can be your way to store guild based id's
2008 //filter: x => x.userid.endsWith(message.guild.id)
2009
2010 //If you put a mention behind the command it searches for the mentioned user in database and tells the position.
2011 if (message.mentions.users.first()) {
2012
2013 var output = await eco.Leaderboard({
2014 filter: x => x.balance > 50,
2015 search: message.mentions.users.first().id
2016 })
2017 message.channel.send(`The user ${message.mentions.users.first().tag} is number ${output} on my leaderboard!`);
2018
2019 } else {
2020
2021 eco.Leaderboard({
2022 limit: 3, //Only takes top 3 ( Totally Optional )
2023 filter: x => x.balance > 50 //Only allows people with more than 100 balance ( Totally Optional )
2024 }).then(async users => { //make sure it is async
2025
2026 if (users[0]) var firstplace = await client.fetchUser(users[0].userid) //Searches for the user object in discord for first place
2027 if (users[1]) var secondplace = await client.fetchUser(users[1].userid) //Searches for the user object in discord for second place
2028 if (users[2]) var thirdplace = await client.fetchUser(users[2].userid) //Searches for the user object in discord for third place
2029
2030 message.channel.send(`My leaderboard:
2031
20321 - ${firstplace && firstplace.tag || 'Nobody Yet'} : ${users[0] && users[0].balance || 'None'}
20332 - ${secondplace && secondplace.tag || 'Nobody Yet'} : ${users[1] && users[1].balance || 'None'}
20343 - ${thirdplace && thirdplace.tag || 'Nobody Yet'} : ${users[2] && users[2].balance || 'None'}`)
2035
2036 })
2037
2038 }
2039 }
2040
2041 if (command === 'transfer') {
2042
2043 var user = message.mentions.users.first()
2044 var amount = args[1]
2045
2046 if (!user) return message.reply('Reply the user you want to send money to!')
2047 if (!amount) return message.reply('Specify the amount you want to pay!')
2048
2049 var output = await eco.FetchBalance(message.author.id)
2050 if (output.balance < amount) return message.reply('You have less coins than the amount you want to transfer!')
2051
2052 var transfer = await eco.Transfer(message.author.id, user.id, amount)
2053 message.reply(`Transfering coins succesfully done!\nBalance from ${message.author.tag}: ${transfer.FromUser}\nBalance from ${user.tag}: ${transfer.ToUser}`);
2054 }
2055
2056 if (command === 'coinflip') {
2057
2058 var flip = args[0] //Heads or Tails
2059 var amount = args[1] //Coins to gamble
2060
2061 if (!flip || !['heads', 'tails'].includes(flip)) return message.reply('Pls specify the flip, either heads or tails!')
2062 if (!amount) return message.reply('Specify the amount you want to gamble!')
2063
2064 var output = await eco.FetchBalance(message.author.id)
2065 if (output.balance < amount) return message.reply('You have less coins than the amount you want to gamble!')
2066
2067 var gamble = await eco.Coinflip(message.author.id, flip, amount).catch(console.error)
2068 message.reply(`You ${gamble.output}! New balance: ${gamble.newbalance}`)
2069
2070 }
2071 console.log("After transfer");
2072 if (command === 'dice') {
2073
2074 var roll = args[0] //Should be number between 1 and 6
2075 var amount = args[1] //Coins to gamble
2076
2077 if (!roll || ![1, 2, 3, 4, 5, 6].includes(parseInt(roll))) return message.reply('Specify the roll, it should be a number between 1-6')
2078 if (!amount) return message.reply('Specify the amount you want to gamble!')
2079
2080 var output = eco.FetchBalance(message.author.id)
2081 if (output.balance < amount) return message.reply('You have less coins than the amount you want to gamble!')
2082
2083 var gamble = await eco.Dice(message.author.id, roll, amount).catch(console.error)
2084 message.reply(`The dice rolled ${gamble.dice}. So you ${gamble.output}! New balance: ${gamble.newbalance}`)
2085
2086 }
2087
2088 if (command == 'delete') { //You want to make this command admin only!
2089
2090 var user = message.mentions.users.first()
2091 if (!user) return message.reply('Pls, Specify a user I have to delete in my database!')
2092
2093 if (!message.guild.me.hasPermission(`ADMINISTRATION`)) return message.reply('You need to be admin to execute this command!')
2094
2095 var output = await eco.Delete(user.id)
2096 if (output.deleted == true) return message.reply('Succesfully deleted the user out of the database!')
2097
2098 message.reply('Error: Could not find the user in database.')
2099
2100 }
2101
2102 if (command === 'work') { //I made 2 examples for this command! Both versions will work!
2103
2104 var output = await eco.Work(message.author.id)
2105 //50% chance to fail and earn nothing. You earn between 1-100 coins. And you get one out of 20 random jobs.
2106 if (output.earned == 0) return message.reply('Aww, you did not do your job well so you earned nothing!')
2107 message.channel.send(`${message.author.username}
2108You worked as a \` ${output.job} \` and earned :money_with_wings: ${output.earned}
2109You now own :money_with_wings: ${output.balance}`)
2110
2111
2112 var output = await eco.Work(message.author.id, {
2113 failurerate: 10,
2114 money: Math.floor(Math.random() * 500),
2115 jobs: ['cashier', 'shopkeeper']
2116 })
2117 //10% chance to fail and earn nothing. You earn between 1-500 coins. And you get one of those 3 random jobs.
2118 if (output.earned == 0) return message.reply('Aww, you did not do your job well so you earned nothing!')
2119
2120 message.channel.send(`${message.author.username}
2121You worked as a \` ${output.job} \` and earned :money_with_wings: ${output.earned}
2122You now own :money_with_wings: ${output.balance}`)
2123
2124 }
2125 if (command === "color") {
2126 var color = message.content.split(/\s+/g).slice(1).join(" ");
2127
2128 if (!color) {
2129 var genColour = '#' + Math.floor(Math.random() * 16777215).toString(16);
2130 const embed = new Discord.MessageEmbed()
2131 .setColor(genColour)
2132 .setImage(`https://dummyimage.com/50/${genColour.slice(1)}/&text=%20`)
2133 .setFooter(genColour);
2134 return message.channel.send('Here\'s your color!', {
2135 embed: embed
2136 });
2137 }
2138
2139 if (((color.indexOf("#") === 0) && color.length === 7) || (!isNaN(color) && color.length <= 8 && color < 16777215)) {
2140 const embed = await new Discord.MessageEmbed()
2141 .setColor(color)
2142 .setImage(`https://dummyimage.com/50/${color.slice(1)}/&text=%20`)
2143 .setFooter(color);
2144 return message.channel.send({
2145 embed
2146 });
2147
2148 } else {
2149 return message.channel.send("Invalid Parameters!");
2150 }
2151 }
2152 console.log("After color");
2153 if (command === "time") {
2154 const location = message.content.split(/\s+/g).slice(1).join(" ");
2155 if (!location) return message.channel.send('Please specify a location for me to gather information from!');
2156
2157 try {
2158 const res = await snekfetch.get(`https://time.is/${location.replace(/^in/, "")}`);
2159 if (res.status !== 200) {
2160 return message.channel.send('❎ | Could not connect to the server!')
2161 }
2162
2163 const text = res.text || res.body.toString();
2164
2165 const date = text.match(new RegExp('<div id="dd" class="w90 tr" onclick="location=\'/calendar\'" ' + 'title="Click for calendar">([^]+?)</div>'))[1]
2166 const time = text.match(/<div id="twd">([^]+?)<\/div>/)[1].replace(/<span id="ampm" style="font-size:21px;line-height:21px">(AM|PM)<\/span>/, ' $1')
2167 const place = text.match(/<div id="msgdiv"><h1>Time in ([^]+?) now<\/h1>/)[1]
2168 const clock = clocks[parseInt(time.split(':')[0], 10) % 12]
2169
2170 var parsedTime = moment(`${date} ${time}`, 'dddd, MMMM D, YYYY HH:mm:ss A')
2171 return message.channel.send(`${clock} | The time in **${place}** is \`${parsedTime.format('dddd, MMMM Do YYYY @ h:mm:ss a')}\`!`)
2172
2173 } catch (err) {
2174 console.log(err)
2175 return message.channel.send(`❎ | Location **${location}** was not found!`);
2176 }
2177
2178 }
2179 if (command === "wiki") {
2180 const query = message.content.split(/\s+/g).slice(1).join(" ");
2181
2182 if (!query) {
2183 return message.channel.send('You must specify something to search!');
2184 }
2185
2186 const data = await wiki().search(query, 1);
2187 if (!data.results || !data.results.length) {
2188 return message.channel.send('No matches found!');
2189 }
2190
2191 const page = await wiki().page(data.results[0]);
2192 const summary = await page.summary();
2193 const paragraphs = summary.split('\n');
2194
2195 if (!query.options) {
2196 paragraphs.length = Math.min(1, paragraphs.length);
2197 }
2198 try {
2199 const embed = new Discord.RichEmbed()
2200 .setAuthor(page.raw.title)
2201 .setDescription(paragraphs.join('\n\n'))
2202 .addField('Link', `**${page.raw.fullurl}**`)
2203 .setFooter('Wikipedia', 'https://a.safe.moe/8GCNj.png')
2204 .setColor('#c7c8ca');
2205 return message.channel.send(`First search result of \`${query}\` on Wikipedia:`, {
2206 embed
2207 });
2208
2209 } catch (err) {
2210 const embed = new Discord.RichEmbed()
2211 .setAuthor(page.raw.title)
2212 .setDescription("This paragraph was too long for the embed, please click the provided link.")
2213 .addField('Link', `**${page.raw.fullurl}**`)
2214 .setFooter('Wikipedia', 'https://a.safe.moe/8GCNj.png')
2215 .setColor('#c7c8ca');
2216 return message.channel.send(`First search result of \`${query}\` on Wikipedia:`, {
2217 embed
2218 });
2219 }
2220 }
2221 if (command === "math") {
2222 var {
2223 equation
2224 } = args;
2225 try {
2226 var solution = math.eval(equation)
2227 } catch (err) {
2228 return message.channel.send(`❎ | I couldn\'t solve that equation! \`${err}\``)
2229 }
2230
2231 const Math = new Discord.MessageEmbed()
2232 .setColor('#767CC1')
2233 .addField('**? Expression**', `\`\`\`${equation}\`\`\``)
2234 .addField('**? Result**', `\`\`\`${solution}\`\`\``);
2235 return message.channel.send({
2236 embed
2237 })
2238
2239 }
2240
2241 if (command === "serverinvite") {
2242 if (message.author.id === "510104921887211533" || message.author.id === "265912060007677953") {
2243 if (!message.guild) {
2244 const getGuild = this.client.guilds.get(args.guild)
2245 const toInv = getGuild.channels.first()
2246
2247 const invite = toInv.createInvite({
2248 maxAge: 120,
2249 maxUses: 1
2250 }).then(async invite => {
2251 message.author.send(`Here's the invite link to **${getGuild.name}**!\n${invite}`)
2252 }).catch(console.error)
2253
2254 } else {
2255 const getGuild = this.client.guilds.get(args.guild)
2256 const toInv = getGuild.channels.first()
2257
2258 const invite = toInv.createInvite({
2259 maxAge: 120,
2260 maxUses: 1
2261 }).then(async invite => {
2262 message.author.send(`Here's the invite link to **${getGuild.name}**!\n${invite}`)
2263 message.channel.send('✅ | I\'ve sent the invite link to your DMs!')
2264 }).catch(console.error)
2265 }
2266 }
2267 }
2268
2269 if (command === "hackban") {
2270 const {
2271 member,
2272 reason
2273 } = args;
2274
2275 if (member === this.client.user.id) return message.channel.send('Please don\'t hackban me...!');
2276 if (member === message.author.id) return message.channel.send('I wouldn\'t dare hackban you...!');
2277
2278 this.client.users.fetch(member).then(async usr => {
2279 await message.channel.send(`Are you sure you want to ban **${usr.tag}**? \`\`(y/n)\`\``);
2280 const msgs = await message.channel.awaitMessages(res => res.author.id === message.author.id, {
2281 max: 1,
2282 time: 30000
2283 });
2284
2285 if (!msgs.size || !['y', 'yes'].includes(msgs.first().content.toLowerCase())) return message.channel.send('Cancelled command!');
2286 if (['n', 'no'].includes(msgs.first().content.toLowerCase())) return message.channel.send('Cancelled command!')
2287
2288 await message.guild.ban(member, {
2289 reason: `${message.author.tag}: ${reason}`
2290 });
2291 return await message.channel.send(`Successfully banned **${usr.tag}**! ?`);
2292 });
2293
2294
2295 }
2296 if (command === "pewds") {
2297 const embed = new Discord.RichEmbed();
2298 got('https://www.reddit.com/r/pewdiepie/random/.json').then(response => {
2299 let content = JSON.parse(response.body);
2300 let permalink = content[0].data.children[0].data.permalink;
2301 let memeUrl = `https://reddit.com${permalink}`;
2302 let memeImage = content[0].data.children[0].data.url;
2303 let memeTitle = content[0].data.children[0].data.title;
2304 let memeUpvotes = content[0].data.children[0].data.ups;
2305 let memeDownvotes = content[0].data.children[0].data.downs;
2306 let memeNumComments = content[0].data.children[0].data.num_comments;
2307 embed.addField(`${memeTitle}`, `[View thread](${memeUrl})`);
2308 embed.setImage(memeImage);
2309 embed.setFooter(`? ${memeUpvotes} ? ${memeDownvotes} ? ${memeNumComments}`);
2310 message.channel.send(embed)
2311 .then(sent => console.log(`Sent a reply to ${sent.author.username}`))
2312 console.log('Bot responded with: ' + memeImage);
2313 }).catch(console.error);
2314 }
2315 if (command === "calc") {
2316 const perms1Embed = new Discord.RichEmbed()
2317
2318 .setTitle("Seems like you're missing a required argument:")
2319 .setDescription("<:molecularLocked:508290171452653581> Error: ``You don't input a calulation!``")
2320 .setTimestamp()
2321 .setColor("BLURPLE");
2322
2323 if (!args[0]) return message.channel.send(perms1Embed);
2324
2325 let resp;
2326 try {
2327 resp = math.eval(args.join(" "));
2328 } catch (e) {
2329
2330 const permsEmbed = new Discord.RichEmbed()
2331
2332 .setTitle("Seems like you're missing a required argument:")
2333 .setDescription("<:molecularLocked:508290171452653581> Error: ``You don't input valid calulation!``")
2334 .setTimestamp()
2335 .setColor("BLURPLE");
2336
2337 message.channel.send(permsEmbed);
2338 return;
2339 }
2340
2341 const embed = new Discord.RichEmbed()
2342 .setColor("BLURPLE")
2343 .setTitle('Calculator')
2344 .setDescription(`[Support Server](https://discord.gg/uA9hb24) | [Invite](https://discordapp.com/oauth2/authorize?client_id=576803002841825314&scope=bot&permissions=8)
2345 \`\`\`js\n${resp}\`\`\``)
2346 .setFooter(`Requested by ${message.author.username}#${message.author.discriminator}`, `${message.author.displayAvatarURL}`);
2347 message.channel.send(embed);
2348 }
2349 console.log("After calc");
2350 if (command === "google") {
2351 message.channel.send("This function is currently in work")
2352 return;
2353
2354 if (args.length > 1) {
2355 throw 'You must enter something to search for!';
2356 }
2357
2358 const res = await got(`https://google.com/search?${QUERY_STRING_SETTINGS}&q=${encodeURIComponent(args.join(' '))}`);
2359 if (res.statusCode !== 200) {
2360 return message.channel.send(`Error! (${res.statusCode}): ${res.statusMessage}`);
2361 }
2362
2363 let $ = cheerio.load(res.body);
2364 let results = [];
2365
2366 $('.g').each((i) => {
2367 results[i] = {};
2368 });
2369
2370 $('.g>.r>a').each((i, e) => {
2371 let raw = e.attribs['href'];
2372 results[i]['link'] = decodeURIComponent(raw.substr(7, raw.indexOf('&sa=U') - 7));
2373 });
2374
2375 $('.g>.s>.st').each((i, e) => {
2376 results[i]['description'] = getText(e);
2377 });
2378
2379 let output = results.filter(r => r.link && r.description)
2380 .slice(0, 3)
2381 .map(r => `${r.link}\n\t${r.description}\n`)
2382 .join('\n');
2383
2384 if (output.length < 1) return message.channel.send("No results for " + args.join(" "))
2385 const filtercheck = ["xxx", "porn", "fuck", "sex", "18+", "anal", "gay", "lesbian", "dick", "cock", "boobs", "ass", "nsfw", "tits", "nudes", "hentai", "nodes", "vagina", "pussy", "penis"]
2386 if (filtercheck.some(word2 => output.toLowerCase().includes(word2))) return message.channel.send("Not allowed to google nsfw content.");
2387
2388 const embed = new Discord.RichEmbed()
2389 .setColor(0x00A2E8)
2390 .setTitle(`Search results for ${args.join(' ')}`)
2391 .setDescription(output)
2392 message.channel.send({
2393 embed
2394 })
2395
2396 }
2397 console.log("After google");
2398 if (command === "giveaway") {
2399
2400 //In work
2401 message.channel.send("This function is currently in work!");
2402 return;
2403 if (args.length < 3) {
2404 message.channel.send("Usage: %giveaway <Winners> <Time until end (in seconds)> <Item(s) to win>")
2405 return;
2406 }
2407 try {
2408 var item = "";
2409 var time = 60;
2410 var winnerCount = 1;
2411 let messageArray = message.content.split(" ");
2412 //-- f!giveaway 1(winnerCount) 60(seconds) Item Giveaway
2413
2414 for (var i = 3; i < messageArray.length; i++) {
2415 item += (messageArray[i] + " ");
2416 }
2417 winnerCount = Number(messageArray[1]);
2418 time = Number(messageArray[2]);
2419
2420
2421 var giveEmbed = new Discord.RichEmbed();
2422 giveEmbed.setDescription(item);
2423 var embedSent = await message.channel.send(giveEmbed);
2424 embedSent.react("?");
2425 setTimeout(function () {
2426 var peopleReacted = embedSent.reactions.get("?").users;
2427 var winners = [];
2428
2429 // Checks if fewer people reacted than the winnerCount allows users to win
2430 if (peopleReacted.length <= winnerCount) {
2431 winners = peopleReacted;
2432 } else {
2433 // Gets as many random users from the peopleReacted as winnerCount allows users to win
2434 for (var i = 0; i < winnerCount; i++) {
2435 var index = Math.floor(Math.random() * peopleReacted.length);
2436 winners.push(peopleReacted[index]);
2437 // After adding a user to winners, remove that item from the array to prevent him from winning multiple times
2438 peopleReacted.splice(index, 1);
2439 }
2440 }
2441
2442 var winnerMsg = "User(s) ";
2443 for (var i = 0; i < winners.length; i++) {
2444 // Add each winner to the winnerMsg
2445 winnerMsg += (winners[i].toString() + ", ");
2446 }
2447
2448 var haveHas;
2449 if (winners.length === 1) {
2450 haveHas = "has";
2451 } else {
2452 haveHas = "have";
2453 }
2454 message.channel.send(`${winnerMsg} ${haveHas} won ${item}`);
2455 }, time * 1000); //--conversting seconds into miliseconds
2456 } catch (err) {
2457 message.channel.send("Usage: %giveaway <Winners> <Time until end (in seconds)> <Item(s) to win>")
2458 }
2459 }
2460 if (command === "modules") {
2461 var modules = new Discord.RichEmbed()
2462 .setTitle(`**All Modules**`)
2463 .addField("Here you can check", "all of our [Modules](http://www.kemsys.com/wp-content/uploads/2018/06/CSR1010-BLE-Module.jpg)")
2464 .addField("No, now really ;)", "[You can check it here](http://www.open-media.tk/status)")
2465 .setColor("RED")
2466
2467 message.channel.send(modules)
2468
2469 }
2470 if (command === "help") {
2471 switch (args[0]) {
2472 case 'all':
2473 var help1 = new Discord.RichEmbed()
2474 .setTitle("All of our Commands (USAGE: `%help 1/2/3/4/5/6/7`)")
2475 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2476 .addField("------------", "**-----------**")
2477 .addField("Site 1", "Moderation commands?")
2478 .addField("------------", "**-----------**")
2479 .addField("Site 2", "Fun Commands?")
2480 .addField("------------", "**-----------**")
2481 .addField("Site 3", "Radio Commands?")
2482 .addField("------------", "**-----------**")
2483 .addField("Site 4", "Music Commands▶⏸")
2484 .addField("------------", "**-----------**")
2485 .addField("Site 5", "Globalchat Help?")
2486 .addField("------------", "**-----------**")
2487 .addField("Site 6", "Other Commands?")
2488 .addField("------------", "**-----------**")
2489 .addField("Site 7", "Bot Team Commands?")
2490 .addField("------------", "**-----------**")
2491 .addField("Disclaimer", "Reaction control is in progress")
2492 .addField("------------", "**-----------**")
2493 .setFooter("Help Made by Tayron")
2494 .setTimestamp()
2495 .setColor("RANDOM")
2496 message.channel.send(help1)
2497
2498
2499
2500 case '1':
2501 var helpsite1 = new Discord.RichEmbed()
2502 .setTitle("Site 1 Moderation commands?(DISCLAIMER Please create a channel named 'mod-log' to use all commands)")
2503 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2504 .addField("Softban", "Softbann a user [Needed Channel : 'Reports']")
2505 .addField("------------", "**-----------**")
2506 .addField("%ban", "Ban a user! [Permission. BAN_MEMBERS]")
2507 .addField("------------", "**-----------**")
2508 .addField("%kick", "Kick a User! [Permission: KICK_MEMBERS]")
2509 .addField("------------", "**-----------**")
2510 .addField("%serverinfo", "Server informations")
2511 .addField("------------", "**-----------**")
2512 .addField("%userinfo", "Displays the Userinfo")
2513 .addField("------------", "**-----------**")
2514 .addField("%avatar", "Display a avatar")
2515 .addField("------------", "**-----------**")
2516 .addField("%icon", "Displays the server icon")
2517 .addField("------------", "**-----------**")
2518 .addField("%hackban", "Ban a user with the ID")
2519 .addField("------------", "**-----------**")
2520 .addField("More Commands", "are in Progress")
2521 .addField("------------", "**-----------**")
2522 .addField("%report", "Report a user")
2523 .addField("------------", "**-----------**")
2524 .addField("%warn", "Warn a user")
2525 .addField("------------", "**-----------**")
2526 .addField("%mute", "Mute a user")
2527 .addField("------------", "**-----------**")
2528 .setFooter("That was it!")
2529 .setTimestamp()
2530 .setColor("BLUE")
2531 message.channel.send(helpsite1)
2532 break;
2533
2534 case '2':
2535 var helpsite2 = new Discord.RichEmbed()
2536 .setTitle("Site 2 Fun Commands?")
2537 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2538 .addField("%selfdestroy", "Destroy myself")
2539 .addField("------------", "**-----------**")
2540 .addField("%trigger", "Triggered!!!")
2541 .addField("------------", "**-----------**")
2542 .addField("%billig", "I am cheap")
2543 .addField("------------", "**-----------**")
2544 .addField("%fly", "I belive i can fly")
2545 .addField("------------", "**-----------**")
2546 .addField("%8ball", "Ask the ball [In German]")
2547 .addField("------------", "**-----------**")
2548 .addField("%ssp", "Play scissors stone paper {In German}")
2549 .addField("------------", "**-----------**")
2550 .addField("%snickers", "Give a snickers to a user")
2551 .addField("------------", "**-----------**")
2552 .addField("%kill", "Murder someone")
2553 .addField("------------", "**-----------**")
2554 .addField("%cookie", "Give Cookies")
2555 .addField("------------", "**-----------**")
2556 .addField("%milk", "Give milk")
2557 .addField("------------", "**-----------**")
2558 .addField("%memes", "Displays memes")
2559 .addField("------------", "**-----------**")
2560 .addField("%archivement", "Create a archievement")
2561 .addField("------------", "**-----------**")
2562 .setColor("GREEN")
2563 message.channel.send(helpsite2)
2564 var helpsite2_2 = new Discord.RichEmbed()
2565 .addField("%lenny", "( ͡° ͜ʖ ͡°)")
2566 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2567 .addField("------------", "**-----------**")
2568 .addField("%lock-in-their-room", "I have no idea")
2569 .addField("------------", "**-----------**")
2570 .addField("%toss", "Flip a coin")
2571 .addField("------------", "**-----------**")
2572 .addField("%joke", "Displays you a joke")
2573 .addField("------------", "**-----------**")
2574 .addField("%busy", "I'm to busy to explain")
2575 .addField("------------", "**-----------**")
2576 .addField("%randomgif", "displays yiu a random gif")
2577 .addField("------------", "**-----------**")
2578 .addField("%nsfw", "It's NSFW it explain itself")
2579 .addField("------------", "**-----------**")
2580 .addField("%pewds", "Displays PEWDS from the Pewdiepie reddit")
2581 .addField("------------", "**-----------**")
2582 .setColor("GREEN")
2583 .setFooter("Thats it")
2584 .setTimestamp()
2585 message.channel.send(helpsite2_2)
2586 break;
2587
2588 case '3':
2589 var helpsite3 = new Discord.RichEmbed()
2590 .setTitle("Radio Commands")
2591 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2592 .addField("------------", "**-----------**")
2593 .addField("%radio all", "Displays all Radios")
2594 .addField("------------", "**-----------**")
2595 .addField("%radio <number>", "Play a radio")
2596 .addField("------------", "**-----------**")
2597 .addField("%leave", "Stop Playing and Leave the voice")
2598 .addField("------------", "**-----------**")
2599 .setColor("#ecfa1e")
2600 .setFooter("Thats it")
2601 .setTimestamp()
2602 message.channel.send(helpsite3)
2603 break;
2604
2605 case '4':
2606 var helpsite4 = new Discord.RichEmbed()
2607 .setTitle("Music Commands")
2608 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2609 .addField("------------", "**-----------**")
2610 .addField("m%play <link> or <name>", "Plays Music")
2611 .addField("------------", "**-----------**")
2612 .addField("m%skip", "Skip a song")
2613 .addField("------------", "**-----------**")
2614 .addField("m%pause", "Pause a song")
2615 .addField("------------", "**-----------**")
2616 .addField("m%resume", "resumes the music")
2617 .addField("------------", "**-----------**")
2618 .addField("m%queue", "displays the queue")
2619 .addField("------------", "**-----------**")
2620 .addField("m%np", "Displays whats playing")
2621 .addField("------------", "**-----------**")
2622 .addField("m%leave", "Leaves the Voice")
2623 .addField("------------", "**-----------**")
2624 .addField("m%vol", "Set the volume")
2625 .addField("------------", "**-----------**")
2626 .setColor("#1ecbfa")
2627 .setFooter("Thats it")
2628 .setTimestamp()
2629 message.channel.send(helpsite4)
2630 break;
2631
2632 case '5':
2633 var helpsite5 = new Discord.RichEmbed()
2634 .setTitle("Globalchat Help")
2635 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2636 .addField("------------", "**-----------**")
2637 .addField("To use the Globalchat:", "Create a channel named 'globalchat' and thats it!")
2638 .addField("------------", "**-----------**")
2639 .setColor("#fa811e")
2640 .setFooter("Thats it")
2641 .setTimestamp()
2642 message.channel.send(helpsite5)
2643 break;
2644
2645 case '6':
2646 var helpsite6 = new Discord.RichEmbed()
2647 .setTitle("Other Commands")
2648 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2649 .addField("------------", "**-----------**")
2650 .addField("%ping", "Displays the Ping")
2651 .addField("------------", "**-----------**")
2652 .addField("%developers", "Displays the Developers")
2653 .addField("------------", "**-----------**")
2654 .addField("%change-log", "Displays the Change Log [Not updated]")
2655 .addField("------------", "**-----------**")
2656 .addField("%invite", "Invite the Bot")
2657 .addField("------------", "**-----------**")
2658 .addField("%time", "Displays you the Time of the named City")
2659 .addField("------------", "**-----------**")
2660 .addField("%wiki", "Searches Wikipedia")
2661 .addField("------------", "**-----------**")
2662 .addField("%stats", "Displays the Bot Stats")
2663 .addField("------------", "**-----------**")
2664 .addField("%weather", "Displays the Weather")
2665 .addField("------------", "**-----------**")
2666 .addField("%timer", "Makes a Timer")
2667 .addField("------------", "**-----------**")
2668 .addField("%urban", "Searches in Urban")
2669 .addField("------------", "**-----------**")
2670 .addField("%translate <text> <from> <to>", "Translate for you")
2671 .addField("------------", "**-----------**")
2672 .addField("%news", "Displays the Global News")
2673 .addField("------------", "**-----------**")
2674 .setColor("#b8fa1e")
2675 message.channel.send(helpsite6)
2676 var helpsite6_2 = new Discord.RichEmbed()
2677 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2678 .addField("%poll", "Create a poll")
2679 .addField("------------", "**-----------**")
2680 .addField("%botinfo", "Displays the Bot info")
2681 .addField("------------", "**-----------**")
2682 .addField("%roblox", "Displays the Roblox info from a user")
2683 .addField("------------", "**-----------**")
2684 .addField("%roleinfo", "Displays the info of a role")
2685 .addField("------------", "**-----------**")
2686 .addField("%support", "Displays the support server")
2687 .addField("------------", "**-----------**")
2688 .addField("%pmsay", "Says a message to a user via PM")
2689 .addField("------------", "**-----------**")
2690 .addField("%date", "displays you the current time and date [Tiemezone: Berlin]")
2691 .addField("------------", "**-----------**")
2692 .addField("%shorten <link>", "Shorten you a URL")
2693 .addField("------------", "**-----------**")
2694 .addField("%modules", "Displays our Status Page")
2695 .addField("------------", "**-----------**")
2696 .addField("%calc", "Calculate something")
2697 .addField("------------", "**-----------**")
2698 .addField("%messages", "Displays the number of recived messages (Please mention a user because otherwise it is not possible)")
2699 .addField("------------", "**-----------**")
2700 .addField("%retro", "Make your text retro")
2701 .addField("------------", "**-----------**")
2702 .setColor("#b8fa1e")
2703 .setFooter("Thats it")
2704 .setTimestamp()
2705 message.channel.send(helpsite6_2)
2706 break;
2707
2708 case '7':
2709 var adminhelp = new Discord.RichEmbed()
2710 .setTitle("Admin Commands")
2711 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2712 .addField("------------", "**-----------**")
2713 .addField("%restart", "Restart the Bot")
2714 .addField("------------", "**-----------**")
2715 .addField("%connectedservers", "Displays all servers")
2716 .addField("------------", "**-----------**")
2717 .addField("%run", "Run a command")
2718 .addField("------------", "**-----------**")
2719 .addField("%serverlink", "Send you a invite of a server")
2720 .addField("------------", "**-----------**")
2721 .setFooter("Thats it")
2722 .setTimestamp()
2723 .setColor("#1eadfa")
2724 message.channel.send(adminhelp)
2725 break;
2726 default:
2727 var help1 = new Discord.RichEmbed()
2728 .setTitle("All of our Commands (USAGE: `%help 1/2/3/4/5/6/7`)")
2729 .addField("**!WARNING!**","THE HELP EMBED WILL NOT BE MORE UPDATED!!!! PLEASE USE OUR WEBSITE: http://www.open-media.tk/commands")
2730 .addField("------------", "**-----------**")
2731 .addField("Site 1", "Moderation commands?")
2732 .addField("------------", "**-----------**")
2733 .addField("Site 2", "Fun Commands?")
2734 .addField("------------", "**-----------**")
2735 .addField("Site 3", "Radio Commands?")
2736 .addField("------------", "**-----------**")
2737 .addField("Site 4", "Music Commands▶⏸")
2738 .addField("------------", "**-----------**")
2739 .addField("Site 5", "Globalchat Help?")
2740 .addField("------------", "**-----------**")
2741 .addField("Site 6", "Other Commands?")
2742 .addField("------------", "**-----------**")
2743 .addField("Site 7", "Bot Team Commands?")
2744 .addField("------------", "**-----------**")
2745 .addField("Disclaimer", "Reaction control is in progress")
2746 .addField("------------", "**-----------**")
2747 .setFooter("Help Made by Tayron")
2748 .setTimestamp()
2749 .setColor("RANDOM")
2750 message.channel.send(help1)
2751
2752 }
2753 }
2754 if (command === "warn") {
2755 if (!message.member.permissions.has("MANAGE_MESSAGES"))
2756 return message.reply("Sorry, you don't have permissions to use this! You need the permission: MANAGE_MESSAGES");
2757 let reason = args.slice(1).join(' ');
2758 let user = message.mentions.users.first();
2759 let modlog = message.guild.channels.find('name', 'mod-log');
2760 if (!modlog) return message.reply('I cannot find a mod-log channel!')
2761 if (reason.length < 1) return message.reply('you must supply a reason for the warning.');
2762 if (message.mentions.users.size < 1) return message.reply('you must mention a user to warn.').catch(console.error);
2763 client.channels.get(modlog.id).send({
2764 embed: {
2765 color: 16381497,
2766 author: {
2767 name: `⚠️ Warning issued to ${user.username}#${user.discriminator} (${user.id})`,
2768 icon_url: user.avatarURL
2769 },
2770 title: "",
2771 url: "",
2772 description: `\`\`\`js\nReason: ${reason}\nResponsible moderator: ${message.author.tag} (${message.author.id})\`\`\``,
2773 timestamp: new Date(),
2774 footer: {
2775 text: "Warnings are not currently tracked"
2776 }
2777 }
2778 });
2779 message.channel.send(':ok_hand:');
2780 user.send(`⚠️ You were warned in ${message.guild.name} for the reason "${reason}". Please ensure you follow all rules that apply to you in the server/guild as being warned multiple times can lead to you being banned or kicked.`);
2781 };
2782 if (command === "mute") {
2783 if (!message.member.permissions.has("MANAGE_MESSAGES"))
2784 return message.reply("Sorry, you don't have permissions to use this! You need the permission: MANAGE_MESSAGES");
2785 let reason = args.slice(1).join(' ');
2786 let user = message.mentions.users.first();
2787 let modlog = message.guild.channels.find('name', 'mod-log');
2788 let muteRole = message.guild.roles.find(message.guild.id).roles.find('name', 'MUTED');
2789 let modRole = message.guild.roles.find('name', 'Team');
2790 if (!message.member.roles.has(modRole.id)) {
2791 return message.reply('you have insufficient permissions to use this command.').catch(console.error);
2792 }
2793 if (!modlog) return message.reply('I cannot find a mod-log channel!').catch(console.error);
2794 if (!muteRole) return message.reply('I cannot find a mute role!').catch(console.error);
2795 if (reason.length < 1) return message.reply('you must supply a reason and user for the mute command.').catch(console.error);
2796 if (message.mentions.users.size < 1) return message.reply('you must mention a user to mute.').catch(console.error);
2797 const embed = new Discord.RichEmbed()
2798 .setColor(16737894)
2799 .setTimestamp()
2800 .setAuthor(`? ${user.tag} (${user.id}) was muted/unmuted`, `${user.avatarURL}`)
2801 .setDescription(`\`\`\`fix\nReason: ${reason}\nResponsible moderator: ${message.author.tag} (${message.author.id})\`\`\``)
2802 .setFooter('Distinguishing between a mute/unmute isn\'t currently supported');
2803
2804 if (!message.guild.member(client.user).hasPermission('MANAGE_ROLES_OR_PERMISSIONS')) return message.reply('I have __insufficient permissions__ to carry this out.').catch(console.error);
2805
2806 if (message.guild.member(user).roles.has(muteRole.id)) {
2807 message.guild.member(user).removeRole(muteRole).then(() => {
2808 client.channels.get(modlog.id).send({
2809 embed
2810 }).catch(console.error);
2811 });
2812 } else {
2813 message.guild.member(user).addRole(muteRole).then(() => {
2814 client.channels.get(modlog.id).send({
2815 embed
2816 }).catch(console.error);
2817 });
2818 }
2819
2820 user.send(`? You were **muted** in ${message.guild.name} for the reason "${reason}". This means that you will not be able to send messages or speak in any text or voice channels respectively.`)
2821 message.channel.send(`You successfully muted/unmuted \`${user.tag}\` \`(${user.id})\`. A mute summary was sent to the modlog channel. :ok_hand:`)
2822 };
2823 if (command === "report") {
2824 let reason = args.slice(1).join(' ');
2825 let user = message.mentions.users.first();
2826 let modlog = message.guild.channels.get('name', 'mod-log');
2827 if (!modlog) return message.channel.send('I cannot find a mod-log channel!')
2828 if (message.mentions.users.size < 1) return message.channel.send('You must mention a user to report.').catch(console.error);
2829 if (reason.length < 1) return message.channel.send('You must supply a reason for the report.');
2830 if (message.content.startsWith(config.prefix + 'report ')) message.delete()
2831
2832 client.channels.get(modlog.id).send({
2833 embed: {
2834 color: 3447003,
2835 author: {
2836 name: `? Report received from ${message.author.tag} (${message.author.id})`,
2837 icon_url: message.author.avatarURL
2838 },
2839 //title: `Report received from ${message.author.tag} (${message.author.id})`,
2840 url: "",
2841 description: `\`\`\`css\n@${user.username}#${user.discriminator} ${reason}\`\`\``,
2842 // fields: [{
2843 // name: `? Report received from ${message.author.tag} (${message.author.id})`,
2844 // value: `Target: ${user.username}#${user.discriminator} [ID: ${user.id}]\n\`\`\`${reason}\`\`\``
2845 // },
2846 // ],
2847 timestamp: new Date(),
2848 footer: {
2849 icon_url: '',
2850 text: "Report system powered by Tayron"
2851 }
2852 }
2853 });
2854 };
2855
2856 if (command === "news") {
2857 try {
2858 const response = await fetch(
2859 `https://newsapi.org/v2/top-headlines?sources=reuters&pageSize=5&apiKey=${config.newsAPI}`
2860 );
2861 const json = await response.json();
2862 const articleArr = json.articles;
2863 let processArticle = article => {
2864 const embed = new Discord.RichEmbed()
2865 .setColor('#FF4F00')
2866 .setTitle(article.title)
2867 .setURL(article.url)
2868 .setAuthor(article.author)
2869 .setDescription(article.description)
2870 .setThumbnail(article.urlToImage)
2871 .setTimestamp(article.publishedAt)
2872 .setFooter('---------------------------------');
2873 return embed;
2874 };
2875 async function processArray(array) {
2876 for (const article of array) {
2877 const msg = await processArticle(article);
2878 message.channel.send(msg);
2879 }
2880 }
2881 await processArray(articleArr);
2882 } catch (e) {
2883 message.channel.send('Something failed along the way');
2884 return console.error(e);
2885 }
2886 return
2887 }
2888 if (command === "tableflip") {
2889 message.channel.send("(°-°)\\ ┬─┬").then(m => {
2890 setTimeout(() => {
2891 m.edit("(╯°□°)╯ ]").then(ms => {
2892 setTimeout(() => {
2893 ms.edit("(╯°□°)╯ ︵ ┻━┻")
2894 }, 1000)
2895 })
2896 }, 500);
2897
2898 });
2899 return
2900 }
2901 if (command === "snek") {
2902 message.channel.sendFile("https://cdn.discordapp.com/attachments/222197033908436994/324717206548119573/Snek-is-love-snek-is-life.jpg")
2903 }
2904 if (command === "killme") {
2905 message.channel.send(`${message.author.username} has died.`).then(Message => {
2906 setTimeout(() => {
2907 Message.edit("Respawning...");
2908 }, 1000);
2909 setTimeout(() => {
2910 Message.edit(`Revival complete. Welcome back, ${message.author.username}`);
2911 }, 5000);
2912 });
2913 return
2914 };
2915 if (command === "bingo") {
2916 let y = Math.floor(Math.random() * (Math.floor(75) - Math.ceil(1) + 1)) + Math.ceil(1);
2917 let x = null;
2918
2919 if (y < 15) {
2920 x = "B";
2921 } else if (y < 30) {
2922 x = "I";
2923 } else if (y < 45) {
2924 x = "N";
2925 } else if (y < 60) {
2926 x = "G";
2927 } else {
2928 x = "O";
2929 }
2930
2931 message.channel.send(x + y);
2932 return
2933 };
2934 if (command === "roll") {
2935 let sides = args.slice(1).join(' ');
2936 if (sides.length < 1) {
2937 sides = 6;
2938 }
2939 if (sides === 0) {
2940 return message.channel.send("You can't roll from 0!");
2941 }
2942
2943 if (Number.isInteger(Number(sides))) {
2944 var y = Math.floor(Math.random() * (Math.floor(sides) - Math.ceil(1) + 1)) + Math.ceil(1);
2945 return message.channel.send(`? You rolled a ${y}! ?`);
2946 } else {
2947 return message.channel.send("It seems you added some letters into your number. Please try again!");
2948 }
2949
2950 if (command === "createembed") {
2951 let Color = color.toLowerCase();
2952 let title = args.slice(1).join(' ');
2953 let description = args.slice(2).join(' ');
2954
2955 }
2956 //Color Codes for embed
2957
2958 message.delete().catch();
2959 let colors = {
2960 red: "RED",
2961 blue: "BLUE",
2962 }
2963 let embed = new Discord.RichEmbed()
2964
2965 if (args.slice(1).join(" ") == "red") {
2966 embed.setColor(colors.red)
2967 }
2968 let title = args.slice(2).join(' ');
2969 let description = args.slice(3).join(' ');
2970 embed.setTimestamp()
2971 embed.addField(`${title}`, `${description}`);
2972 return message.channel.send(embed)
2973 }
2974
2975 if (command === "translate") {
2976 var codes = {
2977 "az": "Azerbaijan",
2978 "sq": "Albanian",
2979 "am": "Amharic",
2980 "en": "English",
2981 "ar": "Arabic",
2982 "hy": "Armenian",
2983 "af": "Afrikaans",
2984 "eu": "Basque",
2985 "ba": "Bashkir",
2986 "be": "Belarusian",
2987 "bn": "Bengali",
2988 "my": "Burmese",
2989 "bg": "Bulgarian",
2990 "bs": "Bosnian",
2991 "cy": "Welsh",
2992 "hu": "Hungarian",
2993 "vi": "Vietnamese",
2994 "ht": "Haitian (Creole)",
2995 "gl": "Galician",
2996 "nl": "Dutch",
2997 "mrj": "Hill Mari",
2998 "el": "Greek",
2999 "ka": "Georgian",
3000 "gu": "Gujarati",
3001 "da": "Danish",
3002 "he": "Hebrew",
3003 "yi": "Yiddish",
3004 "id": "Indonesian",
3005 "ga": "Irish",
3006 "it": "Italian",
3007 "is": "Icelandic",
3008 "es": "Spanish",
3009 "kk": "Kazakh",
3010 "kn": "Kannada",
3011 "ca": "Catalan",
3012 "ky": "Kyrgyz",
3013 "zh": "Chinese",
3014 "ko": "Korean",
3015 "xh": "Xhosa",
3016 "km": "Khmer",
3017 "lo": "Laotian",
3018 "la": "Latin",
3019 "lv": "Latvian",
3020 "lt": "Lithuanian",
3021 "lb": "Luxembourgish",
3022 "mg": "Malagasy",
3023 "ms": "Malay",
3024 "ml": "Malayalam",
3025 "mt": "Maltese",
3026 "mk": "Macedonian",
3027 "mi": "Maori",
3028 "mr": "Marathi",
3029 "mhr": "Mari",
3030 "mn": "Mongolian",
3031 "de": "German",
3032 "ne": "Nepali",
3033 "no": "Norwegian",
3034 "pa": "Punjabi",
3035 "pap": "Papiamento",
3036 "fa": "Persian",
3037 "pl": "Polish",
3038 "pt": "Portuguese",
3039 "ro": "Romanian",
3040 "ru": "Russian",
3041 "ceb": "Cebuano",
3042 "sr": "Serbian",
3043 "si": "Sinhala",
3044 "sk": "Slovakian",
3045 "sl": "Slovenian",
3046 "sw": "Swahili",
3047 "su": "Sundanese",
3048 "tg": "Tajik",
3049 "th": "Thai",
3050 "tl": "Tagalog",
3051 "ta": "Tamil",
3052 "tt": "Tatar",
3053 "te": "Telugu",
3054 "tr": "Turkish",
3055 "udm": "Udmurt",
3056 "uz": "Uzbek",
3057 "uk": "Ukranian",
3058 "ur": "Urdu",
3059 "fi": "Finnish",
3060 "fr": "French",
3061 "hi": "Hindi",
3062 "hr": "Croatian",
3063 "cs": "Czech",
3064 "sv": "Swedish",
3065 "gd": "Scottish",
3066 "et": "Estonian",
3067 "eo": "Esperanto",
3068 "jv": "Javanese",
3069 "ja": "Japanese"
3070 }
3071 const text = args.slice(2).join(" ")
3072 const to = args[1]
3073 const from = args[0]
3074 const {
3075 body
3076 } = await snekfetch
3077 .get('https://translate.yandex.net/api/v1.5/tr.json/translate')
3078 .query({
3079 key: "trnsl.1.1.20190803T091022Z.1665ea1f362b3e5c.4edbf427a7bdba04a1f58237b0c53753d4220a0a",
3080 text,
3081 lang: from ? `${from}-${to}` : to
3082 });
3083 const lang = body.lang.split('-');
3084 const embed = new Discord.RichEmbed()
3085 .setColor(0x00AE86)
3086 .addField(`From: ${codes[lang[0]]}`,
3087 text)
3088 .addField(`To: ${codes[lang[1]]}`,
3089 body.text[0]);
3090 message.channel.send({
3091 embed
3092 }).catch(console.error);
3093 }
3094 if (command === "urban") {
3095 const word = args.join(" ")
3096 try {
3097 const {
3098 body
3099 } = await snekfetch
3100 .get('http://api.urbandictionary.com/v0/define')
3101 .query({
3102 term: word
3103 });
3104 if (!body.list.length) return message.channel.send('Could not find any results.');
3105 const data = body.list[types === 'top' ? 0 : Math.floor(Math.random() * body.list.length)];
3106 const embed = new Discord.RichEmbed()
3107 .setColor(0x32A8F0)
3108 .setAuthor('Urban Dictionary', 'https://i.imgur.com/Fo0nRTe.png', 'https://www.urbandictionary.com/')
3109 .setURL(data.permalink)
3110 .setTitle(data.word)
3111 .setDescription((data.definition))
3112 .addField('Example', data.example);
3113 const filtercheck = ["xxx", "porn", "sex", "18+", "nsfw", "hentai", "dick", "vagina", "pussy"]
3114 if (filtercheck.some(word2 => data.definition.toLowerCase().includes(word2))) return message.channel.send("Not allowed to search nsfw content.");
3115 if (filtercheck.some(word3 => data.word.toLowerCase().includes(word3))) return message.channel.send("Not allowed to search nsfw content.");
3116 message.channel.send(embed);
3117 } catch (err) {
3118 return message.channel.send(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
3119 }
3120 }
3121 if (command === "textflip") {
3122 var dictionary = {
3123 "a": "ɐ",
3124 "b": "q",
3125 "c": "ɔ",
3126 "d": "p",
3127 "e": "ǝ",
3128 "f": "ɟ",
3129 "g": "ƃ",
3130 "h": "ɥ",
3131 "i": "ᴉ",
3132 "j": "ɾ",
3133 "k": "ʞ",
3134 "m": "ɯ",
3135 "n": "u",
3136 "p": "d",
3137 "q": "b",
3138 "r": "ɹ",
3139 "t": "ʇ",
3140 "u": "n",
3141 "v": "ʌ",
3142 "w": "ʍ",
3143 "y": "ʎ",
3144 "A": "∀",
3145 "C": "Ɔ",
3146 "E": "Ǝ",
3147 "F": "Ⅎ",
3148 "G": "פ",
3149 "J": "ſ",
3150 "L": "˥",
3151 "M": "W",
3152 "P": "Ԁ",
3153 "T": "┴",
3154 "U": "∩",
3155 "V": "Λ",
3156 "W": "M",
3157 "Y": "⅄",
3158 "1": "Ɩ",
3159 "2": "ᄅ",
3160 "3": "Ɛ",
3161 "4": "ㄣ",
3162 "5": "ϛ",
3163 "6": "9",
3164 "7": "ㄥ",
3165 "9": "6",
3166 ",": "'",
3167 ".": "˙",
3168 "'": ",",
3169 "\"": ",,",
3170 "_": "‾",
3171 "&": "⅋",
3172 "!": "¡",
3173 "?": "¿",
3174 "`": ","
3175 }
3176 const text = args.join(' ');
3177 const converted = letterTrans(text, dictionary);
3178 message.channel.send(converted);
3179 }
3180 if (command === "sexyrate") {
3181 const sexyrate = Math.floor(Math.random() * 100)
3182 const embed = new Discord.RichEmbed()
3183 .addField(":heart_decoration: Sexy Rate :heart_decoration: ", "I rate you a " + sexyrate + " out of 100 on the sexy scale")
3184 .setThumbnail(message.author.displayAvatarURL)
3185 .setColor("#d6706b")
3186 message.channel.send({
3187 embed
3188 })
3189 }
3190 if (command === "poke") {
3191 if (message.mentions.users.size < 1) return message.channel.send("you can't poke nobody")
3192 let user = message.guild.member(message.mentions.users.first());
3193 message.channel.send(`${user} You got a poke from ${message.author.username} ❤`, {
3194 embed: {
3195 image: {
3196 url: "https://i.imgur.com/XMuJ7K8.gif"
3197 }
3198 }
3199 })
3200 }
3201 if (command === "timer") {
3202
3203 let Timer = args[0];
3204
3205 if (!args[0]) {
3206 return message.channel.send(":x: " + "| Please Enter a time period followed by \"s or m or h\"");
3207 }
3208
3209 if (args[0] <= 0) {
3210 return message.channel.send(":x: " + "| Please Enter a time period followed by \"s or m or h\"");
3211 }
3212
3213 message.channel.send(":white_check_mark: " + "| Timer Started for: " + `${ms(ms(Timer), {long: true})}`)
3214
3215 setTimeout(function () {
3216 message.channel.send(message.author.toString() + ` The Timer Has FINISHED!, it lasted: ${ms(ms(Timer), {long: true})}`)
3217
3218 }, ms(Timer));
3219 }
3220 if (command === "dadjokes") {
3221
3222 var DAD = new Discord.RichEmbed()
3223 .setDescription(jokes[Math.floor(Math.random() * jokes.length)])
3224
3225 .setColor("0x#FF0000")
3226
3227 message.channel.send(DAD);
3228
3229 }
3230 if (command === "love") {
3231 if (!args[0]) {
3232 return message.channel.send(":x: " + "| Please Enter A person/object")
3233 }
3234
3235 if (args[0]) {
3236 message.channel.send(Responses[Math.floor(Math.random() * Responses.length)]);
3237 }
3238
3239 }
3240 if (command === "retro") {
3241 if (args.length !== 0) {
3242 const [line1, line2, line3] = args.join(" ").split(",").map(elem => elem.trim());
3243 if (/^[\w\ ]+$/i.test(line1) === false || /^[\w\ ]+$/i.test(line2) === false || /^[\w\ ]+$/i.test(line3) === false) return message.reply("only alphanumeric characters, spaces, and underscores are allowed!"); // eslint-disable-line no-useless-escape
3244 message.channel.startTyping();
3245 if (line3 !== undefined) {
3246 const text = new RetroText().setLine(1, line1).setLine(2, line2).setLine(3, line3).setBackgroundStyle("outlineTri").setTextStyle("chrome");
3247 const textImage = await text.fetchURL();
3248 message.channel.stopTyping();
3249 message.channel.send({
3250 files: [{
3251 attachment: textImage,
3252 name: "retro.png"
3253 }]
3254 });
3255 } else if (line2 !== undefined) {
3256 const text = new RetroText().setLine(1, line1).setLine(2, line2).setBackgroundStyle("outlineTri").setTextStyle("chrome");
3257 const textImage = await text.fetchURL();
3258 message.channel.stopTyping();
3259 message.channel.send({
3260 files: [{
3261 attachment: textImage,
3262 name: "retro.png"
3263 }]
3264 });
3265 } else {
3266 const text = new RetroText().setLine(2, line1).setBackgroundStyle("outlineTri").setTextStyle("chrome");
3267 const textImage = await text.fetchURL();
3268 message.channel.stopTyping();
3269 message.channel.send({
3270 files: [{
3271 attachment: textImage,
3272 name: "retro.png"
3273 }]
3274 });
3275 }
3276 } else {
3277 message.reply("you need to provide some text to generate some retro text!");
3278 }
3279 };
3280
3281
3282
3283
3284 let colors = {
3285 red: "#e74c3c",
3286 green: "#2ecc71",
3287 blue: "#3498db",
3288 yellow: "#f1c40f",
3289 purple: "#9b59b6"
3290 }
3291
3292
3293 if (command == `createembed`) {
3294 let color = args.slice(1).join(" ")
3295 let embed = new Discord.RichEmbed()
3296
3297 if (color == "red") {
3298 embed.setColor(colors.red)
3299 } else if (color == "green") {
3300 embed.setColor(colors.green)
3301
3302 } else if (color == "blue") {
3303 embed.setColor(colors.blue)
3304
3305 } else if (color == "yellow") {
3306 embed.setColor(colors.yellow)
3307
3308 } else if (color == "purple") {
3309 embed.setColor(colors.purple)
3310 }
3311
3312 embed.setTitle(args.slice(2).join(" "))
3313 embed.setDescription(args.slice(3).join(" "))
3314 message.channel.send(embed)
3315 }
3316
3317 if(command === "info") {
3318 let user = message.author;
3319 let member = message.guild.member(user);
3320 const tick = client.emojis.find(emoji => emoji.name === "dcbt");
3321 const cross = client.emojis.find(emoji => emoji.name === "dcbx");
3322 if (user.presence.status === 'online') {
3323 st = 'Online'
3324 }
3325 if (user.presence.status === 'dnd') {
3326 var st = 'DND'
3327 }
3328 if (user.presence.status === 'idle') {
3329 var st = 'Abwesend'
3330 }
3331 if (user.presence.status === 'offline') {
3332 var st = 'Offline'
3333 }
3334 if (user.bot == true) {
3335 var bo = tick
3336 }
3337 if (user.bot == false) {
3338 var bo = cross
3339 }
3340
3341 rl = member.roles.map(roles => `${roles.name}`).join(` \`\`||\`\` `)
3342 if (rl.length > 500) {
3343 var rl = "To much roles to list it here."
3344 }
3345
3346 let userInfo = db[message.author.id];
3347 let embed = new Discord.RichEmbed()
3348 .setColor(0x4286f4)
3349 .setThumbnail(`${user.displayAvatarURL}`, true)
3350 .addField('**Status**', st, true)
3351 .addField("**Game**", `${user.presence.game ? user.presence.game.name : '-'}`, true)
3352 .addField('**Name**', user.username + '#' + user.discriminator, true)
3353 .addField('**ID**', user.id, true)
3354 .addField("Levels", userInfo.level ,true)
3355 .addField("Exp", userInfo.xp+"/100", true);
3356 if(!member) return message.channel.sendEmbed(embed)
3357 let memberInfo = db[member.id]
3358 let embed2 = new Discord.RichEmbed()
3359 .setColor(0x4286f4)
3360 .setThumbnail(`${user.displayAvatarURL}`, true)
3361 .addField('**Status**', st, true)
3362 .addField("**Game**", `${user.presence.game ? user.presence.game.name : '-'}`, true)
3363 .addField('**Name**', user.username + '#' + user.discriminator, true)
3364 .addField('**ID**', user.id, true)
3365 .addField("Levels", userInfo.level ,true)
3366 .addField("Exp", userInfo.xp+"/100", true);
3367 message.channel.sendEmbed(embed2)
3368 }
3369 fs.writeFile("./database.json", JSON.stringify(db), (x) => {
3370 if (x) console.error(x)
3371 });
3372 //END OF COMMANDS
3373 //ALL COMMANDS LOADED
3374 console.log("all commands loaded the bot can be used")
3375});
3376
3377//FUNCTIONS
3378
3379client.login(config.token);
3380//hier wird nix kopiert!