public DefaultRoleAssigner(BaseUser user, BaseServer server) { var roleConfig = DefaultRoleConfig.Get(server); if (roleConfig != null && roleConfig.DefaultRole != null && roleConfig.DefaultRole != "") { user.GiveRole(server.FindRoleById(roleConfig.DefaultRole)); } }
public override void Execute() { if (!user.IsAdmin()) { channel.SendMessage("You cant' do this, " + user.GetNickname() + "..."); return; } if (args.Length > 0) { var role = server.FindRoleByName(argsString); if (role == null) { channel.SendMessage("I can't find that role."); return; } var roleConfig = DefaultRoleConfig.Get(server); if (roleConfig != null) { roleConfig.DefaultRole = role.GetId(); DefaultRoleConfig.Set(roleConfig, server); channel.SendMessage("The default role is now " + role.GetName() + "."); } else { channel.SendMessage("Failed to get config."); } return; } DefaultRoleConfig.Delete(server); channel.SendMessage("The default role is now @everyone."); }