Exemplo n.º 1
0
        public Telega(IEnumerable <Base> bases, TelegramSetting setting)
        {
            this.setting = setting;
            this.bases   = bases;
            this.server  = new Server(setting.ServerPath, setting.ServerAdminUserName, setting.ServerAdminPass);

            if (setting.UseProxy)
            {
                proxy = new HttpToSocks5Proxy(setting.HostNameProxy, setting.PortProxy, setting.UserNameProxy, setting.PasswordProxy);
                proxy.ResolveHostnamesLocally = true;
                bot = new TelegramBotClient(setting.CommandBot.Token, proxy);
            }
            else
            {
                bot = new TelegramBotClient(setting.CommandBot.Token);
            }

            bot.OnMessage += OnMessage;
        }
Exemplo n.º 2
0
        public WorkplaceContext()
        {
            this.Database.EnsureCreated();

            this.Bases.Load();
            this.Platforms.Load();
            this.Releases.Load();
            this.Distributions.Load();
            this.ChatIds.Load();
            this.DistributionActions.Load();
            this.TelegramBots.Load();
            this.TelegramSettings.Load();
            if (TelegramSettings.CountAsync().Result == 0)
            {
                var ts = new TelegramSetting();
                this.TelegramSettings.Add(ts);
                this.SaveChanges();
                TelegramSetting = ts;
            }
            else
            {
                TelegramSetting = this.TelegramSettings.FirstAsync().Result;
            }
        }