Created
May 30, 2021 02:14
-
-
Save iDevelopThings/04ff347d32f7937a2bbb7323b2b6ae12 to your computer and use it in GitHub Desktop.
Example of passing client reference/"class" in golang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ClientLogic struct { | |
Client *twitchgo.Client | |
} | |
func Main() { | |
clientLogic := ClientLogic{ | |
Client: twitchClient, | |
} | |
twitchClient.OnPrivateMessage(clientLogic.OnPrivateMessage) | |
} | |
func (c *ClientLogic) OnPrivateMessage() { | |
} | |
func (c *ClientLogic) sayPing() { | |
c.Client.Say("mrdemonwolf", "Hello World") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment