Add commands/index.js. Add /insults, /kys, answer commands.
Add shrinkwrap.yaml.
This commit is contained in:
		
							
								
								
									
										1
									
								
								bot.js
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								bot.js
									
									
									
									
									
								
							| @@ -19,3 +19,4 @@ Promise.all(data) | ||||
| 	.then(data => | ||||
| 		commands(bot, data)); | ||||
|  | ||||
| bot.launch(); | ||||
|   | ||||
							
								
								
									
										27
									
								
								commands/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								commands/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| const random = require("./random"); | ||||
| const insults_fun = require("./insult"); | ||||
| const is = require("./is"); | ||||
| module.exports = (bot, [ questions, kys, insults, commands_list ]) => { | ||||
|  | ||||
| 	bot.command("question", (ctx) => ctx.reply(random(questions)())); | ||||
|  | ||||
| 	const default_text = (command, text) => `Do you want to ${text} yourself?\n` | ||||
| 		+ `If no, reply to someone with /${command} to kill them or run /${command} username/name.\n` | ||||
| 		+ `You can suggest more /${command} replies using /feedback`; | ||||
| 	bot.command("insult", (ctx) => ctx.reply(insults_fun(random, insults, default_text("insult", "insult"))(ctx))); | ||||
| 	bot.command("kys", (ctx) => ctx.reply(insults_fun(random, kys, default_text("kys", "kill"))(ctx))); | ||||
|  | ||||
| 	bot.command("commands", (ctx) => ctx.reply(commands_list.join("\n"))); | ||||
| 	bot.command("is", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("are", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("can", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("will", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("shall", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("was", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("do", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("does", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("did", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("should", (ctx) => ctx.reply(is(random))); | ||||
| 	bot.command("coin", (ctx) => ctx.reply(random(["Heads", "Tails"])())); | ||||
|  | ||||
| }; | ||||
							
								
								
									
										22
									
								
								commands/insult.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								commands/insult.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| module.exports = (random, kys, default_text) => (ctx) => { | ||||
|  | ||||
| 	if (ctx.message.reply_to_message) { | ||||
|  | ||||
| 		const { from } = ctx.message.reply_to_message; | ||||
| 		const name = from.username ? "@" + from.username : from.firstName; | ||||
| 		return random(kys)().replace(/##name##/g, name); | ||||
|  | ||||
| 	} else { | ||||
|  | ||||
| 		const text_array = ctx.message.text.split(" "); | ||||
| 		if (text_array.length > 1) { | ||||
|  | ||||
| 			const name = text_array[1]; | ||||
| 			return random(kys)().replace(/##name##/g, name); | ||||
|  | ||||
| 		} else | ||||
| 			return default_text; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| }; | ||||
							
								
								
									
										7
									
								
								commands/is.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								commands/is.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| module.exports = (random) => | ||||
| 	random([["Yes", "Yep", "Yeah", "Yus", "Ja", "Ya", "Aye", "Ay", "Oui"], | ||||
| 		["No", "Nopes", "Nu", "Nah", "Nein", "Naw", "Nay", "Yesn't"]][Math.round( | ||||
| 		Math.random())])(); | ||||
|  | ||||
|  | ||||
|  | ||||
| @@ -1,2 +1,5 @@ | ||||
| module.exports = (list = []) => (n = 1) => | ||||
| 	Array(n).fill(0).map(list[Math.floor(Math.random() * list.length)]); | ||||
| 	Array(n) | ||||
| 		.fill(0) | ||||
| 		.map(() => list[Math.floor(Math.random() * list.length)]) | ||||
| 		.join("\n"); | ||||
|   | ||||
							
								
								
									
										50
									
								
								shrinkwrap.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								shrinkwrap.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| dependencies: | ||||
|   telegraf: 3.27.1 | ||||
| packages: | ||||
|   /@types/node/10.12.24: | ||||
|     dev: false | ||||
|     resolution: | ||||
|       integrity: sha512-GWWbvt+z9G5otRBW8rssOFgRY87J9N/qbhqfjMZ+gUuL6zoL+Hm6gP/8qQBG4jjimqdaNLCehcVapZ/Fs2WjCQ== | ||||
|   /debug/4.1.1: | ||||
|     dependencies: | ||||
|       ms: 2.1.1 | ||||
|     dev: false | ||||
|     resolution: | ||||
|       integrity: sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== | ||||
|   /ms/2.1.1: | ||||
|     dev: false | ||||
|     resolution: | ||||
|       integrity: sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== | ||||
|   /node-fetch/2.3.0: | ||||
|     dev: false | ||||
|     engines: | ||||
|       node: 4.x || >=6.0.0 | ||||
|     resolution: | ||||
|       integrity: sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA== | ||||
|   /sandwich-stream/2.0.2: | ||||
|     dev: false | ||||
|     engines: | ||||
|       node: '>= 0.10' | ||||
|     resolution: | ||||
|       integrity: sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ== | ||||
|   /telegraf/3.27.1: | ||||
|     dependencies: | ||||
|       '@types/node': 10.12.24 | ||||
|       debug: 4.1.1 | ||||
|       node-fetch: 2.3.0 | ||||
|       sandwich-stream: 2.0.2 | ||||
|       telegram-typings: 3.6.1 | ||||
|     dev: false | ||||
|     engines: | ||||
|       node: '>=6.2.0' | ||||
|     resolution: | ||||
|       integrity: sha512-RQUnuNAEEWcLhRap81qwGUUqAy1KcvqANnA0G3pzZqFkhMe6LrTk5lVi9tdOaF0Ud/yOx5fdx0rNPYfiB27Z+w== | ||||
|   /telegram-typings/3.6.1: | ||||
|     dev: false | ||||
|     resolution: | ||||
|       integrity: sha512-njVv1EAhIZnmQVLocZEADYUyqA1WIXuVcDYlsp+mXua/XB0pxx+PKtMSPeZ/EE4wPWTw9h/hA9ASTT6yQelkiw== | ||||
| registry: 'https://registry.npmjs.org/' | ||||
| shrinkwrapMinorVersion: 9 | ||||
| shrinkwrapVersion: 3 | ||||
| specifiers: | ||||
|   telegraf: ^3.27.1 | ||||
		Reference in New Issue
	
	Block a user