mirror of
https://gitea.phreedom.club/localhost_frssoft/mastodon-group-bot.git
synced 2024-11-22 20:39:19 +02:00
37 lines
633 B
Go
37 lines
633 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"sync"
|
||
|
"time"
|
||
|
|
||
|
"github.com/mattn/go-mastodon"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
wg sync.WaitGroup
|
||
|
)
|
||
|
|
||
|
// Delete notices
|
||
|
func DeleteNotices() {
|
||
|
wg.Done()
|
||
|
|
||
|
for {
|
||
|
statuses, err := c.GetAccountStatuses(ctx, my_account.ID, &mastodon.Pagination{Limit: 60})
|
||
|
if err != nil {
|
||
|
ErrorLogger.Println("Get account statuses")
|
||
|
}
|
||
|
|
||
|
time.Sleep(time.Duration(Conf.Del_notices_interval) * time.Second)
|
||
|
|
||
|
for i := range statuses {
|
||
|
if statuses[i].Visibility == "direct" {
|
||
|
c.DeleteStatus(ctx, statuses[i].ID)
|
||
|
}
|
||
|
}
|
||
|
InfoLogger.Println("Cleaning notices")
|
||
|
|
||
|
reset_notice_counter()
|
||
|
InfoLogger.Println("Reset notice counter")
|
||
|
}
|
||
|
}
|