private async Task TriggerBadArgEmbed(string commandExecuted, SocketCommandContext context, string finalPrefix) { EmbedService embedService = Provider.GetService <EmbedService>(); CommandInfo cmd = Commands.FindInfoByName(commandExecuted); if (cmd.Parameters.Count == 0) { await context.Channel.SendMessageAsync("", embed : Provider.GetService <EmbedService>().MakeFailFeedbackEmbed("That command takes no arguments."), lifeTime : Config.FeedbackMessageLifeTime); return; } EmbedBuilder badArgEmbed = new EmbedBuilder(); string errorString = $"You used the wrong amount of arguments.\nCheck below for the correct syntax.\n\n{finalPrefix}{cmd.Name.Bold()}\n"; embedService.BuildFailEmbed(badArgEmbed); badArgEmbed.AppendEmbedDescription(errorString); foreach (var arg in cmd.Parameters) { badArgEmbed.AddField(x => { x.Name = $"{arg.Name} - {arg.Type.ToString().Bold()}{(arg.IsOptional ? " - Optional" : "")}"; x.Value = arg.Summary; }); } await context.Channel.SendMessageAsync("", embed : badArgEmbed, lifeTime : Config.FeedbackMessageLifeTime); }
public MagickModule(HttpService httpService, ImageService imageService, EmbedService embedService, Config config) { HttpService = httpService; ImageService = imageService; EmbedService = embedService; Config = config; }
public VoiceModule(AudioService audioService, EmbedService embedService, Config config, MathService mathService) : base(mathService) { AudioService = audioService; EmbedService = embedService; MathService = mathService; Config = config; }
public ImageModule(HttpService httpService, ImageService imageService, EmbedService embedService, MathService mathService, Config config) : base(mathService) { HttpService = httpService; ImageService = imageService; EmbedService = embedService; Config = config; }
public async Task SystemFrontPercent([Remainder] string durationStr = "30d") { var system = ContextEntity ?? Context.SenderSystem; if (system == null) { throw Errors.NoSystemError; } var now = SystemClock.Instance.GetCurrentInstant(); var rangeStart = PluralKit.Utils.ParseDateTime(durationStr); if (rangeStart == null) { throw Errors.InvalidDateTime(durationStr); } if (rangeStart.Value.ToInstant() > now) { throw Errors.FrontPercentTimeInFuture; } var frontpercent = await Switches.GetPerMemberSwitchDuration(system, rangeStart.Value.ToInstant(), now); await Context.Channel.SendMessageAsync(embed : await EmbedService.CreateFrontPercentEmbed(frontpercent, system.Zone)); }
public Member(EmbedService embeds, HttpClient client, DispatchService dispatch) { _embeds = embeds; _client = client; _dispatch = dispatch; }
public BetCommands(IBetRepository betRepository, IPlacedUserBetRepository placedUserBetRepository, EmbedService embedService, IBetUserRepository betUserRepository) { _betRepository = betRepository; _placedUserBetRepository = placedUserBetRepository; _embedService = embedService; _betUserRepository = betUserRepository; }
public AdminModule(CommandService commandService, MathService mathService, EmbedService embedService, ExecuteService executeService, Config config) : base(mathService) { CommandService = commandService; EmbedService = embedService; ExecuteService = executeService; Config = config; }
public ReflinksCommands(IRefUserRepository refUserRepository, EmbedService embedService, IRefExchangeRepository refExchangeRepository, IReflinkRepository reflinkRepository) { _refUserRepository = refUserRepository; _embedService = embedService; _refExchangeRepository = refExchangeRepository; _reflinkRepository = reflinkRepository; }
public MemberCommands(SystemStore systems, MemberStore members, EmbedService embeds, ProxyCacheService proxyCache) { _systems = systems; _members = members; _embeds = embeds; _proxyCache = proxyCache; }
public MashapeModule(EmbedService embedService, HttpService httpService, MathService mathService, Config config) : base(mathService) { EmbedService = embedService; HttpService = httpService; MathService = mathService; Config = config; }
public SystemCommands(SystemStore systems, MemberStore members, SwitchStore switches, EmbedService embeds, ProxyCacheService proxyCache) { _systems = systems; _members = members; _switches = switches; _embeds = embeds; _proxyCache = proxyCache; }
public SubscriptionsModule(DBContextFactory factory, EmbedService embedService, Config config, CNNService cnnService, RedditService redditService, MathService mathService) : base(mathService) { DBFactory = factory; EmbedService = embedService; Config = config; CNNService = cnnService; RedditService = redditService; }
public PriceCheckCommands(IMiraiexAPIService miraiexService, EmbedService embedService, ICoinGeckoAPIService coinGeckoAPI, INBXAPIService nBXAPIService, IOptions <ExchangesConfiguration> options) { _miraiexService = miraiexService; _embedService = embedService; _coinGeckoAPI = coinGeckoAPI; _nBXAPIService = nBXAPIService; _options = options.Value; }
public TickerCheckCommands(IMiraiexAPIService miraiexService, EmbedService embedService, INBXAPIService nBXAPIService, IBitmyntAPIService bitmyntAPIService, IOptions <ExchangesConfiguration> options) { _miraiexService = miraiexService; _embedService = embedService; _nBXAPIService = nBXAPIService; _bitmyntAPIService = bitmyntAPIService; _options = options.Value; }
public PowerBiController(EmbedService embedService, ExportService exportService, IMemoryCache cache, ILogger<PowerBiController> logger) { this.embedService = embedService; this.exportService = exportService; // Get service cache this.cache = cache; this.logger = logger; }
public StatsModule(EmbedService embedService, Config config, TrackingService trackingService, MathService mathService, ImageService imageService, DBContextFactory dbFactory) : base(mathService) { EmbedService = embedService; Config = config; TrackingService = trackingService; MathService = mathService; ImageService = imageService; DBFactory = dbFactory; }
public DataModule(HttpService httpService, EmbedService embedService, TrackingService trackingService, ImageService imageService, DBContextFactory dbFactory, Config config, MathService mathService) : base(mathService) { HttpService = httpService; EmbedService = embedService; TrackingService = trackingService; ImageService = imageService; DBFactory = dbFactory; Config = config; }
public Misc(BotConfig botConfig, IMetrics metrics, CpuStatService cpu, ShardInfoService shards, IDataStore data, EmbedService embeds) { _botConfig = botConfig; _metrics = metrics; _cpu = cpu; _shards = shards; _data = data; _embeds = embeds; }
public LearnModule(ContextService contextService, EmbedService embeds, LearnModuleService learnService, ClientService clientService) { _contextService = contextService; _embeds = embeds; _learnService = learnService; _clientService = clientService; }
public LearnModuleService(ContextService contextService, EmbedService embeds, LearnModuleParserService parserService, LearnModuleFilterService filterService) { _contextService = contextService; _embeds = embeds; _parserService = parserService; _filterService = filterService; }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { try { log.LogInformation("Power BI Report Token Requested"); // string reportId = "0c94ccca-55f8-4cd8-95c4-2ce136ec5e22"; string reportId = req.Query["reportid"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); reportId = reportId ?? data?.reportId; log.LogInformation("reportId: " + reportId); if (!String.IsNullOrWhiteSpace(reportId)) { string username = null; string roles = null; IEmbedService m_embedService = new EmbedService(); var embedResult = await m_embedService.EmbedReport(username, roles, reportId); if (embedResult) { ResultJson resultJson = new ResultJson() { EmbedToken = m_embedService.EmbedConfig.EmbedToken.Token, EmbedUrl = m_embedService.EmbedConfig.EmbedUrl, ReportId = reportId }; string resultString = JsonConvert.SerializeObject(resultJson); return((ActionResult) new OkObjectResult(resultString)); } else { return((ActionResult) new BadRequestObjectResult("Could not generate a token.")); } } else { return((ActionResult) new BadRequestObjectResult("Report Id is empty or null.")); } } catch (Exception ex) { log.LogInformation("Exception: " + ex.ToString()); return((ActionResult) new BadRequestObjectResult("An Exception has occurred.")); } } // Run
public LogChannelService(EmbedService embed, ILogger logger, IDatabase db, ModelRepository repo, IDiscordCache cache, DiscordApiClient rest, Bot bot) { _embed = embed; _db = db; _repo = repo; _cache = cache; _rest = rest; _bot = bot; _logger = logger.ForContext <LogChannelService>(); }
public async Task UpdateOneEmbed(SaasafrasGoogleDriveService saasyDrive, Embed embed, List <Embed> embeds, string subfolderId, Podio podio, RoutedPodioEvent e) { try { var id = saasyDrive.GetFileId(embed.OriginalUrl); var original = await saasyDrive.GetFileMicro(id, "name, parents"); if (original.Parents == null) { original.Parents = new List <string>(); } Console.WriteLine($"{e.podioEvent.item_id} - Old File ID: {original.Id}, Name: {original.Name}"); original.Parents.Clear(); original.Parents.Add(subfolderId); original.Name = e.environmentId + " " + original.Name; var clone = await saasyDrive.CopyFile(id); var permissionsAdded = await saasyDrive.SetPermissions(id, "writer", "anyone"); await Task.Run(() => { var embedServ = new EmbedService(podio);; Console.WriteLine($"{e.podioEvent.item_id} - CloneID: {clone.Id}"); //runs 130x approx var waitSeconds = 5; CallPodio: Embed em; try { em = embedServ.AddAnEmbed(clone.WebViewLink).Result; } catch (PodioUnavailableException ex) { Console.WriteLine($"{ex.Message}"); Console.WriteLine($"Trying again in {waitSeconds} seconds."); for (var i = 0; i < waitSeconds; i++) { System.Threading.Thread.Sleep(1000); Console.WriteLine("."); } waitSeconds *= 2; goto CallPodio; } //Console.WriteLine($"{e.podioEvent.item_id} - WebViewLink: {clone.WebViewLink}"); embeds.Add(em); }); } catch (Exception ex) { Console.WriteLine($"{e.podioEvent.item_id} - {ex.Message} - {ex.StackTrace} - {ex.InnerException}"); } }
public ProxiedMessage(EmbedService embeds, IClock clock, DiscordApiClient rest, WebhookExecutorService webhookExecutor, LogChannelService logChannel, IDiscordCache cache) { _embeds = embeds; _clock = clock; _rest = rest; _webhookExecutor = webhookExecutor; _logChannel = logChannel; // _cache = cache; }
public async Task StatusAsync( ) { foreach (var monitor in MonitorService.Monitors.Values) { var embed = EmbedService.GetEmbed(monitor.Port); if (embed != null) { await Context.User.SendMessageAsync(embed : embed); } } }
public ProxiedMessage(EmbedService embeds, DiscordApiClient rest, IMetrics metrics, ModelRepository repo, ProxyService proxy, WebhookExecutorService webhookExecutor, LogChannelService logChannel, IDiscordCache cache) { _embeds = embeds; _rest = rest; _webhookExecutor = webhookExecutor; _repo = repo; _logChannel = logChannel; // _cache = cache; _metrics = metrics; _proxy = proxy; }
public async Task Invite(CommandContext ctx) { await ctx.TriggerTypingAsync(); var embed = EmbedService.GetBaseEmbed(Discord, ctx: ctx); embed.Title = "Awe, you want me to come with you?\n" + "Let's go!"; embed.WithThumbnail(new Uri("https://imgflip.com/s/meme/Happy-Guy-Rage-Face.jpg")); embed.WithUrl( "https://discord.com/oauth2/authorize?client_id=747611613569220660&scope=bot&permissions=268499969"); await ctx.RespondAsync(embed : embed); }
public async Task Query(PKSystem system = null) { if (system == null) { system = Context.SenderSystem; } if (system == null) { throw Errors.NoSystemError; } await Context.Channel.SendMessageAsync(embed : await EmbedService.CreateSystemEmbed(system)); }
public ActionResult Index() { try { var settingsGroupId = Request.QueryString["sid"]; if (string.IsNullOrEmpty(settingsGroupId)) { var defaultPbiSettingsGroupId = (string)ModuleContext.Settings["PowerBIEmbedded_SettingsGroupId"]; var pbiSettings = SharedSettingsRepository.Instance.GetSettings(ModuleContext.PortalId).RemoveUnauthorizedItems(User); if (!string.IsNullOrEmpty(defaultPbiSettingsGroupId) && pbiSettings.Any(x => x.SettingsGroupId == defaultPbiSettingsGroupId)) { settingsGroupId = defaultPbiSettingsGroupId; } else { settingsGroupId = pbiSettings.FirstOrDefault(x => !string.IsNullOrEmpty(x.SettingsGroupId))?.SettingsGroupId; } } var embedService = new EmbedService(ModuleContext.PortalId, ModuleContext.TabModuleId, settingsGroupId); var model = embedService.GetContentListAsync(ModuleContext.PortalSettings.UserId).Result; if (model != null) { // Remove other culture contents model = model.RemoveOtherCultureItems(); // Remove the objects without permissions model = model.RemoveUnauthorizedItems(User); // Sets the reports page on the viewbag var reportsPage = embedService.Settings.ContentPageUrl; if (!reportsPage.StartsWith("http")) { reportsPage = Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias) + reportsPage; } ViewBag.ReportsPage = reportsPage; ViewBag.SettingsGroupId = settingsGroupId; return(View(model)); } return(View()); } catch (Exception ex) { Logger.Error(ex); return(View()); } }