本文整理匯總了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)
}
})
}