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

Commit

Permalink
Merge pull request #4 from dvemon/main
Browse files Browse the repository at this point in the history
nickname changer + ability to add emojis using colons (e.g. : joy :)
  • Loading branch information
Soliux authored Oct 17, 2021
2 parents 2a90247 + 27b1bc2 commit 0536cf0
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
)

require (
github.com/kyokomi/emoji/v2 v2.2.8 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44 // indirect
)
3 changes: 3 additions & 0 deletions interact/reactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"net/http"
"strings"
"time"

"github.com/kyokomi/emoji/v2"
)

var cmt int
Expand All @@ -16,6 +18,7 @@ func AddReaction(ChannelID string, MessageID string, Token string, Emoji string)
if cmt >= 2 {
return errors.New("error working")
} else {
Emoji = strings.TrimSuffix(emoji.Sprint(Emoji), " ")
request, err := http.NewRequest("PUT", fmt.Sprintf("https://discord.com/api/v9/channels/%s/messages/%s/reactions/%s/%s", ChannelID, MessageID, Emoji, "%40me"), nil)
if err != nil {
return err
Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ func spawner(Tool string) {
}(tkn, Word, MessageID, ChannelID)
}
wg.Wait()
case "6", "6.", "change nickname", "nick":
ServerID := Input("Enter Server ID")
Nickname := Input("Enter Nickname")
for _, tkn := range Tokens {
wg.Add(1)
go func(TOKEN string, Server string, Nick string) {
server.ChangeNickname(ServerID, TOKEN, Nickname)
wg.Done()
}(tkn, ServerID, Nickname)
}
wg.Wait()
}
}

Expand Down Expand Up @@ -127,6 +138,7 @@ func Help() {
fmt.Printf("%s %s\n", white("3. Spam Message - Params:"), red("<Server ID> <Channel ID> <Message To Spam>"))
fmt.Printf("%s %s\n", white("4. Add Reaction - Params:"), red("<Channel ID> <Message ID> <Emoji>"))
fmt.Printf("%s %s\n", white("5. Add Reaction Message - Params:"), red("<Channel ID> <Message ID> <Reaction Message>"))
fmt.Printf("%s %s\n", white("6. Change Nickname - Params:"), red("<Server ID> <Nickname>"))
}

func init() {
Expand Down
64 changes: 64 additions & 0 deletions server/nickname.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package server

import (
"Raid-Client/cloudflare"
"Raid-Client/utils"
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
)

func ChangeNickname(ServerID string, Token string, Nickname string) error {
payload := map[string]string{
"nick": Nickname,
}

payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode(payload)

request, err := http.NewRequest("PATCH", fmt.Sprintf("https://discord.com/api/v9/guilds/%s/members/%s", ServerID, "%40me"), payloadBuf)
if err != nil {
return err
}

cf := cloudflare.Cookie()
xprop := utils.XSuperProperties()

request.Header = http.Header{
"Accept": []string{"*/*"},
"Accept-language": []string{"en-GB"},
"Authorization": []string{Token},
"Content-length": []string{"2"},
"Content-type": []string{"application/json"},
"Cookie": []string{cf},
"Origin": []string{"https://discord.com"},
"Referrer": []string{fmt.Sprintf("https://discord.com/channels/%s", ServerID)},
"Sec-fetch-dest": []string{"empty"},
"Sec-fetch-mode": []string{"cors"},
"Sec-fetch-site": []string{"same-origin"},
"User-agent": []string{"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.15 Chrome/83.0.4103.122 Electron/9.3.5 Safari/537.36"},
"X-debug-options": []string{"bugReporterEnabled"},
"X-super-properties": []string{xprop},
}

client := &http.Client{
Timeout: 5 * time.Second,
}

res, err := client.Do(request)
if err != nil {
return err
}
defer res.Body.Close()

switch res.StatusCode {
case 200:
fmt.Printf("%s %s %s\n", red(Token), green("Success:"), white(fmt.Sprintf("Changed nickname to %s", Nickname)))
default:
fmt.Printf("%s %s\n", white(Token), red(fmt.Sprintf("Error: Unable to change nickname to %s", Nickname)))
}

return nil
}

0 comments on commit 0536cf0

Please sign in to comment.