本文整理匯總了Golang中github.com/bwmarrin/discordgo.Session.ChannelMessageDelete方法的典型用法代碼示例。如果您正苦於以下問題:Golang Session.ChannelMessageDelete方法的具體用法?Golang Session.ChannelMessageDelete怎麽用?Golang Session.ChannelMessageDelete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/bwmarrin/discordgo.Session
的用法示例。
在下文中一共展示了Session.ChannelMessageDelete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: messageDelete
func messageDelete(s *discordgo.Session, chanID string, mID string) {
c := config.Get()
if !c.KeepTriggers {
s.ChannelMessageDelete(chanID, mID)
}
}
示例2: messageCreate
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
var deleteMessageAuthor bool
deleteMessageAuthor = true
text := m.ContentWithMentionsReplaced()
if m.Author.ID == s.State.User.ID {
// Ignore self
return
}
channel, _ := s.State.Channel(m.ChannelID)
if channel.IsPrivate {
channel.Name = "direct message"
}
if strings.HasPrefix(text, "!") || strings.HasPrefix(text, ".") || strings.HasPrefix(text, "bot.") {
// Ignore shit meant for other bots
return
}
isMentioned := isUserMentioned(s.State.User, m.Mentions) || m.MentionEveryone
text = strings.Replace(text, "@everyone", "", -1)
// Log cleaned up message
fmt.Printf("%20s %20s %20s > %s\n", channel.Name, time.Now().Format(time.Stamp), m.Author.Username, text)
if shouldIgnore(m.Author) {
return
}
c := config.Get()
for _, ChannelID := range c.Channels {
if m.ChannelID == ChannelID {
linksFound, reply := lewd.ParseLinks(text)
if linksFound {
content := strings.Join(lewd.ContentLinks(m.Content)[:], " ")
if deleteMessageAuthor {
s.ChannelMessageDelete(m.ChannelID, m.ID)
}
s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%s: %s\n%s", m.Author.Username, content, reply))
return
}
}
}
// Accept the legacy mention as well and trim it off from text
if strings.HasPrefix(strings.ToLower(text), "lewdbot, ") {
text = text[9:]
isMentioned = true
}
if channel.IsPrivate || isMentioned {
var reply string
reply = regex.Lewdbot.ReplaceAllString(reply, m.Author.Username)
// Log our reply
fmt.Printf("%20s %20s %20s > %s\n", channel.Name, time.Now().Format(time.Stamp), s.State.User.Username, reply)
s.ChannelMessageSend(m.ChannelID, reply)
}
}
示例3: checkLink
func checkLink(s *discordgo.Session, m string, chanID string, mID string) {
if strings.Contains(strings.ToLower(m), "www.facebook") {
s.ChannelMessageDelete(chanID, mID)
}
}