本文整理汇总了Golang中github.com/bwmarrin/discordgo.Session.ChannelMessage方法的典型用法代码示例。如果您正苦于以下问题:Golang Session.ChannelMessage方法的具体用法?Golang Session.ChannelMessage怎么用?Golang Session.ChannelMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/bwmarrin/discordgo.Session
的用法示例。
在下文中一共展示了Session.ChannelMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SBMessageUpdate
func SBMessageUpdate(s *discordgo.Session, m *discordgo.MessageUpdate) {
info := GetChannelGuild(m.ChannelID)
if info == nil {
return
}
if boolXOR(sb.Debug, info.IsDebug(m.ChannelID)) {
return
}
if m.Author == nil { // Discord sends an update message with an empty author when certain media links are posted
original, err := s.ChannelMessage(m.ChannelID, m.ID)
if err != nil {
info.log.LogError("Error processing MessageUpdate: ", err)
return // Fuck it, we can't process this
}
m.Author = original.Author
}
ch, err := sb.dg.State.Channel(m.ChannelID)
info.log.LogError("Error retrieving channel ID "+m.ChannelID+": ", err)
private := true
if err == nil {
private = ch.IsPrivate
}
cid := SBatoi(m.ChannelID)
if cid != info.config.LogChannel && !private && sb.IsDBGuild(info) { // Always ignore messages from the log channel
sb.db.AddMessage(SBatoi(m.ID), SBatoi(m.Author.ID), m.ContentWithMentionsReplaced(), cid, m.MentionEveryone, SBatoi(ch.GuildID))
}
if m.Author.ID == sb.SelfID {
return
}
ApplyFuncRange(len(info.hooks.OnMessageUpdate), func(i int) {
if info.ProcessModule(m.ChannelID, info.hooks.OnMessageUpdate[i]) {
info.hooks.OnMessageUpdate[i].OnMessageUpdate(info, m.Message)
}
})
}