-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
108 lines (89 loc) · 2.87 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package main
import (
"fmt"
"github.com/bwmarrin/discordgo"
"os/signal"
"syscall"
"os"
"strings"
"github.com/fatih/color"
"github.com/lxi1400/gotitle"
"strconv"
)
func banner() {
fmt.Print("\033[H\033[2J")
color.Red(`
██████╗ ██╗ ██╗██████╗ ██████╗ ███████╗██████╗
██╔══██╗██║ ██║██╔══██╗██╔════╝ ██╔════╝██╔══██╗
██████╔╝██║ ██║██████╔╝██║ ███╗█████╗ ██████╔╝
██╔═══╝ ██║ ██║██╔══██╗██║ ██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝██║ ██║╚██████╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
[Made by lxi#1400]
`)
}
func main() {
title.SetTitle("Purger | Login")
banner()
fmt.Print("[!] Insert your token: ")
fmt.Scan(&token)
banner()
selfbot, err := discordgo.New(token)
if err != nil {
fmt.Println("[ERROR]", err)
return
}
selfbot.AddHandler(messageCreate)
selfbot.AddHandler(func(dg *discordgo.Session, event *discordgo.Ready) {
username, _ := dg.User("@me")
title.SetTitle(fmt.Sprintf("Purger | Logged in as %s", username))
color.Green(fmt.Sprintf("[!] Purger has been connected to %s!\n[?] Type .purge [amount] to purge.", username))
})
err = selfbot.Open()
if err != nil {
fmt.Println("[ERROR]", err)
return
}
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
<-sc
selfbot.Close()
}
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
if m.Author.ID != s.State.User.ID {
return
}
if strings.HasPrefix(m.Content, ".purge") {
amount, err := strconv.Atoi(strings.Trim(m.Content, ".purge "))
if err != nil {
fmt.Printf("[!] Failed to convert to int: %s\n", err)
}
deled := 0
for deled < amount {
messages, err := s.ChannelMessages(m.ChannelID, 100, "", "", "")
if err != nil {
fmt.Printf("[!] Failed to fetch messages: %s\n", err)
}
for _, message := range messages {
if deled >= amount {
break
}
if message.Author.ID != s.State.User.ID {
continue;
}
err = s.ChannelMessageDelete(m.ChannelID, message.ID)
color.Yellow(fmt.Sprintf("[!] Deleted message: %v\n[?] Content: %s\n", message.ID, message.Content))
if err != nil {
fmt.Printf("[!] Failed to delete message: %v", err)
continue
}
deled += 1
dID = message.ID
}
}
color.Green(fmt.Sprintf("[!] Deleted %v messages!\n", deled))
}
}
var (
token string
)