public BigBeautifulBot(BBBSettings config) { Config = config; Info = new BBBInfo(config); Processors = new List <IInputProcessor> { new FoodProcessor(this), new CommandProcessor(this), new LanguageProcessor(this) }; }
public BBBInfo(BBBSettings config) { _Config = config; //Connect to database db = db ?? new SQLiteConnection("Data Source=bbb.db;Version=3;").OpenAndReturn(); //Get values from database var command = new SQLiteCommand("SELECT * FROM BBB;", db); var reader = command.ExecuteReader(); reader.Read(); BBBID = (long)reader[nameof(BBBID)]; Weight = (decimal)reader[nameof(Weight)]; Appetite = (decimal)reader[nameof(Appetite)]; Activities = GetActivities().ToArray(); }
static async Task MainAsync(string[] args) { var exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); System.IO.Directory.SetCurrentDirectory(exeDirectory); //Load config config = new BBBSettings(); //Initialize BBB bbb = new BigBeautifulBot(config); _TickTimer = new Timer(Tick, null, config.TickInterval, config.TickInterval); //TODO: Move all this client stuff into their own classes //Setup client client = new DiscordSocketClient(); client.Ready += Client_Ready; client.JoinedGuild += Client_JoinedGuild; client.LeftGuild += Client_LeftGuild; client.MessageReceived += Client_MessageReceived; client.ReactionAdded += Client_ReactionAdded; //Login and start await client.LoginAsync(Discord.TokenType.Bot, config.Token); await client.StartAsync(); //Set Events for Reminder ReminderProcessor.StartTimers(); //Setup socket client var tcpListener = new TcpListener(IPAddress.Parse("10.0.0.2"), 662); //Change to your localhost if you're not me tcpListener.Start(); await ServiceClients(tcpListener); }