Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Remove MRISA #32

Merged
merged 7 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.env
.git
icon/*
.github/*
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ test.sh
run.sh
thread.lock
*.patch
.secrets
.secrets
.env
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ If any support is needed, please post an Issue on the Issues page on Github or j

- [Discordgo](https://github.com/bwmarrin/discordgo).
- [Graw](https://github.com/turnage/graw).
- [go-redis](https://github.com/go-redis/redis).
- [MRISA](https://github.com/vivithemage/mrisa)
- [MySQL Database](https://www.mysql.com/)
- [MongoDB](https://mongodb.com/).
- [Go MongoDB Driver](https://docs.mongodb.com/drivers/go/).

### **Disclaimer**

Expand Down
161 changes: 0 additions & 161 deletions images.go

This file was deleted.

2 changes: 0 additions & 2 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ func getRedditEnv() agentFile {
agent.UserAgent = "DiscordQuickMemeBot"
agent.ClientID = os.Getenv("REDDIT_ID")
agent.ClientSecret = os.Getenv("REDDIT_SECRET")
agent.Username = os.Getenv("REDDIT_USERNAME")
agent.Password = os.Getenv("REDDIT_PASSWORD")

if agent.ClientID == "" || agent.ClientSecret == "" {
fmt.Println("Cannot continue, Reddit client ID or Secret not set.")
Expand Down
2 changes: 0 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ func commandHandler(discord *discordgo.Session, message *discordgo.MessageCreate
discord.ChannelMessageSend(channel, "Error getting source of meme: "+err.Error())
return
}
case command == "!revsearch":
imageSearchCommand(discord, channel)
case command == "!quickmeme":
var subcommand string
if len(commandContent) > 1 {
Expand Down
6 changes: 2 additions & 4 deletions redditHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ func initBot() (reddit.Bot, error) {
var agent agentFile = getRedditEnv()

app := reddit.App{
ID: agent.ClientID,
Secret: agent.ClientSecret,
Username: agent.Username,
Password: agent.Password,
ID: agent.ClientID,
Secret: agent.ClientSecret,
}

bot, err := reddit.NewBot(
Expand Down
8 changes: 8 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
MONGO_CONNECT_STR=
MONGO_DATABASE=
REDDIT_ID=
REDDIT_SECRET=
TOPGG=
MODE=
ADMINS=
DISCORD_TOKEN=
35 changes: 0 additions & 35 deletions str.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package main
import (
"fmt"
"regexp"
"strconv"
"strings"
)

Expand Down Expand Up @@ -51,40 +50,6 @@ func textFilterSlice(input []string) []string {
return returnSlice
}

// this if for "how long ago"
// ex: "5 hours ago"
// ex: "4 days ago"
func timeStrToSeconds(stamp string) int64 {
var stampLength string
var finalTime int64
lengths := []string{"second", "minute", "hour", "day", "year"}
for _, l := range lengths {
if strings.Contains(stamp, l) {
stampLength = l
break
}
}
spaceIndex := strings.Index(stamp, " ")
timeUnknown, _ := strconv.ParseInt(stamp[:spaceIndex], 10, 64)
switch stampLength {
case "second":
finalTime = timeUnknown

case "minute":
finalTime = timeUnknown * 60

case "hour":
finalTime = timeUnknown * 3600

case "day":
finalTime = timeUnknown * 3600 * 24

case "year":
finalTime = timeUnknown * 3600 * 8760
}
return finalTime
}

func matchRegexList(expressions []string, testStr string) bool {
for _, item := range expressions {
compiled, err := regexp.Compile(item)
Expand Down