Advertisement
Terror_nisse

Untitled

Jul 14th, 2023
713
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1.     public interface IPostwmClass
  2.     {
  3.         Task<Dictionary<ButtonBuilder, Embed>> PostWMMessage(SocketUser user, string? l = null);
  4.         // Define other methods used by InteractionHandler or other classes if needed
  5.     }
  6.     public class PostwmClass : IPostwmClass
  7.     {
  8.  
  9.         private readonly IConfiguration _configuration;
  10.         private readonly IUserTranslationsHandler _userTranslationsHandler;
  11.  
  12.         public PostwmClass(IConfiguration config, IUserTranslationsHandler userTranslationsHandler)
  13.         {
  14.             _configuration = config;
  15.             _userTranslationsHandler = userTranslationsHandler;
  16.         }
  17.  
  18.         public async Task<Dictionary<ButtonBuilder, Embed>> PostWMMessage(SocketUser user, string? l = null)
  19.         {
  20.             var t = _userTranslationsHandler;
  21.             var id = user.Id;
  22.  
  23.             var embed = new EmbedBuilder()
  24.                 .WithTitle($":wave: {await t.T("verification_hello", id, l: l)}")
  25.  
  26.                 .AddField($"**\n{await t.T("verification_whatoffer", id, l: l)}**",
  27.                 $":white_check_mark: {await t.T("verification_offer1", id, l: l)}\n" +
  28.                 $":white_check_mark: {await t.T("verification_offer2", id, l: l)}\n" +
  29.                 $":white_check_mark: {await t.T("verification_offer3", id, l: l)}\n" +
  30.                 $":white_check_mark: {await t.T("verification_offer4", id, l: l)}\n\n" +
  31.                 $":exclamation: {await t.T("verification_rules1", id, l: l, v: new string[] { $"<#{_configuration["rulesChannel"]}>" })}\n\n")
  32.  
  33.                 .WithImageUrl("https://i.imgur.com/B0udNXR.png").WithColor(Color.Blue);
  34.  
  35.             var buttonBuilder = new ButtonBuilder()
  36.                 .WithLabel(await t.T("verification_button", id, l: l)).WithCustomId("application_apply").WithStyle(ButtonStyle.Success).WithEmote(Emoji.Parse(":envelope_with_arrow:"));
  37.             try
  38.             {
  39.                 var dictionary = new Dictionary<ButtonBuilder, Embed>
  40.                 {
  41.                     { buttonBuilder, embed.Build() }
  42.                 };
  43.                 return dictionary;
  44.             }
  45.             catch (Exception ex)
  46.             {
  47.                 Console.WriteLine(ex.ToString());
  48.                 return null!;
  49.             }
  50.         }
  51.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement