示例#1
0
        /// <summary>
        /// Sends the specified message to the jabber-account specified in Recipient
        /// </summary>
        /// <param name="message">The message to be sent</param>
        protected override void send(string message)
        {
            if (!Name.IsNullOrEmpty())
            {
                message = Name + "|" + message;
            }

            if (Enable && !Recipient.IsNullOrEmpty() && xmppClient != null)
            {
                xmppClient.SendMessage(XmppLogger.Recipient, message);
            }
        }
示例#2
0
        /// <summary>
        /// Event-Handler, der bei dem Befehl !topic <neues Topic> im Channel das Topic setzt (sofern der Bot OP hat, und sonst einen Fehler ausgibt)
        /// </summary>
        /// <param name="messageData"></param>
        public void ChangeTopic(MessageData messageData)
        {
            string command = "!topic";

            if (messageData.MessageParts.Length == 0 || !messageData.MessageParts[0].StartsWith(command))
            {
                return;
            }

            if (!_messagingClient.AmIChannelAdmin(messageData.Channel).Value)
            {
                _messagingClient.SendMessage(messageData.Channel, Texts.TopicChangeRequestedButIAmNotOperator);

                return;
            }

            string newTopic = PrepareTopic(messageData.Message, command, messageData.Nickname);

            _messagingClient.ChangeTopic(messageData.Channel, newTopic);
        }