public async Task Feature1337StreakAsync() { bool check = ReadChannel1337(); if (!check) { return; } var db = dbClass.connect(); TablesHeader dbTable = new TablesHeader(db); var streakQuery = from user in dbTable.Table1337 where user.userid == Context.User.Id select user; if (streakQuery.Count() == 0) { await SendTo1337ChannelAsync(Context.User.Mention + " Du hast noch nie am 1337 Event teilgenommen. <:SadCat:766665234273402910> "); return; } else { uint count_streak = 0; uint counter_longest_streak = 0; foreach (var item in streakQuery) { count_streak = item.counter_streak; counter_longest_streak = item.counter_longest_streak; } await SendTo1337ChannelAsync(">>> " + Context.User.Mention + "\n Deine aktuelle Serie liegt bei `" + count_streak + "`.\n Deine längste Serie bisher war `" + counter_longest_streak + "`."); } }
public async Task Feature1337CountAsync() { bool check = ReadChannel1337(); if (!check) { return; } var db = dbClass.connect(); TablesHeader dbTable = new TablesHeader(db); var streakQuery = from user in dbTable.Table1337 where user.userid == Context.User.Id select user; uint countAll = 0; string date_begin = ""; string date_last = ""; foreach (var item in streakQuery) { countAll = item.counter_all; date_begin = item.date_begin; date_last = item.date_last; } if (streakQuery.Count() == 0) { await SendTo1337ChannelAsync(Context.User.Mention + " Du hast noch nie am 1337 Event teilgenommen. <:SadCat:766665234273402910> "); return; } else { await SendTo1337ChannelAsync(">>> " + Context.User.Mention + "\nDu wurdest Insgesamt `" + countAll + "` mal gezählt.\n" + "Deine erste Zählung war am `" + date_begin + "`.\n" + "Deine letzte Zählung war am `" + date_last + "`."); } }
private void CopyTableEveryDay() { #pragma warning disable CS1998 // Bei der asynchronen Methode fehlen "await"-Operatoren. Die Methode wird synchron ausgeführt. Task.Run(async() => #pragma warning restore CS1998 // Bei der asynchronen Methode fehlen "await"-Operatoren. Die Methode wird synchron ausgeführt. { while (true) { #region set Trigger Time DateTime aktuelleZeit = DateTime.Now; DateTime triggerZeit = new DateTime(aktuelleZeit.Year, aktuelleZeit.Month, aktuelleZeit.Day, 13, 36, 00, 000); // get the time different to int in millisec int iTriggerZeit = Convert.ToInt32(triggerZeit.Subtract(aktuelleZeit).TotalMilliseconds); if (iTriggerZeit < 0) { triggerZeit = new DateTime(aktuelleZeit.Year, aktuelleZeit.Month, aktuelleZeit.Day, 13, 36, 00, 000).AddDays(1); iTriggerZeit = Convert.ToInt32(triggerZeit.Subtract(aktuelleZeit).TotalMilliseconds); } // sleep until the respons time is 13:38 each day Thread.Sleep(iTriggerZeit); #endregion this.db = this.dbClass.connect(); TablesHeader dbTable = new TablesHeader(this.db); #region Delete all Data in Table 1337_2 First var table1337_2result = from table in dbTable.Table1337_2 select table; foreach (var item in table1337_2result) { dbTable.Table1337_2.DeleteOnSubmit(item); } try { dbTable.SubmitChanges(); LogMain("Daten in Tabelle 1337_2 erfolgreich gelöscht.", LogLevel.Dev); } catch (Exception e) { LogMain("Beim Löschen der Daten in Tabelle 1337_2 ist ein Fehler aufgetretten.\n" + e, LogLevel.Error); } #endregion #region Copy Data from Table 1337 -> 1337_2 var table1337result = from table in dbTable.Table1337 select table; foreach (var item in table1337result) { Table1337_2 newList = new Table1337_2(); newList.userid = item.userid; newList.username = item.username; newList.counter_all = item.counter_all; newList.counter_streak = item.counter_streak; newList.counter_longest_streak = item.counter_longest_streak; newList.date_begin = item.date_begin; newList.date_last = item.date_last; dbTable.Table1337_2.InsertOnSubmit(newList); } try { dbTable.SubmitChanges(); LogMain("Kopieren der Tabelle 1337 -> 1337_2 war erfolgreich.", LogLevel.Dev); } catch (Exception e) { LogMain("Beim Kopieren der Tabelle 1337 -> 1337_2 ist ein Fehler aufgetretten.\n" + e, LogLevel.Error); } #endregion db.Close(); } }); }
#pragma warning disable CS1998 // Bei der asynchronen Methode fehlen "await"-Operatoren. Die Methode wird synchron ausgeführt. public async Task PostDaylieStats(SocketGuild guild) #pragma warning restore CS1998 // Bei der asynchronen Methode fehlen "await"-Operatoren. Die Methode wird synchron ausgeführt. { #pragma warning disable CS4014 // Da auf diesen Aufruf nicht gewartet wird, wird die Ausführung der aktuellen Methode vor Abschluss des Aufrufs fortgesetzt. if (initPostDaylieStatsOnes) { LogMain("PostDaylieStats returned.", LogLevel.Debug); return; } initPostDaylieStatsOnes = true; Task.Run(async() => { while (true) { #region send msg when event is over CommandHeader _c2 = new CommandHeader(); SocketTextChannel textChannel; // Get actual time and time for trigger DateTime aktuelleZeit = DateTime.Now; DateTime triggerZeit = new DateTime(aktuelleZeit.Year, aktuelleZeit.Month, aktuelleZeit.Day, 13, 38, 00, 000); // get the time different to int in millisec int iTriggerZeit = Convert.ToInt32(triggerZeit.Subtract(aktuelleZeit).TotalMilliseconds); if (iTriggerZeit < 0) { triggerZeit = new DateTime(aktuelleZeit.Year, aktuelleZeit.Month, aktuelleZeit.Day, 13, 38, 00, 000).AddDays(1); iTriggerZeit = Convert.ToInt32(triggerZeit.Subtract(aktuelleZeit).TotalMilliseconds); } // sleep until the respons time is 13:38 each day Thread.Sleep(iTriggerZeit); // If 1337ChannelID is set if (_client.GetChannel(_c2.GetFeature1337ListenFromChannelID()) != null) { textChannel = (SocketTextChannel)_client.GetChannel(_c2.GetFeature1337ListenFromChannelID()); await textChannel.SendMessageAsync("Yaay <a:lilacxYayHyperGif:772468799454052392> Dankeschön fürs mitmachen! <a:lilacxHappyGIF:708754770008997968> Heute wurden ganze " + counterUserPerDay + " Meowies um 1337 gezählt. <a:poggers:684767963156709376>"); } // If Channel doesn't exist or 0 else if (_c2.GetFeature1337ListenFromChannelID() == 0 || _client.GetChannel(_c2.GetFeature1337ListenFromChannelID()) == null) { await _client.GetGuild(guild.Id).SystemChannel.SendMessageAsync("Yaay <a:lilacxYayHyperGif:772468799454052392> Dankeschön fürs mitmachen! <a:lilacxHappyGIF:708754770008997968> Heute wurden ganze " + counterUserPerDay + " Meowies um 1337 gezählt. <:Pog:655898145963900948>"); } counterUserPerDay = 0; #endregion #region Set Counter to 0 for ever User that fail on this day this.db = this.dbClass.connect(); TablesHeader dbTable = new TablesHeader(this.db); var table1337 = dbTable.Table1337; var twoDaysBeforDateTime = DateTime.Today.AddDays(-1); foreach (var item in table1337) { string[] lastDate = item.date_last.Split("."); DateTime lastDateTime = new DateTime(Convert.ToInt32(lastDate[2]), Convert.ToInt32(lastDate[1]), Convert.ToInt32(lastDate[0])); if (lastDateTime.Ticks <= twoDaysBeforDateTime.Ticks) { item.counter_streak = 0; LogMain("counter_streak für User " + item.username + " auf 0 gesetzt", LogLevel.Dev); } } try { dbTable.SubmitChanges(); LogMain("counter_streak wurden für jeden betroffenen User in Tabelle 1337 erfolgreich auf 0 gesetzt.", LogLevel.Dev); } catch (Exception e) { LogMain("Beim setzen von counter_streak in Tabelle 1337 ist ein Fehler aufgetretten.\n" + e, LogLevel.Error); } db.Close(); #endregion } }); #pragma warning restore CS4014 // Da auf diesen Aufruf nicht gewartet wird, wird die Ausführung der aktuellen Methode vor Abschluss des Aufrufs fortgesetzt. }
private async Task Message1337(SocketMessage rawMessage) { // Ignore system messages and messages from bots if (!(rawMessage is SocketUserMessage message)) { return; } if (message.Source != MessageSource.User) { return; } var context = new SocketCommandContext(this._client, message); bool check = _c.ReadChannel1337Listen(context); if (!check) { return; } // Get Time to Check if we are on right time and prepare the string for it string timeNowAsString = DateTime.Now.ToString(formatTime); string result = t.RemoveSpecificCharFromString(timeNowAsString, ':'); int timeNowAsInt = Convert.ToInt32(result); // check if message contains a mention and get this mention as id to string string rolles = " "; if (message.MentionedRoles.Count == 1) { foreach (var item in message.MentionedRoles) { if (item.Name == "1337") { rolles = item.Id.ToString(); } } } // Split Message and count every 1337 and @1337 string[] userMessage = message.Content.Split(' '); int counter1337 = 0; int counterM1337 = 0; // count foreach (var item in userMessage) { if (item == "1337") { counter1337++; } else if (item == "<@&" + rolles + ">") { counterM1337++; } } // check if message has 1337 or @1337 ones! if (counter1337 == 1 && counterM1337 != 1 || counter1337 != 1 && counterM1337 == 1) { //Check if it is the right time! 133700 - 133800 otherwise break if (!(133700 <= timeNowAsInt && 133800 >= timeNowAsInt)) { if (this._devMode) { await _c.SendTo1337ChannelAsync(context.Guild.GetUser(message.Author.Id).Mention + " Nicht in der richtigen Zeit!", context); } LogMain("1 " + context.Guild.GetUser(message.Author.Id).Username + " Nicht in der richtigen Zeit!", LogLevel.Log); return; } this.db = this.dbClass.connect(); TablesHeader dbTable = new TablesHeader(this.db); // select the curent users userid from database var table1337 = dbTable.Table1337; var userID = from table in table1337 where table.userid == message.Author.Id select table.userid; // Check if this user is in Database if (userID.Count() == 0) { // Add new User to Database if not exist Table1337 addNewUser = new Table1337() { userid = message.Author.Id, username = context.Guild.GetUser(message.Author.Id).Username, counter_all = 1, counter_streak = 1, counter_longest_streak = 1, date_begin = DateTime.Today.ToString(formatDate), date_last = DateTime.Today.ToString(formatDate) }; dbTable.Table1337.InsertOnSubmit(addNewUser); dbTable.SubmitChanges(); // Counts User for bot respons counterUserPerDay++; if (this._devMode) { await _c.SendTo1337ChannelAsync(context.Guild.GetUser(message.Author.Id).Mention + " Hab dich gezählt :P", context); } LogMain("2 " + context.Guild.GetUser(message.Author.Id).Username + " Hab dich gezählt :P ", LogLevel.Log); } else // Update user if allready exist { //get colum from current user by id var userID2 = from table in table1337 where table.userid == message.Author.Id select table; // temp variable for changes uint counter_allQ = 0; uint counter_streakQ = 0; uint counter_logest_streakQ = 0; string date_lastQ = " "; // get current data from user foreach (var item in userID2) { counter_allQ = item.counter_all; counter_streakQ = item.counter_streak + 1; counter_logest_streakQ = item.counter_longest_streak; date_lastQ = item.date_last; } if (date_lastQ != DateTime.Today.ToString(formatDate)) { // update counter longest streak if user got higher streak if (counter_streakQ > counter_logest_streakQ) { counter_logest_streakQ = counter_streakQ; } // get the user which should be updated by id var updateTable = dbTable.Table1337.Single((item) => item.userid == message.Author.Id); // update values for user updateTable.username = context.Guild.GetUser(message.Author.Id).Username; updateTable.counter_all = counter_allQ + 1; if (date_lastQ != DateTime.Today.AddDays(-1).ToString(formatDate)) { updateTable.counter_streak = 1; } else { updateTable.counter_streak = counter_streakQ; } // Muss noch angepasst werden | An Tag anpassen updateTable.counter_longest_streak = counter_logest_streakQ; updateTable.date_last = DateTime.Today.ToString(formatDate); // send data to database when SubmitChanges() is called. dbTable.SubmitChanges(); // Counts User for bot respons counterUserPerDay++; if (_devMode) { await _c.SendTo1337ChannelAsync(context.Guild.GetUser(message.Author.Id).Mention + " Hab dich gezählt :P", context); } LogMain("3 " + context.Guild.GetUser(message.Author.Id).Username + " Hab dich gezählt :P ", LogLevel.Log); } else { if (this._devMode) { await _c.SendTo1337ChannelAsync(context.Guild.GetUser(message.Author.Id).Mention + " Du wurdest heute schon gezählt. Schummeln gilt nicht!! <:pandabulle:327873024017563649>", context); } LogMain("4 " + context.Guild.GetUser(message.Author.Id).Username + " Du wurdest heute schon gezählt. Schummeln gilt nicht!! <:pandabulle:327873024017563649> ", LogLevel.Log); } } this.db.Close(); } }
public async Task Feature1337HighscoreAsync([Remainder] string args = null) { bool check = ReadChannel1337(); if (!check) { return; } if (args == null) { await SendTo1337ChannelAsync(Context.User.Mention + " Du hast zu wenige Argumente angegeben. Bitte nutze den Befehl wie folgt:\n>>> `" + Prefix + "1337highscore <Anzahl User (1-30)>`"); return; } args = args.ToLower(); string[] countArgs = args.Split(' '); int userCount = 0; try { userCount = Convert.ToInt32(countArgs[0]); } catch (Exception) { await SendTo1337ChannelAsync("<Anzahl User (1-30)> war keine Zahl!"); return; } if (userCount > 30) { userCount = 30; } if (userCount < 1) { await SendTo1337ChannelAsync(Context.User.Mention + "Was zum henker willst du mit weniger als 1 User sehen? o.O"); return; } if (countArgs.Length > 1) { await SendTo1337ChannelAsync(Context.User.Mention + " Zu viele Agumente!"); } else { var db = dbClass.connect(); TablesHeader dbTable = new TablesHeader(db); db.Close(); var streakQuery = from user in dbTable.Table1337 orderby user.counter_streak descending, user.username ascending select user; if (streakQuery.Count() == 0) { await SendTo1337ChannelAsync(Context.User.Mention + " Noch keine Daten vorhanden. "); return; } if (userCount > streakQuery.Count()) { await SendTo1337ChannelAsync("```Es gibt aktuell nur " + streakQuery.Count() + " Meowies in der Liste.``` <a:LilacxCryGif:708767296205881416>"); userCount = streakQuery.Count(); } List <Table1337> users = streakQuery.ToList(); for (int i = 0; i < users.Count; i++) { if (users.ElementAt(i).username.Length > 20) { users.ElementAt(i).username = t.ShortenString(users.ElementAt(i).username, 20); } } // Header List <string> sbList = new List <string>(); StringBuilder sb = new StringBuilder(); sb.AppendLine("```"); sb.Append('-', 31).Append("Highscore List").Append('-', 32).AppendLine(); sb.AppendFormat("|{0,4}|{1,14}|{2,22}|{3,11}|{4,10}|{5,10}\n", "Rank", "Counter Streak", "Counter Longest Streak", "Counter All", "Date Begin", "Date Last"); sbList.Add(sb.ToString()); // Index of sbList int index = 0; // Content for (int i = 0; i < userCount; i++) { sb = new StringBuilder(); sb.AppendLine("User: "******""); sb.AppendFormat("|{0,4}|{1,14}|{2,22}|{3,11}|{4,10}|{5,10}\n", i + 1, users.ElementAt(i).counter_streak.ToString(), users.ElementAt(i).counter_longest_streak.ToString(), users.ElementAt(i).counter_all.ToString(), users.ElementAt(i).date_begin, users.ElementAt(i).date_last ); // Check if String is less or equal 2000 - 3 (for the last 3 ```) if ((sbList[index].Length + sb.ToString().Length) <= (2000 - 3)) { sbList[index] += sb.ToString(); } // Add new string to sbList else { index++; string str = "```"; str = str + sb.ToString(); sbList.Add(str); } } // Add ``` on every string in sbList for (int i = 0; i < sbList.Count; i++) { sbList[i] += "```"; } // Post every string foreach (var item in sbList) { await SendTo1337ChannelAsync(item); } } }
public async Task Feature1337HCountAsync() { bool check = ReadChannel1337(); if (!check) { return; } var db = dbClass.connect(); TablesHeader dbTable = new TablesHeader(db); db.Close(); var streakQuery = from user in dbTable.Table1337 orderby user.counter_all descending, user.username ascending select user; List <Table1337> users = streakQuery.ToList(); for (int i = 0; i < users.Count; i++) { if (users.ElementAt(i).username.Length > 20) { users.ElementAt(i).username = t.ShortenString(users.ElementAt(i).username, 20); } } StringBuilder sb = new StringBuilder(); sb.AppendLine("```"); sb.Append('-', 8).Append("Highscore List Counter").Append('-', 9).AppendLine(); sb.AppendFormat("|{0,4}|{1,11}|{2,10}|{3,10}\n", "Rank", "Counter All", "Date Begin", "Date Last"); if (streakQuery.Count() < 10) { for (int i = 0; i < streakQuery.Count(); i++) { sb.AppendLine("User: "******""); sb.AppendFormat("|{0,4}|{1,11}|{2,10}|{3,10}", i + 1, users.ElementAt(i).counter_all.ToString(), users.ElementAt(i).date_begin, users.ElementAt(i).date_last ); sb.AppendLine(); } } else { for (int i = 0; i < 10; i++) { sb.AppendLine("User: "******""); sb.AppendFormat("|{0,4}|{1,11}|{2,10}|{3,10}", i + 1, users.ElementAt(i).counter_all.ToString(), users.ElementAt(i).date_begin, users.ElementAt(i).date_last ); sb.AppendLine(); } } sb.Append("```"); if (streakQuery.Count() == 0) { await SendTo1337ChannelAsync(Context.User.Mention + " Noch keine Daten vorhanden. "); return; } else { await SendTo1337ChannelAsync(sb.ToString()); } }
private async Task ShowUser(string args, ShowUserEnum su) { if (!ReadChannelGeneralAdmin()) { return; } if (ModRoleID == 0) { await SendToGeneralChannelAdminAsync("Die Mod rolle wurde noch nicht gesetzt, bitte dem SeverAdministrator bescheid geben!"); return; } if (args == null) { if (su == ShowUserEnum.Today) { await SendToGeneralChannelAdminAsync(Context.User.Mention + " Du hast zu wenige Argumente angegeben. Bitte nutze den Befehl wie folgt:\n>>> `" + Prefix + "showusertoday <UserID>`"); } else if (su == ShowUserEnum.Yesterday) { await SendToGeneralChannelAdminAsync(Context.User.Mention + " Du hast zu wenige Argumente angegeben. Bitte nutze den Befehl wie folgt:\n>>> `" + Prefix + "showuseryesterday <UserID>`"); } return; } args = args.ToLower(); string[] countArgs = args.Split(' '); if (countArgs.Length > 1) { await SendToGeneralChannelAdminAsync(Context.User.Mention + " Zu viele Agumente!"); } else { bool memberHasModRole = false; foreach (var item in Context.Guild.GetRole(ModRoleID).Members) { if (item.Id == Context.User.Id) { memberHasModRole = true; } } if (memberHasModRole || Context.Guild.GetUser(Context.User.Id).GuildPermissions.Administrator) { var db = new DatabaseInit().connect(); TablesHeader dbTable = new TablesHeader(db); Table1337 updateUserToday = new Table1337(); Table1337_2 updateUserYesterday = new Table1337_2(); try { // Check if UserID is number ulong userID = 0; try { userID = Convert.ToUInt64(countArgs[0]); } catch (Exception) { await SendToGeneralChannelAdminAsync("<UserID> war keine Zahl!"); return; } // Get User from Database if (su == ShowUserEnum.Today) { updateUserToday = dbTable.Table1337.Single((item) => item.userid == userID); } else if (su == ShowUserEnum.Yesterday) { updateUserYesterday = dbTable.Table1337_2.Single((item) => item.userid == userID); } } catch (Exception) { await SendToGeneralChannelAdminAsync("Es wurde kein User mit der ID: " + countArgs[0] + " gefunden"); return; } if (su == ShowUserEnum.Today) { await SendToGeneralChannelAdminAsync("User Informationen\n" + ">>> Name: `" + updateUserToday.username + "`\n" + "ID: `" + updateUserToday.userid.ToString() + "`\n" + "Counter Streak: `" + updateUserToday.counter_streak + "`\n" + "Counter Longest Streak: `" + updateUserToday.counter_longest_streak + "`\n" + "Counter All: `" + updateUserToday.counter_all + "`\n" + "Date Begin: `" + updateUserToday.date_begin + "`\n" + "Date Last: `" + updateUserToday.date_last + "`"); } else if (su == ShowUserEnum.Yesterday) { await SendToGeneralChannelAdminAsync("User Informationen\n" + ">>> Name: `" + updateUserYesterday.username + "`\n" + "ID: `" + updateUserYesterday.userid.ToString() + "`\n" + "Counter Streak: `" + updateUserYesterday.counter_streak + "`\n" + "Counter Longest Streak: `" + updateUserYesterday.counter_longest_streak + "`\n" + "Counter All: `" + updateUserYesterday.counter_all + "`\n" + "Date Begin: `" + updateUserYesterday.date_begin + "`\n" + "Date Last: `" + updateUserYesterday.date_last + "`"); } } else { await SendToGeneralChannelAdminAsync("Du hast keine Berechtigung. Du musst im besitz der `" + Context.Guild.GetRole(ModRoleID).Name + "` Rolle sein."); } } }
public async Task countuser(SocketGuildUser user) { if (!ReadChannelGeneralAdmin()) { return; } if (ModRoleID == 0) { await SendToGeneralChannelAdminAsync("Die Mod rolle wurde noch nicht gesetzt, bitte dem SeverAdministrator bescheid geben!"); return; } string formatDate = "dd.MM.yyyy"; SQLiteConnection db = this.dbClass.connect(); TablesHeader dbTable = new TablesHeader(db); // select the curent users userid from database var table1337 = dbTable.Table1337; var userID = from table in table1337 where table.userid == user.Id select table.userid; if (userID.Count() == 0) { // Add new User to Database if not exist Table1337 addNewUser = new Table1337() { userid = user.Id, username = user.Username, counter_all = 1, counter_streak = 1, counter_longest_streak = 1, date_begin = DateTime.Today.ToString(formatDate), date_last = DateTime.Today.ToString(formatDate) }; dbTable.Table1337.InsertOnSubmit(addNewUser); dbTable.SubmitChanges(); await SendToGeneralChannelAdminAsync(user.Username + " gezählt und neu in der Datenbank angelegt."); } else { var userID2 = from table in table1337 where table.userid == user.Id select table; // temp variable for changes uint counter_allQ = 0; uint counter_streakQ = 0; uint counter_logest_streakQ = 0; string date_lastQ = " "; // get current data from user foreach (var item in userID2) { counter_allQ = item.counter_all; counter_streakQ = item.counter_streak + 1; counter_logest_streakQ = item.counter_longest_streak; date_lastQ = item.date_last; } // update counter longest streak if user got higher streak if (counter_streakQ > counter_logest_streakQ) { counter_logest_streakQ = counter_streakQ; } // get the user which should be updated by id var updateTable = dbTable.Table1337.Single((item) => item.userid == user.Id); // update values for user updateTable.username = user.Username; updateTable.counter_all = counter_allQ + 1; if (date_lastQ != DateTime.Today.AddDays(-1).ToString(formatDate)) { updateTable.counter_streak = 1; } else { updateTable.counter_streak = counter_streakQ; } // Muss noch angepasst werden | An Tag anpassen updateTable.counter_longest_streak = counter_logest_streakQ; updateTable.date_last = DateTime.Today.ToString(formatDate); // send data to database when SubmitChanges() is called. dbTable.SubmitChanges(); await SendToGeneralChannelAdminAsync(user.Username + " gezählt."); } db.Close(); }
public async Task ModulsAsync([Remainder] string args = null) { // Check if right Channel bool check = ReadChannelGeneralAdmin(); if (!check) { return; } // If Mod Role not Set if (ModRoleID == 0) { await SendToGeneralChannelAdminAsync("Die Mod rolle wurde noch nicht gesetzt, bitte dem SeverAdministrator bescheid geben!"); return; } if (args == null) { await SendToGeneralChannelAdminAsync(Context.User.Mention + " Du hast zu wenige Argumente angegeben. Bitte nutze den Befehl wie folgt:\n>>> `" + Prefix + "edituser <UserID> <Counter_Streak> <Counter_Highest_Streak> <CounterAll> <Last_Date>` \n" + "**BITTE BEACHTEN**: `<Last_Date>` **MUSS** im Format `DD.MM.YYYY` angegeben werden. Eine falsche Formation **WIRD** zu Fehlern bei den nächsten Zählungen führen!"); return; } args = args.ToLower(); string[] countArgs = args.Split(' '); // Check if to less or much Arguments if (countArgs.Length < 5) { await SendToGeneralChannelAdminAsync(Context.User.Mention + " Zu wenige Agumente!"); } else if (countArgs.Length > 5) { await SendToGeneralChannelAdminAsync(Context.User.Mention + " Zu viele Agumente!"); } else { // Check if Member has ModRole bool memberHasModRole = false; foreach (var item in Context.Guild.GetRole(ModRoleID).Members) { if (item.Id == Context.User.Id) { memberHasModRole = true; } } // User is Mod or Admin if (memberHasModRole || Context.Guild.GetUser(Context.User.Id).GuildPermissions.Administrator) { var db = new DatabaseInit().connect(); TablesHeader dbTable = new TablesHeader(db); var table1337 = dbTable.Table1337; Table1337 updateUser; try { // Check if UserID is number ulong userID = 0; try { userID = Convert.ToUInt64(countArgs[0]); } catch (Exception) { await SendToGeneralChannelAdminAsync("<UserID> war keine Zahl!"); return; } // Get User from Database updateUser = dbTable.Table1337.Single((item) => item.userid == userID); } catch (Exception) { await SendToGeneralChannelAdminAsync("Es wurde kein User mit der ID: " + countArgs[0] + " gefunden"); return; } // Check If args are Numbers // <Counter_Streak> try { updateUser.counter_streak = Convert.ToUInt32(countArgs[1]); } catch (Exception e) { await SendToGeneralChannelAdminAsync("Meow:\n" + e); await SendToGeneralChannelAdminAsync("<Counter_Streak> war keine Positive Zahl!"); return; } // <Counter_Highest_Streak> try { updateUser.counter_longest_streak = Convert.ToUInt32(countArgs[2]); } catch (Exception) { await SendToGeneralChannelAdminAsync("<Counter_Highest_Streak> war keine Positive Zahl!"); return; } try { updateUser.counter_all = Convert.ToUInt32(countArgs[3]); } catch (Exception) { await SendToGeneralChannelAdminAsync("<CounterAll> war keine Positive Zahl!"); return; } updateUser.date_last = countArgs[4]; dbTable.SubmitChanges(); db.Close(); await SendToGeneralChannelAdminAsync("User: "******" wurde erfolgreich Editiert\n" + "Seine neuen Werte lauten wie Folgt:\n" + ">>> Counter Streak: `" + countArgs[1] + "`\n" + "Counter Longest Streak: `" + countArgs[2] + "`\n" + "Counter Alltime: `" + countArgs[3] + "`\n" + "Date Last: `" + countArgs[4] + "`"); LogMain("User: "******" wurde von " + Context.User.Username + " mit der ID " + Context.User.Id + " editiert.", LogLevel.Warning); } else { await SendToGeneralChannelAdminAsync("Du hast keine Berechtigung. Du musst im besitz der `" + Context.Guild.GetRole(ModRoleID).Name + "` Rolle sein."); } } }