Example #1
0
        public async Task LinksAsync()
        {
            var channel = Context.Channel;
            var user    = Context.User;
            await Context.Message.DeleteAsync();

            TimeSpan last       = Cooldowns.GetLinksLast();
            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("GTA5Police Links", References.GetGta5policeLogo());
                embed.Description = "Useful GTA5Police links for you.\n**Teamspeak IP: gta5police.com**";
                embed.WithThumbnailUrl(References.GetGta5policeLogo());
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Website", Value = References.GetWebsiteURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Dashboard", Value = References.GetDashboardURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Forums", Value = References.GetForumsURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Support", Value = References.GetSupportURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Suggestions", Value = References.GetSuggestionsURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Donations", Value = References.GetDonateURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Vacbanned - For Steam Hex", Value = References.GetVacbannedURL()
                });
                embed.AddField(new EmbedFieldBuilder()
                {
                    Name = "Greggs", Value = "https://www.greggs.co.uk/"
                });
                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", "Links command was used by " + user + "."));

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