added manypepes
This commit is contained in:
		
							parent
							
								
									7cf02b2fd4
								
							
						
					
					
						commit
						67e403586b
					
				discord
| @ -38,6 +38,8 @@ func (app *application) messageCreate(s *discordgo.Session, m *discordgo.Message | ||||
| 			case "github", "source": | ||||
| 				app.sendGithub(s, m) | ||||
| 			/* --- Bot commands for words --- */ | ||||
| 			case "pepes": | ||||
| 				app.sendManyPepes(s, m, splitCommand) | ||||
| 			/* --- Bot commands, but only admins --- */ | ||||
| 			case "addword": | ||||
| 				app.addWord(s, m, splitCommand) | ||||
|  | ||||
| @ -7,6 +7,7 @@ import ( | ||||
| 	"math/rand" | ||||
| 	"net/http" | ||||
| 	"regexp" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
| @ -110,6 +111,36 @@ func (app *application) sendGithub(s *discordgo.Session, m *discordgo.MessageCre | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func (app *application) sendManyPepes(s *discordgo.Session, m *discordgo.MessageCreate, splitCommand []string) { | ||||
| 	/* Check if admin */ | ||||
| 	r, err := app.checkIfAdmin(s, m) | ||||
| 	if err != nil { | ||||
| 		app.errorLog.Print(err) | ||||
| 		return | ||||
| 	} | ||||
| 	if !r { | ||||
| 		return | ||||
| 	} | ||||
| 	 | ||||
| 	if len(splitCommand) <= 2 { | ||||
| 		app.errorLog.Printf("many pepes command had no numeral argument") | ||||
| 		s.ChannelMessageSend(m.ChannelID, "This command requires a numeral as a second argument, which is between 1 and 10") | ||||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	val, err := strconv.Atoi(splitCommand[2]) | ||||
| 	if err != nil || val > 10 || val <= 0 { | ||||
| 		app.errorLog.Printf("many pepes command had a non-numeral as argument") | ||||
| 		s.ChannelMessageSend(m.ChannelID, "This command requires a numeral as a second argument, which is between 1 and 10") | ||||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	for i := 0; i < val; i++ { | ||||
| 		app.sendPepe(s, m) | ||||
| 		time.Sleep(time.Millisecond * 500) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func (app *application) findTrigger(s *discordgo.Session, m *discordgo.MessageCreate) { | ||||
| 	/* Finding for every word in the allBadWords map of string slices | ||||
| 	Check if the message contains that word | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user