Skip to content

Instantly share code, notes, and snippets.

@iDevelopThings
Created May 30, 2021 02:14
Show Gist options
  • Save iDevelopThings/04ff347d32f7937a2bbb7323b2b6ae12 to your computer and use it in GitHub Desktop.
Save iDevelopThings/04ff347d32f7937a2bbb7323b2b6ae12 to your computer and use it in GitHub Desktop.
Example of passing client reference/"class" in golang
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