本文整理汇总了Golang中github.com/iopred/bruxism.Service.PrivateMessage方法的典型用法代码示例。如果您正苦于以下问题:Golang Service.PrivateMessage方法的具体用法?Golang Service.PrivateMessage怎么用?Golang Service.PrivateMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/iopred/bruxism.Service
的用法示例。
在下文中一共展示了Service.PrivateMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InviteCommand
// InviteCommand is a command for accepting an invite to a channel.
func InviteCommand(bot *bruxism.Bot, service bruxism.Service, message bruxism.Message, command string, parts []string) {
if service.Name() == bruxism.DiscordServiceName {
discord := service.(*bruxism.Discord)
if discord.ApplicationClientID != "" {
service.SendMessage(message.Channel(), fmt.Sprintf("Please visit https://discordapp.com/oauth2/authorize?client_id=%s&scope=bot to add %s to your server.", discord.ApplicationClientID, service.UserName()))
return
}
}
if len(parts) == 1 {
join := parts[0]
if service.Name() == bruxism.DiscordServiceName {
join = discordInviteID(join)
}
if err := service.Join(join); err != nil {
if service.Name() == bruxism.DiscordServiceName && err == bruxism.ErrAlreadyJoined {
service.PrivateMessage(message.UserID(), "I have already joined that server.")
return
}
log.Println("Error joining %s %v", service.Name(), err)
} else if service.Name() == bruxism.DiscordServiceName {
service.PrivateMessage(message.UserID(), "I have joined that server.")
}
}
}