Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. using DSharpPlus.CommandsNext;
  2. using DSharpPlus.CommandsNext.Attributes;
  3. using DSharpPlus.Entities;
  4. using DSharpPlus.Interactivity;
  5. using StudyBot.Discord.Module.Attributes;
  6. using StudyBot.Utilities;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12.  
  13. namespace StudyBot.Discord.Module.Model.Internal
  14. {
  15. [HandleCommand]
  16. sealed class CreateQuizModule : IModule
  17. {
  18. private object context;
  19.  
  20. [Command("makequiz")]
  21. [Description("Makes a Quiz")]
  22. [Aliases("Makequiz", "MakeQuiz", "makeQuiz")]
  23.  
  24. public async Task OnCommand(CommandContext context, string name)
  25. {
  26. //var name = name
  27.  
  28.  
  29.  
  30. //FileUtil.WriteLine($"{name}.txt", "test");
  31. FileUtil.MakeFile($"{name}.txt");
  32. var emoji = DiscordEmoji.FromName(context.Client, ":white_check_mark:");
  33. await context.RespondAsync($"Quiz {name} created! {emoji} Please type your questions and answers!");
  34.  
  35. var intr = context.Client.GetInteractivityModule();
  36. var reminderContent = await intr.WaitForMessageAsync(
  37. c => c.Author.Id == context.Message.Author.Id, // Make sure the response is from the same person who sent the command
  38. TimeSpan.FromSeconds(60)); // Wait 60 seconds for a response instead of the default 30 we set earlier!
  39.  
  40. if (reminderContent == null)
  41. {
  42. await context.RespondAsync("Sorry, I didn't get a response!");
  43. return;
  44. }
  45.  
  46.  
  47. await context.RespondAsync("Got That!");
  48. }
  49.  
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement