mirror of
				https://gitlab.com/ceda_ei/Quadnite-Bot
				synced 2025-10-31 01:00:05 +01:00 
			
		
		
		
	Add /word, /words
This commit is contained in:
		
							
								
								
									
										3
									
								
								bot.js
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								bot.js
									
									
									
									
									
								
							| @@ -9,7 +9,8 @@ const data = [ | ||||
| 	"questions", | ||||
| 	"kys", | ||||
| 	"insults", | ||||
| 	"commands_list" | ||||
| 	"commands_list", | ||||
| 	"words" | ||||
| ].map(file => | ||||
| 	fs.readFile(file + ".txt", "utf-8") | ||||
| 		.then(list => | ||||
|   | ||||
| @@ -1,13 +1,15 @@ | ||||
| const random = require("./random"); | ||||
| const insults_fun = require("./insult"); | ||||
| const words_fun = require("./words"); | ||||
| const is = require("./is"); | ||||
| module.exports = (bot, [ questions, kys, insults, commands_list ]) => { | ||||
| module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => { | ||||
|  | ||||
| 	bot.command("question", (ctx) => ctx.reply(random(questions)())); | ||||
| 	bot.command("word", (ctx) => ctx.reply(random(words)())); | ||||
| 	bot.command("words", (ctx) => ctx.reply(words_fun(random, words)(ctx))); | ||||
| 	bot.telegram.getMe() | ||||
| 		.then(bot_user => { | ||||
|  | ||||
| 			console.log(bot_user); | ||||
| 			const default_text = (command, text) => `Do you want to ${text} ` | ||||
| 				+ `yourself?\nIf no, reply to someone with /${command} to kill` | ||||
| 				+ ` them or run /${command} username/name.\nYou can suggest ` | ||||
|   | ||||
							
								
								
									
										21
									
								
								commands/words.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								commands/words.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| module.exports = (random, words) => (ctx) => { | ||||
|  | ||||
| 	const text_array = ctx.message.text.split(" "); | ||||
| 	if (text_array.length == 1) { | ||||
|  | ||||
| 		return random(words)(10); | ||||
|  | ||||
| 	} else { | ||||
|  | ||||
| 		const input = parseInt(text_array[1]); | ||||
| 		if (input && input > 0) | ||||
| 			if (input < 50) | ||||
| 				return random(words)(input); | ||||
| 			else | ||||
| 				return "Too many words."; | ||||
| 		else | ||||
| 			return "Not a valid number."; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user