public async Task BanIp(CommandContext ctx, [RemainingText] string ipAddress) { await ctx.TriggerTypingAsync(); Network.RegisterInvalidLogin(ipAddress); await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed("Added invalid login for IP " + ipAddress)); }
public async Task LinkServiceTask(CommandContext ctx) { var user = await AccountsService.GetUser(ctx); var service = await DiscordService.LinkService(ctx, user); await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed(service.Name, "Link Successful!")); }
public Task LogoutUser(CommandContext ctx, DiscordMember discordMember) { var user = AccountsService.GetUser(discordMember.Id); AccountsService.LogoutUser(user, discordMember.Id); return(ctx.RespondAsync( embed: EmbedTemplates.CreateSuccessEmbed( description: $"**{user.FullName} has been unlinked and logged out."))); }
public override async Task DoAction() { await base.DoAction(); var service = Authentication.Service; service.Start("Started by Nexus."); var embed = EmbedTemplates.CreateSuccessEmbed($"{service.NameNoHtml}", "**Started successfully**"); await CommandContext.RespondAsync(embed : embed); }
public async Task GetVariable(CommandContext ctx, int userId, string variableName) { await ctx.TriggerTypingAsync(); var user = new User(userId); var userCustomField = user.CustomFields[variableName]; await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed($"GetVariable for {user.UserName}", $"VariableName `{variableName}` value is {userCustomField}")); }
public Task LogoutUser(CommandContext ctx, string username) { var user = User.GetUserByUserName(username); user.AppData.RemoveValue("OAUTH::Discord"); user.Save(); return(ctx.RespondAsync( embed: EmbedTemplates.CreateSuccessEmbed( description: $"**{user.FullName} has been unlinked and logged out."))); }
public async Task UnlinkServices(CommandContext ctx) { var msg = await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed("Unlink Services", "Unlinking all services. Please wait...")); DiscordService.ResetAllServices(ctx); await msg.ModifyAsync( embed : new Optional <DiscordEmbed>( EmbedTemplates.CreateSuccessEmbed(description: "Unlinked all services."))); }
public async Task SetVariable(CommandContext ctx, int userId, string variableName, string variableValue) { await ctx.TriggerTypingAsync(); var user = new User(userId); user.CustomFields[variableName] = variableValue; user.Save(); await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed($"SetVariable for {user.UserName}", $"VariableName `{variableName}` value set to {variableValue}")); }
public override async System.Threading.Tasks.Task DoAction() { await base.DoAction(); var service = Authentication.Service; service.Stop("Stopped by Nexus."); // await CommandContext.RespondAsync($"**{service.NameNoHtml} has been stopped**"); var embed = EmbedTemplates.CreateSuccessEmbed($"{service.NameNoHtml}", "**Stopped successfully**"); await CommandContext.RespondAsync(embed : embed); }
public async Task RestartMonitor(CommandContext ctx, string serverName) { if (!(Server.GetServers(true, serverName)[0] is Server server)) { await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Server Not Found", $"{serverName} could not be found.")); return; } server.ServerUtilitiesService.RestartMonitor(); await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed("Monitor Restart", $"{server.Name}'s monitor is restarting.")); }
public async Task ForceLinkService(CommandContext ctx, int serviceId) { await ctx.Message.DeleteAsync(); if (DiscordService.LinkService(ctx.Guild.Id, serviceId)) { await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed(description: "**Linked Service**")); } else { await ctx.RespondAsync( embed : EmbedTemplates.CreateErrorEmbed(description: "**Failed to link service**")); } }
public async Task SignOut(CommandContext ctx) { var user = AccountsService.GetUser(ctx.User.Id); if (user == null) { await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Logout", "**You have to be signed in, in order to logout.**")); return; } AccountsService.LogoutUser(user, ctx.User.Id); await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed("Logout", "**You have been logged out**")); }
public async Task LoginAs(CommandContext ctx, string username) { var user = User.GetUserByUserName(username); if (!user.Find()) { await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Login As", "Cannot find user")); return; } AccountsService.AddUserToEmulation(ctx.User.Id, user); await ctx.RespondAsync( embed : EmbedTemplates.CreateSuccessEmbed(description: "Logged in as " + user.UserName)); }
public async Task EmulateAs(CommandContext ctx, DiscordMember member) { var user = AccountsService.GetUser(member.Id); if (user == null || !user.Find()) { await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed(description: "User not found")); return; } AccountsService.AddUserToEmulation(ctx.User.Id, user); await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed( description: $"You are now emulating as: {member.Username}#{member.Discriminator} ({user.UserName})")); }
public async Task DownloadFile(FileInfo file) { var server = new Server(Service.ServerId); var directorySecurity = new TCAdmin.SDK.VirtualFileSystem.VirtualDirectorySecurity { Permissions = Permission.Read | Permission.Write | Permission.Delete, PermissionType = PermissionType.Root, RelativeExecutable = Strings.ReplaceCaseInsensitive(Service.Executable, Service.RootDirectory, string.Empty), VirtualDirectoryName = Service.ConnectionInfo, RootPhysicalPath = Service.RootDirectory, RealPhysicalPath = TCAdmin.SDK.Misc.FileSystem.FixAbsoluteFilePath(Service.RootDirectory, server.OperatingSystem), ServerId = server.ServerId }; var download = new RemoteDownload(server) { DirectorySecurity = directorySecurity, FileName = file.FullName }; if (file.Length / 1024 > 8) { await CommandContext.RespondAsync( embed : EmbedTemplates.CreateSuccessEmbed( $"[<{download.GetDownloadUrl()}>](**Click here to download {file.Name}**)")); } else { using (var client = new WebClient()) { client.DownloadFileCompleted += delegate { CommandContext.RespondWithFileAsync(file.Name); }; client.DownloadFileAsync(new Uri(download.GetDownloadUrl()), file.Name); } } await Task.Delay(3000); File.Delete(file.Name); }
public Task EmulateAs(CommandContext ctx) { AccountsService.RemoveUserFromEmulation(ctx.User.Id); return(ctx.RespondAsync(embed: EmbedTemplates.CreateSuccessEmbed(description: "Emulation Stopped"))); }