Exemple #1
0
        public EmbedResponse PingCommand()
        {
            EmbedResponse.Builder builder = new EmbedResponse.Builder(EmbedResponseTemplate.Empty);
            builder.SetTitle("Awaiting...");
            EmbedResponse response = builder.Build();

            response.metadata       = ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
            response.onResponseSent = OnPongSent;
            return(response);
        }
Exemple #2
0
        public EmbedResponse GetUrl(UserEmbedDetails userEmbeddetails)
        {
            var response = new EmbedResponse();

            if (userEmbeddetails.EmbedSecret == _globalAppSettings.EmbedDetails.EmbedSecret)
            {
                var        adminToken    = new DashboardModel().GetToken();
                ServerUser userDetails   = new UserManagement().VadidateUser(userEmbeddetails.UserEmail, userEmbeddetails);
                var        credentials   = userEmbeddetails.Credentials;
                string     timeStamp     = DateTime.Now.ToString();
                var        secretToken   = "DatasourceMode=" + userEmbeddetails.DatasourceMode + "&Credentials=" + credentials + "&Timestamp=" + timeStamp;
                var        encryptedText = DoEncryption(secretToken);
                response.Url     = _globalAppSettings.EmbedDetails.BaseUrl + "?useremail=" + userEmbeddetails.UserEmail + "&token=" + encryptedText;
                response.Message = "Success";
            }
            else
            {
                response.Message = "Embed secret validation failed";
                response.Url     = string.Empty;
            }
            return(response);
        }
 private async Task ModifyAsync(EmbedResponse embedResponse)
 {
     await message.ModifyAsync((mp) => mp.Embed = embedResponse.CreateDiscordEmbed());
 }
 public void Modify(EmbedResponse embed) => Task.Run(() => ModifyAsync(embed)).Wait();