this post was submitted on 06 Jul 2023
10 points (100.0% liked)

Home

467 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:

founded 1 year ago
MODERATORS
10
submitted 1 year ago* (last edited 1 year ago) by Demigodrick to c/home
 

Hello all - small request if you have a couple of minutes. Please could you send ZippyBot a message with just #score

Im testing the bots capacity to do multiple things at once, so the more it gets spammed the better! I'll leave this message up for 10/15 minutes or until the bot breaks.

If you get no reply, RIP ZippyBot

Edit: going to leave it running for a while, see how it gets on.

I suppose your score would be closest to reddit "karma"

all 12 comments
sorted by: hot top controversial new old
[–] sleepingoddish 2 points 1 year ago (1 children)

I sent the #score message and got a reply

[–] Demigodrick 1 points 1 year ago

Great stuff :) thanks!

[–] Anonpony1 2 points 1 year ago (1 children)

I tried to send some common invalid messages. The bot reacted properly.

[–] Demigodrick 1 points 1 year ago

Thanks for that - didnt consider empty messages so glad it was able to resolve that.

[–] Efwis 2 points 1 year ago (1 children)

i did as stated and got a reply

[–] Demigodrick 1 points 1 year ago

Thanks! Looks like its still working then :)

[–] Thoxy 2 points 1 year ago (1 children)

I stop i tied one time with concurrency and one time without (200 requests)

[–] Demigodrick 1 points 1 year ago

Looks like it managed to handle it all (from what i can see) so i'd say that was a success. Thanks for that!

[–] Demigodrick 1 points 1 year ago (1 children)
[–] Thoxy 2 points 1 year ago* (last edited 1 year ago)

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()
}