コード例 #1
0
ファイル: Schedules.cs プロジェクト: Nayuki749/Rein
        protected void Send(ScheduledMessage[] Messages, IBot bot)
        {
            var now = DateTime.Now;

            foreach (var message in Messages)
            {
                if (message == null)
                {
                    continue;
                }
                if (message.Type == ScheduledMessageType.DoNothing)
                {
                    continue;
                }
                if (message.Content.Length == 0)
                {
                    continue;
                }
                var text = ReplaceContent(message.Content, bot, now);
                if (text.Length == 0)
                {
                    continue;
                }
                if (message.Type == ScheduledMessageType.Talk)
                {
                    bot.AddTalk(text[0], new TalkOptions());
                    continue;
                }
                if (message.Type == ScheduledMessageType.SendMessage)
                {
                    var channels = message.TextChannelIds;
                    if (channels.Length == 1)
                    {
                        if (channels[0] == "default")
                        {
                            channels = null;
                        }
                        else if (channels[0] == "all")
                        {
                            channels = bot.TextChannelIdStrings;
                        }
                    }
                    bot.SendMessageAsync(channels, text[0], text[1], message.CutIfTooLong);
                    continue;
                }
            }
        }