Beispiel #1
0
        public static Embed GetEmbedMessage(string messageTitle, string fieldTitle, string fieldContents, SocketUser user, EmbedFooterBuilder fb = null)
        {
            EmbedBuilder eb = new EmbedBuilder();

            if (user != null)
            {
                if (fb == null && user != null)
                {
                    fb = new EmbedFooterBuilder();
                    fb.WithText(PremiumUtils.SelectFooterEmbedText(user));;
                    fb.WithIconUrl(user.GetAvatarUrl());
                }

                eb.WithTitle($"{messageTitle}");
                eb.AddField($"{fieldTitle}", $"{fieldContents}");


                eb.WithColor(PremiumUtils.SelectEmbedColour(user));
                eb.WithFooter(fb);

                return(eb.Build());
            }
            else
            {
                eb.WithTitle($"{messageTitle}");
                eb.AddField($"{fieldTitle}", $"{fieldContents}");


                eb.WithColor(Color.Red);
                eb.WithFooter(fb);

                return(eb.Build());
            }
        }
Beispiel #2
0
        public async Task MainAsync()
        {
            _client   = new DiscordSocketClient();
            _commands = new CommandService();
            _services = ConfigureServices();

            //Add all required EventHandlers
            _client.Log               += Log;
            _client.JoinedGuild       += GuildJoinedHandler;
            _client.LeftGuild         += GuildLeftHandler;
            _client.Ready             += _client_Ready;
            _commands.CommandExecuted += _commands_CommandExecuted;

            //Installs all command modules
            await InstallCommandsAsync();

            //Loads the bot token from the token config file
            var token = File.ReadAllText("Config/token.cfg");

            //Logs in to the bot account and starts the client
            await _client.LoginAsync(TokenType.Bot, token);

            await _client.StartAsync();

            //Loads various stored data
            PremiumUtils.LoadRanks();
            TeamUtils.teamData     = TeamUtils.LoadTeams();
            TeamUtils.userSettings = TeamUtils.LoadSettings();
            GuildUtils.guildData   = GuildUtils.LoadSettings();

            //Loads the Top.GG API key from the topggToken config file
            LoggingUtils.apiKey = File.ReadAllText("Config/topggToken.cfg");

            await Task.Delay(-1);
        }
Beispiel #3
0
        public static EmbedFooterBuilder GetFooter(SocketUser user, Stopwatch sw)
        {
            EmbedFooterBuilder fb = new EmbedFooterBuilder();

            fb.WithText(PremiumUtils.SelectFooterEmbedText(user, sw));
            fb.WithIconUrl(user.GetAvatarUrl());

            return(fb);
        }