Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
FreeNitori
Plugins
Commits
f200233e
Commit
f200233e
authored
Sep 30, 2021
by
Ophestra
Browse files
Options
Downloads
Patches
Plain Diff
fix the thing in the thing
parent
af29d83b
Branches
master
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
disboard/main.go
+26
-2
26 additions, 2 deletions
disboard/main.go
with
26 additions
and
2 deletions
disboard/main.go
+
26
−
2
View file @
f200233e
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
"os"
"os"
"strconv"
"strconv"
"strings"
"strings"
"sync"
"time"
"time"
)
)
...
@@ -24,8 +25,15 @@ var conf = struct {
...
@@ -24,8 +25,15 @@ var conf = struct {
MessageOverride
map
[
string
]
string
`json:"message_override"`
MessageOverride
map
[
string
]
string
`json:"message_override"`
}{}
}{}
var
uid
string
var
(
var
gid
map
[
string
]
bool
uid
string
gid
map
[
string
]
bool
)
var
(
state
=
make
(
map
[
string
]
bool
)
lock
=
sync
.
RWMutex
{}
)
// Setup reads configuration file and sets up disboard parser and reminder.
// Setup reads configuration file and sets up disboard parser and reminder.
//goland:noinspection GoUnusedExportedFunction
//goland:noinspection GoUnusedExportedFunction
...
@@ -92,6 +100,8 @@ func disboardCreateHandler(context *multiplexer.Context) {
...
@@ -92,6 +100,8 @@ func disboardCreateHandler(context *multiplexer.Context) {
if
bonker
==
nil
{
if
bonker
==
nil
{
return
return
}
}
}
else
{
return
}
}
if
!
context
.
HandleError
(
context
.
Session
.
ChannelTyping
(
context
.
Channel
.
ID
))
{
if
!
context
.
HandleError
(
context
.
Session
.
ChannelTyping
(
context
.
Channel
.
ID
))
{
...
@@ -104,6 +114,16 @@ func disboardCreateHandler(context *multiplexer.Context) {
...
@@ -104,6 +114,16 @@ func disboardCreateHandler(context *multiplexer.Context) {
}
}
func
bonkTimer
(
guild
string
,
user
*
discordgo
.
User
,
messageSend
func
(
message
string
)
*
discordgo
.
Message
)
{
func
bonkTimer
(
guild
string
,
user
*
discordgo
.
User
,
messageSend
func
(
message
string
)
*
discordgo
.
Message
)
{
lock
.
RLock
()
if
state
[
guild
]
{
return
}
lock
.
RUnlock
()
lock
.
Lock
()
state
[
guild
]
=
true
lock
.
Unlock
()
log
.
Infof
(
"User %s bonked in jail %s."
,
user
.
ID
,
guild
)
log
.
Infof
(
"User %s bonked in jail %s."
,
user
.
ID
,
guild
)
time
.
Sleep
(
120
*
time
.
Minute
)
time
.
Sleep
(
120
*
time
.
Minute
)
...
@@ -112,4 +132,8 @@ func bonkTimer(guild string, user *discordgo.User, messageSend func(message stri
...
@@ -112,4 +132,8 @@ func bonkTimer(guild string, user *discordgo.User, messageSend func(message stri
message
=
"%s BONK!"
message
=
"%s BONK!"
}
}
messageSend
(
fmt
.
Sprintf
(
message
,
user
.
Mention
()))
messageSend
(
fmt
.
Sprintf
(
message
,
user
.
Mention
()))
lock
.
Lock
()
state
[
guild
]
=
false
lock
.
Unlock
()
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment