this post was submitted on 06 Jul 2023
10 points (100.0% liked)
Home
473 readers
1 users here now
Lemmy.zip instance discussion.
For all things relating to Lemmy.zip.
Main instance rules apply, with the additional rules below:
- This community is intended for Lemmy.zip users only. Comments or posts from external instance users will be removed at the admin's discretion. Repeat offenders will be banned.
founded 2 years ago
MODERATORS
I sent the #score message and got a reply
Great stuff :) thanks!
I tried to send some common invalid messages. The bot reacted properly.
Thanks for that - didnt consider empty messages so glad it was able to resolve that.
i did as stated and got a reply
Thanks! Looks like its still working then :)
I stop i tied one time with concurrency and one time without (200 requests)
Looks like it managed to handle it all (from what i can see) so i'd say that was a success. Thanks for that!
Thanks @[email protected] ;)
Your welcome ^^
package main
import (
"bytes"
"net/http"
"sync"
)
func main() {
client := http.Client{}
wg := &sync.WaitGroup{}
for i := 0; i < 100; i++ {
wg.Add(1)
go func() {
bodyReader := bytes.NewReader(
[]byte(
`{"content":"#score","recipient_id":303747,"auth":"..............."}`,
),
)
req, err := http.NewRequest(
"POST",
"https://lemmy.zip/api/v3/private_message",
bodyReader,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "*/*")
req.Header.Set(
"User-Agent",
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0",
)
req.Header.Set("Accept-Language", "fr-FR,fr;q=0.8,en-US;q=0.5,en;q=0.3")
req.Header.Set("Accept-Encoding", "gzip, deflate, br")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Referer", "https://lemmy.zip/create_private_message/303747")
req.Header.Set("Origin", "https://lemmy.zip")
req.Header.Set("DNT", "1")
req.Header.Set("Sec-Fetch-Dest", "empty")
req.Header.Set("Connection", "keep-alive")
client.Do(req)
wg.Done()
}()
}
wg.Wait()
}