Esempio n. 1
0
        public async Task ClearCachAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

            TimeSpan last       = Cooldowns.GetClearcacheLast();
            TimeSpan current    = DateTime.Now.TimeOfDay;
            double   difference = current.TotalSeconds - last.TotalSeconds;

            if (difference >= Cooldowns.GetCommandCooldown() || difference < 0)
            {
                var embed = new EmbedBuilder()
                {
                    Color = Colours.generalCol
                };
                embed.WithAuthor("How to clear your cache 101", References.GetGta5policeLogo());
                embed.WithUrl(References.GetClearcacheURL());
                embed.Title       = "Click here to learn how!";
                embed.Description = "Clearing your FiveM cache will help with many errors. This includes resources not loading, graphical issues and fps issues.";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.WithFooter("Requested by " + Context.User);
                embed.WithCurrentTimestamp();

                var message = await Context.Channel.SendMessageAsync("", false, embed);

                //await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown());

                await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Clearcache command was used by " + user + "."));

                Cooldowns.SetClearcacheLast(current);
                Statistics.AddOutgoingMessages();
            }
            else
            {
                await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol);
            }
        }