Open moul opened 1 year ago
As part of community reporting, we may need engagement statistics on discord. But via the api, we can't get the history of this data at the moment. So to have enough history it may be useful to start collecting these stats regularly to track the evolution of community engagement on Discord because you won't be able to get them afterwards.
1 - Define the information to collect that can be used for statistics:
2 - Where to store information (db, file, etc)
3 - Create a bot script dedicated to reporting and add it to the discord.
4 - Create a script that is run at regular intervals to retrieve the info or one that is always listening for events on the discord.
An example of a script to answer "Total number of members over time" by retrieving the number of members at a moment T. Must be completed with the rest of the information requirements.
package main
import (
"encoding/csv"
"log"
"os"
"strconv"
"time"
"github.com/bwmarrin/discordgo"
)
func main() {
guildID := "" //gno server id
token := "" // bot token
discord, err := discordgo.New("Bot " + token)
if err != nil {
log.Fatal(err)
}
g, err := discord.Guild(guildID)
if err != nil {
log.Fatal(err)
}
ds := NewFileStore("discord.csv") // Replace with your implementation of ReportingDatastore
if err := ds.SaveMemberCount(g.MemberCount, time.Now().UTC()); err != nil {
log.Println(err)
}
}
type ReportingDatastore interface {
SaveMemberCount(total int, date time.Time) error
}
type FileStore struct {
filename string
}
func NewFileStore(filename string) *FileStore {
return &FileStore{filename: filename}
}
func (f *FileStore) SaveMemberCount(total int, date time.Time) error {
file, err := os.OpenFile(f.filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
if err != nil {
return err
}
defer file.Close()
writer := csv.NewWriter(file)
defer writer.Flush()
if err := writer.Write([]string{strconv.Itoa(total), date.Format(time.RFC3339)}); err != nil {
return err
}
return nil
}
Generally speaking, I think it is easier to list the sources where the information is interesting for our reporting and to define the data to follow, in order to start the collection.
We have to make sure that the source (github, twitter, discord, etc) gives us a history. If not, treat the sources without history as a priority.
This issue https://github.com/moul/depviz/issues/649 may unlock new possibilites.
Continues https://github.com/gnolang/gno/issues/466
Context
The Gno technical core team (@gnolang/core-tech) will share what's going on with the community.
During this report, we'll try giving visibility on:
We will release the report by text. We are considering having a companion live update (audio, video).
To do
In order to make the process more efficient, we'll need various scripts to help us prebuild the report:
awesome-gno
,#gnotips
hashtag? + "what are the tips you want to share" official threadScript(s) must be published in the https://github.com/gnolang/blog repo. If possible, in Go.
Tasks