public static void updateEcon(ServerEconomy c) { IMongoCollection <ServerEconomy> collection = GetEconCollection(); collection.ReplaceOne(com => com._id == c._id, c); return; }
private async Task MainAsync() { client = new DiscordSocketClient(); Commands = new CommandService(); client = new DiscordSocketClient(new DiscordSocketConfig { LogLevel = LogSeverity.Debug //Set to Error or Critical at Release }); Console.WriteLine("Logging In..."); await client.LoginAsync(TokenType.Bot, Tokens.token_bot); await client.StartAsync(); Console.WriteLine("Logged In"); await client.SetGameAsync("$help | THE LINE ONLY GOES UP!!!!!!!"); economy = MongoUtil.getEconomy(); CommandHandler ch = new CommandHandler(client, Commands); await ch.InstallCommandsAsync(); client.Ready += ClientReady; client.JoinedGuild += Client_JoinedGuild; client.LeftGuild += Client_LeftGuild; //Put stuff here //client.MessageReceived += IN COMMAND HANDLER; // Block this task until the program is closed. await Task.Delay(-1); }
public static ServerEconomy getEconomy() { IFindFluent <ServerEconomy, ServerEconomy> find = findEconomy(e => true); if (find.CountDocuments() == 0) { IMongoCollection <ServerEconomy> col = GetEconCollection(); ServerEconomy econ = new ServerEconomy(); col.InsertOne(econ); return(econ); } return(find.First()); }