mirror of
https://gitea.phreedom.club/localhost_frssoft/mastodon-group-bot.git
synced 2024-11-22 12:29:20 +02:00
Disable/Enable boosts admin command
This commit is contained in:
parent
bf14452ab7
commit
6e6283dfb0
23
bot.go
23
bot.go
|
@ -25,6 +25,7 @@ var (
|
|||
ctx = context.Background()
|
||||
|
||||
my_account, _ = c.GetAccountCurrentUser(ctx)
|
||||
boostsenabled = true
|
||||
)
|
||||
|
||||
type APobject struct {
|
||||
|
@ -70,7 +71,7 @@ func CheckAPReply(tooturl string) (bool) {
|
|||
return false
|
||||
}
|
||||
if apobj.InReplyTo != nil {
|
||||
WarnLogger.Printf("AP object of status detected reply: %s", apobj.InReplyTo)
|
||||
WarnLogger.Printf("AP object of status detected reply: %s", &apobj.InReplyTo)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
@ -126,6 +127,9 @@ func RunBot() {
|
|||
// Follow check
|
||||
if relationship[0].FollowedBy {
|
||||
if notif.Status.Visibility == "public" { // Reblog toot
|
||||
if boostsenabled == false {
|
||||
continue
|
||||
}
|
||||
var APreply bool
|
||||
APreply = false
|
||||
if notif.Status.InReplyToID == nil {
|
||||
|
@ -192,6 +196,23 @@ func RunBot() {
|
|||
case "delete":
|
||||
c.DeleteStatus(ctx, mID)
|
||||
WarnLogger.Printf("%s was deleted", mID)
|
||||
case "disable":
|
||||
boostsenabled = false
|
||||
WarnLogger.Printf("Reblogs disabled by admin")
|
||||
case "enable":
|
||||
boostsenabled = true
|
||||
WarnLogger.Printf("Reblogs enabled by admin")
|
||||
default:
|
||||
WarnLogger.Printf("%s entered wrong command", acct)
|
||||
}
|
||||
} else if len(args) == 2 {
|
||||
switch args[1] {
|
||||
case "disable":
|
||||
boostsenabled = false
|
||||
WarnLogger.Printf("Reblogs disabled by admin")
|
||||
case "enable":
|
||||
boostsenabled = true
|
||||
WarnLogger.Printf("Reblogs enabled by admin")
|
||||
default:
|
||||
WarnLogger.Printf("%s entered wrong command", acct)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue