Beispiel #1
0
        public MYouTube(SkyBot skyBot)
        {
            _skyBot = skyBot;

            ID       = ModuleList.YouTube;
            UsableBy = APIList.All;

            if (File.Exists(Directory.GetCurrentDirectory() + _dbFolderPath))
            {
                LoadBase();
            }

            if (_textList.Count == 0)
            {
                return;
            }
            if (_urlList.Count == 0)
            {
                return;
            }

            _youtubeTimer           = new Timer(60 * 1000);
            _youtubeTimer.Elapsed  += new ElapsedEventHandler(OnSendTimerEvent);
            _youtubeTimer.Enabled   = true;
            _youtubeTimer.AutoReset = true;
        }
Beispiel #2
0
        public Module_Timer(SkyBot b)
        {
            bot = b;

            ID       = ModuleList.Timer;
            UsableBy = APIList.All;
        }
Beispiel #3
0
        public Module_BasicCommands(SkyBot b)
        {
            bot = b;

            ID       = ModuleList.BasicCommands;
            UsableBy = APIList.All;
        }
Beispiel #4
0
        public override bool Connect(SkyBot handle)
        {
            base.Connect(handle);

            Status      = APIStatus.Connected;
            loopEnabled = true;

            return(true);
        }
Beispiel #5
0
        public override bool Connect(SkyBot handle)
        {
            base.Connect(handle);
            //skype.Attach(7, false);
            //skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(RecieveMessage);

            //Status = APIStatus.Connecting;
            //return true;
            throw new NotImplementedException();
        }
Beispiel #6
0
        public MOrganiser(SkyBot skyBot)
        {
            _skyBot = skyBot;

            ID       = ModuleList.Organiser;
            UsableBy = APIList.All;

            _skyTimerOrg           = new Timer(60 * 1000);
            _skyTimerOrg.Elapsed  += new ElapsedEventHandler(OnTimedOrgEvent);
            _skyTimerOrg.Enabled   = true;
            _skyTimerOrg.AutoReset = true;
        }
Beispiel #7
0
        public override bool Connect(SkyBot handle)
        {
            Status = APIStatus.Connecting;
            base.Connect(handle);

            bool result = Authorize();

            if (result)
            {
                Status = APIStatus.Connected;
                receiveTimer.Enabled = true;
            }
            return(result);
        }
Beispiel #8
0
        public override bool Connect(SkyBot handle)
        {
            base.Connect(handle);

            Status = APIStatus.Connecting;
            Parent.UI.vkStatus.Text      = Status.ToString();
            Parent.UI.vkStatus.ForeColor = System.Drawing.Color.Yellow;

            bool result = Authorize();

            if (result)
            {
                Status = APIStatus.Connected;
                Parent.UI.vkStatus.Text      = Status.ToString();
                Parent.UI.vkStatus.ForeColor = System.Drawing.Color.Green;
                receiveTimer.Enabled         = true;
            }
            return(result);
        }
Beispiel #9
0
        public ProcessSetTimer(SkyBot skybot, ReceivedMessage message, int h, int m, int s)
        {
            bot = skybot;
            msg = message;

            timer          = new Timer(10000);
            timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

            if (h != 61 && h != 0)
            {
                timer.Interval = ((h + m) + s) * 1000;
            }
            else if (m != 61 && h != 0)
            {
                timer.Interval = (m + s) * 1000;
            }
            else
            {
                timer.Interval = s * 1000;
            }

            timer.Enabled = true;
        }
Beispiel #10
0
        public override bool Connect(SkyBot handle)
        {
            Status = APIStatus.Connecting;
            base.Connect(handle);

            token = Config.Read("Discord", "token");

            bool result = false;

            api = new DiscordClient(new DiscordConfig()
            {
                AutoReconnect = true,
                Token         = token,
            });

            try
            {
                api.MessageCreated += new EventHandler <MessageCreateEventArgs>(ReceiveMessages);
                api.Connect();
                result = true;
            }
            catch (Exception ex)
            {
                InformationCollector.Error(this, ex.Message);
                return(false);
            }

            if (result)
            {
                Status = APIStatus.Connected;
                Parent.UI.discordStatus.Text      = Status.ToString();
                Parent.UI.discordStatus.ForeColor = System.Drawing.Color.Green;
            }

            return(result);
        }
Beispiel #11
0
 public virtual bool Connect(SkyBot handle)
 {
     Parent = handle;
     return(true);
 }
Beispiel #12
0
        public override bool Connect(SkyBot handle)
        {
            base.Connect(handle);
            Status = APIStatus.Connecting;
            Parent.UI.tgStatus.Text      = Status.ToString();
            Parent.UI.tgStatus.ForeColor = System.Drawing.Color.Yellow;

            token = Config.Read("Telegram", "token");

            try
            {
                // its outside of constructor to make creating child tg bots easier
                api = new TelegramBotClient(token);

                api.OnMessage             += ReceiveMessage;
                api.OnReceiveError        += OnError;
                api.OnReceiveGeneralError += OnError;
            }
            catch (Exception ex)
            {
                InformationCollector.Error(this, ex.Message);
            }

            receiveThread = new Thread(delegate()
            {
                try
                {
                    api.TestApiAsync();
                    api.StartReceiving();

                    if (api.IsReceiving)
                    {
                        InformationCollector.Info(this, "Receiving...");
                    }
                    else
                    {
                        InformationCollector.Error(this, "NOT receiving...");
                    }
                }
                catch (Exception ex)
                {
                    InformationCollector.Error(this, ex.Message);
                }
            });
            receiveThread.Start();

            bool result = receiveThread.IsAlive;

            if (result)
            {
                Status = APIStatus.Connected;
                Parent.UI.tgStatus.Text      = Status.ToString();
                Parent.UI.tgStatus.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                InformationCollector.Error(this, "receiveThread is NOT alive!");
                Disconnect();
            }

            return(result);
        }