当前位置: 首页>>代码示例>>Golang>>正文


Golang OMessage.Type方法代码示例

本文整理汇总了Golang中github.com/42wim/matterbridge/matterhook.OMessage.Type方法的典型用法代码示例。如果您正苦于以下问题:Golang OMessage.Type方法的具体用法?Golang OMessage.Type怎么用?Golang OMessage.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/42wim/matterbridge/matterhook.OMessage的用法示例。


在下文中一共展示了OMessage.Type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: SendType

func (b *Bridge) SendType(nick string, message string, channel string, mtype string) error {
	if b.Config.Mattermost.PrefixMessagesWithNick {
		if IsMarkup(message) {
			message = nick + "\n\n" + message
		} else {
			message = nick + " " + message
		}
	}
	if b.kind == Legacy {
		matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL}
		matterMessage.Channel = channel
		matterMessage.UserName = nick
		matterMessage.Type = mtype
		matterMessage.Text = message
		err := b.mh.Send(matterMessage)
		if err != nil {
			flog.mm.Info(err)
			return err
		}
		return nil
	}
	flog.mm.Debug("->mattermost channel: ", channel, " ", message)
	b.mc.PostMessage(channel, message)
	return nil
}
开发者ID:42wim,项目名称:matterbridge,代码行数:25,代码来源:bridge.go

示例2: SendType

func (b *Bridge) SendType(nick string, message string, channel string, mtype string) error {
	matterMessage := matterhook.OMessage{IconURL: b.Config.Mattermost.IconURL}
	matterMessage.Channel = channel
	matterMessage.UserName = nick
	matterMessage.Text = message
	matterMessage.Type = mtype
	err := b.m.Send(matterMessage)
	if err != nil {
		log.Println(err)
		return err
	}
	return nil
}
开发者ID:daysofwineandroses,项目名称:matterbridge,代码行数:13,代码来源:matterbridge.go

示例3: Send

func (b *Brocketchat) Send(msg config.Message) error {
	flog.Debugf("Receiving %#v", msg)
	matterMessage := matterhook.OMessage{IconURL: b.Config.IconURL}
	matterMessage.Channel = msg.Channel
	matterMessage.UserName = msg.Username
	matterMessage.Type = ""
	matterMessage.Text = msg.Text
	err := b.mh.Send(matterMessage)
	if err != nil {
		flog.Info(err)
		return err
	}
	return nil
}
开发者ID:42wim,项目名称:matterbridge,代码行数:14,代码来源:rocketchat.go

示例4: Send

func (b *Bslack) Send(msg config.Message) error {
	flog.Debugf("Receiving %#v", msg)
	if msg.Account == b.Account {
		return nil
	}
	nick := msg.Username
	message := msg.Text
	channel := msg.Channel
	if b.Config.PrefixMessagesWithNick {
		message = nick + " " + message
	}
	if !b.Config.UseAPI {
		matterMessage := matterhook.OMessage{IconURL: b.Config.IconURL}
		matterMessage.Channel = channel
		matterMessage.UserName = nick
		matterMessage.Type = ""
		matterMessage.Text = message
		err := b.mh.Send(matterMessage)
		if err != nil {
			flog.Info(err)
			return err
		}
		return nil
	}
	schannel, err := b.getChannelByName(channel)
	if err != nil {
		return err
	}
	np := slack.NewPostMessageParameters()
	if b.Config.PrefixMessagesWithNick == true {
		np.AsUser = true
	}
	np.Username = nick
	np.IconURL = config.GetIconURL(&msg, b.Config)
	if msg.Avatar != "" {
		np.IconURL = msg.Avatar
	}
	b.sc.PostMessage(schannel.ID, message, np)

	/*
	   newmsg := b.rtm.NewOutgoingMessage(message, schannel.ID)
	   b.rtm.SendMessage(newmsg)
	*/

	return nil
}
开发者ID:42wim,项目名称:matterbridge,代码行数:46,代码来源:slack.go


注:本文中的github.com/42wim/matterbridge/matterhook.OMessage.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。