public async Task SetOrViewTeacher([Remainder] string name) { var clas = Classes.Values.FirstOrDefault(x => x.Name == name); if (clas == null) { await ReplyAsync("Unknown class name: `" + name + "`"); } else { var tgcUser = TheGrandCodingGuild.GetUser(Context.User.Id); if (string.IsNullOrWhiteSpace(name)) { if (tgcUser.GuildPermissions.Administrator) { await ReplyAsync("Next message will set the name of the teacher."); var nxt = await NextMessageAsync(timeout : TimeSpan.FromSeconds(30)); if (nxt != null && !string.IsNullOrWhiteSpace(nxt.Content)) { clas.Teacher = nxt.Content; await ReplyAsync("", false, clas.ToEmbed()); } else { await ReplyAsync("Cancelled."); } } else { await ReplyAsync("Class has no teacher set."); } } else { await ReplyAsync("Class information:", false, clas.ToEmbed()); if (tgcUser.GuildPermissions.Administrator) { await ReplyAsync("Next message will set the name of the teacher."); var nxt = await NextMessageAsync(timeout : TimeSpan.FromSeconds(30)); if (nxt != null && !string.IsNullOrWhiteSpace(nxt.Content)) { clas.Teacher = nxt.Content; await ReplyAsync("", false, clas.ToEmbed()); } else { await ReplyAsync("Cancelled."); } } } } }
protected override void BeforeExecute(CommandInfo command) { var usr = TheGrandCodingGuild.GetUser(Context.User.Id); var tgcUser = FourAcesCasino.GetTGCUser(usr); Self = tgcUser; if (Self.User.Guild.Id != TheGrandCodingGuild.Id) { LogMsg("Invalid guild for Self TGC user " + Self.User.Guild.Name); Self.User = TheGrandCodingGuild.GetUser(Self.User.Id); } if (command.Name.StartsWith("toggle ")) { if (Self.Blocked_Toggle_By != 0) { } } base.BeforeExecute(command); }