mirror of
				https://gitlab.com/ceda_ei/Quadnite-Bot
				synced 2025-10-31 17:20:05 +01:00 
			
		
		
		
	Add /absurdify
This commit is contained in:
		
							
								
								
									
										27
									
								
								commands/absurdify.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								commands/absurdify.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| function absurdify(text) { | ||||
|  | ||||
| 	const text_array = text.split(""); | ||||
| 	return text_array.map((character) => | ||||
| 		Math.random() > 0.5 ? character.toLowerCase(): character.toUpperCase()) | ||||
| 		.join(""); | ||||
|  | ||||
| } | ||||
|  | ||||
| module.exports = () => (ctx) => { | ||||
|  | ||||
| 	const message = ctx.message.text.replace(/^[^ ]+/, ""); | ||||
| 	if (message) { | ||||
|  | ||||
| 		return absurdify(message); | ||||
|  | ||||
| 	} else { | ||||
|  | ||||
| 		if (ctx.message.reply_to_message) | ||||
| 			return absurdify(ctx.message.reply_to_message.text); | ||||
| 		else | ||||
| 			return "Need text to absurdify. Send /absurdify text or reply to a" | ||||
| 			+ "message with /absurdify"; | ||||
|  | ||||
| 	} | ||||
|  | ||||
| }; | ||||
| @@ -3,6 +3,7 @@ const insults_fun = require("./insult"); | ||||
| const words_fun = require("./words"); | ||||
| const is = require("./is"); | ||||
| const weebify = require("./weebify"); | ||||
| const absurdify = require("./absurdify"); | ||||
| module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => { | ||||
|  | ||||
| 	bot.command("question", (ctx) => ctx.reply(random(questions)())); | ||||
| @@ -45,5 +46,6 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => { | ||||
| 		+ "Directory!](https://t.me/tgdrbot?start=quadnite_bot)", {parse_mode: | ||||
| 			"Markdown"})); | ||||
| 	bot.command("weebify", (ctx) => ctx.reply(weebify()(ctx))); | ||||
| 	bot.command("absurdify", (ctx) => ctx.reply(absurdify()(ctx))); | ||||
|  | ||||
| }; | ||||
|   | ||||
| @@ -47,7 +47,8 @@ module.exports = () => (ctx) => { | ||||
| 		if (ctx.message.reply_to_message) | ||||
| 			return weebify(ctx.message.reply_to_message.text); | ||||
| 		else | ||||
| 			return "Need text to weebify. Send /weebify text or reply to a message with /weebify"; | ||||
| 			return "Need text to weebify. Send /weebify text or reply to a " | ||||
| 			+ "message with /weebify"; | ||||
|  | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user