Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Multiplexer
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
Multiplexer
Commits
58df0f1d
Commit
58df0f1d
authored
Jul 10, 2021
by
Ophestra
Browse files
Options
Downloads
Patches
Plain Diff
handle voice state update
parent
e615dcfb
Branches
Branches containing commit
Tags
v1.0.10
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
generic.go
+29
-0
29 additions, 0 deletions
generic.go
multiplexer.go
+1
-0
1 addition, 0 deletions
multiplexer.go
new.go
+1
-0
1 addition, 0 deletions
new.go
with
31 additions
and
0 deletions
generic.go
+
29
−
0
View file @
58df0f1d
...
...
@@ -159,3 +159,32 @@ func (mux *Multiplexer) onMessageReactionRemove(session *discordgo.Session, remo
}
}()
}
// Event handler that fires when voice state updates
func
(
mux
*
Multiplexer
)
onVoiceStateUpdate
(
session
*
discordgo
.
Session
,
update
*
discordgo
.
VoiceStateUpdate
)
{
go
func
()
{
for
_
,
hook
:=
range
mux
.
VoiceStateUpdate
{
var
user
*
discordgo
.
User
member
,
err
:=
session
.
State
.
Member
(
update
.
GuildID
,
update
.
UserID
)
if
err
!=
nil
{
member
,
err
=
session
.
GuildMember
(
update
.
GuildID
,
update
.
UserID
)
if
err
!=
nil
{
log
.
Errorf
(
"Error getting member %s from guild %s, %s."
,
update
.
UserID
,
update
.
GuildID
,
err
)
}
else
{
user
=
member
.
User
}
}
else
{
user
=
member
.
User
}
hook
(
&
Context
{
Multiplexer
:
mux
,
User
:
user
,
Member
:
member
,
Session
:
session
,
Guild
:
GetGuild
(
session
,
update
.
GuildID
),
Channel
:
GetChannel
(
session
,
update
.
ChannelID
),
Event
:
update
,
})
}
}()
}
This diff is collapsed.
Click to expand it.
multiplexer.go
+
1
−
0
View file @
58df0f1d
...
...
@@ -25,6 +25,7 @@ type Multiplexer struct {
MessageUpdate
[]
func
(
context
*
Context
)
MessageReactionAdd
[]
func
(
context
*
Context
)
MessageReactionRemove
[]
func
(
context
*
Context
)
VoiceStateUpdate
[]
func
(
context
*
Context
)
// Administrator is the privileged administrator user with all privilege overrides and full access to all commands.
Administrator
*
discordgo
.
User
...
...
This diff is collapsed.
Click to expand it.
new.go
+
1
−
0
View file @
58df0f1d
...
...
@@ -24,6 +24,7 @@ func New() *Multiplexer {
mux
.
onMessageUpdate
,
mux
.
onMessageReactionAdd
,
mux
.
onMessageReactionRemove
,
mux
.
onVoiceStateUpdate
,
}
return
mux
}
...
...
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