mirror of
				https://gitlab.com/ceda_ei/Quadnite-Bot
				synced 2025-11-04 03:00:04 +01:00 
			
		
		
		
	Ignore 's words in /expand. Return letter if nothing starting with it is found.
This commit is contained in:
		@@ -4,6 +4,8 @@ function expand(words, text) {
 | 
			
		||||
	return letters.map((letter) => {
 | 
			
		||||
 | 
			
		||||
		const wordsWithLetter = words.filter(i => i.match(RegExp(`^${letter}`, "i")));
 | 
			
		||||
		if (! wordsWithLetter.length)
 | 
			
		||||
			return letter;
 | 
			
		||||
		const word = wordsWithLetter[Math.floor(Math.random() * wordsWithLetter.length)];
 | 
			
		||||
		return word;
 | 
			
		||||
 | 
			
		||||
@@ -14,6 +16,7 @@ function expand(words, text) {
 | 
			
		||||
 | 
			
		||||
module.exports = (words = []) => (ctx) => {
 | 
			
		||||
 | 
			
		||||
	words = words.filter(i => ! i.match(/'s$/));
 | 
			
		||||
	const message = ctx.message.text.replace(/^[^ ]+/, "");
 | 
			
		||||
	if (message) {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user