public async Task ItemInfo(CommandContext ctx) { var itemNameStep = new TextStep("What item are you looking for?", null); string itemName = string.Empty; itemNameStep.OnValidResult += (result) => itemName = result; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, itemNameStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } Item item = await _itemService.GetItemByNameAsync(itemName).ConfigureAwait(false); if (item == null) { await ctx.Channel.SendMessageAsync($"There is no item called {itemName}"); return; } await ctx.Channel.SendMessageAsync($"Name: {item.Name}, Description: {item.Description}, Price: {item.Price}"); }
public async Task Dialogue(CommandContext ctx) { TextStep inputStep = new TextStep("Enter something interesting", null); TextStep funnyStep = new TextStep("Haha, funny", null); string input = string.Empty; inputStep.OnValidResult += (result) => { input = result; if (result == "something interesting") { inputStep.SetNextStep(funnyStep); } }; DiscordDmChannel userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); DialogueHandler inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, inputStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await ctx.Channel.SendMessageAsync(input).ConfigureAwait(false); }
public async Task EmojiDialogue(CommandContext ctx) { TextStep yesStep = new TextStep("You chose yes", null); TextStep noStep = new TextStep("You chose no", null); ReactionStep emojiStep = new ReactionStep("Yes or No?", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":+1:"), new ReactionStepData { Content = "This means yes", NextStep = yesStep } }, { DiscordEmoji.FromName(ctx.Client, ":-1:"), new ReactionStepData { Content = "This means no", NextStep = noStep } } }); DiscordDmChannel userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); DialogueHandler inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, emojiStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } }
public async Task Dialogue(CommandContext ctx) { var inputStep = new TextStep("Enter smth interesting", null, 5); var funnyStep = new IntStep("MUR MUR MUR", null, maxValue: 100); var input = string.Empty; var value = 0; inputStep.OnValidResult += result => { input = result; if (result == "SupDvach!") { inputStep.SetNextStep(funnyStep); } }; funnyStep.OnValidResult += result => value = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, inputStep); var succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await ctx.Channel.SendMessageAsync(input).ConfigureAwait(false); await ctx.Channel.SendMessageAsync($"{value}").ConfigureAwait(false); }
public async Task CreateItem(CommandContext ctx) { var itemDescriptionStep = new TextStep("Enter item description:", null); var itemNameStep = new TextStep("Enter item name:", itemDescriptionStep); var item = new Item(); itemNameStep.OnValidResult += (result) => item.Name = result; itemDescriptionStep.OnValidResult += (result) => item.Description = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); //ctx.Channel; var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, itemNameStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await _itemService.CreateNewItemAsync(item); await ctx.Channel.SendMessageAsync($"Item {item.Name} successfully created!").ConfigureAwait(false); }
public async Task Dialogue(CommandContext ctx) { var inputStep = new TextStep("Say: abc", null); var funnyStep = new IntStep("Haha, funny", null, 100); string input = string.Empty; int value = 0; inputStep.OnValidResult += (result) => { input = result; if (result == "abc") { inputStep.SetNextStep(funnyStep); } }; funnyStep.OnValidResult += (result) => value = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, inputStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await ctx.Channel.SendMessageAsync(input).ConfigureAwait(false); await ctx.Channel.SendMessageAsync(value.ToString()).ConfigureAwait(false); }
public async Task Dialogue(CommandContext ctx) { var inputStep = new TextStep("Enter someone you want to calculate compatibility with! No need to use '^comp' again in your next message", null); string input = string.Empty; //var funnystep = new TextStep("Haha funny", null); inputStep.OnValidResult += (result) => { input = result; //if(result == "something interesting") { //inputStep.SetNextStep(funnystep); } }; //var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler(ctx.Client, ctx.Channel, ctx.User, inputStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } var random = new Random(); int percent = random.Next(0, 101); await ctx.Channel.SendMessageAsync(ctx.Member.Mention + ", your compatibility with " + input + " is " + percent + "%!").ConfigureAwait(false); }
public async Task Dialogue(CommandContext ctx) { var inputStep = new TextStep("Enter something interesting!", null, 10); string input = string.Empty; inputStep.OnValidResult += (result) => input = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, inputStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await ctx.Channel.SendMessageAsync(input).ConfigureAwait(false); }
public async Task dialogue(CommandContext ctx) { var inputStep = new TextStep("Say yes or no.", null); var yesStep = new TextStep("Noice", null); string input = string.Empty; inputStep.onValidResult += (result) => { input = result; if (result == "yes") { inputStep.SetNextStep(yesStep); } }; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, inputStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await ctx.Channel.SendMessageAsync(input).ConfigureAwait(false); }
public async Task CreateItem(CommandContext ctx) { TextStep itemDescriptionStep = new TextStep("Describe the item.", null); TextStep itemNameStep = new TextStep("What will the item be called?", itemDescriptionStep); Item item = new Item(); itemNameStep.OnValidResult += (result) => item.Name = result; itemDescriptionStep.OnValidResult += (result) => item.Description = result; DiscordDmChannel userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); DialogueHandler inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, itemNameStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await _itemService.CreateNewItemAsync(item).ConfigureAwait(false); await ctx.Channel.SendMessageAsync($"Item {item.Name} successfully created.").ConfigureAwait(false); }
public async Task CreateItem(CommandContext ctx) { var itemPriceStep = new IntStep("How much does the item cost?", null, 1); var itemDescriptionStep = new TextStep("What is the item about?", itemPriceStep); var itemNameStep = new TextStep("What will the item be called?", itemDescriptionStep); var item = new Item(); itemNameStep.OnValidResult += (result) => item.Name = result; itemDescriptionStep.OnValidResult += (result) => item.Description = result; itemPriceStep.OnValidResult += (result) => item.Price = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, itemNameStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await _itemService.CreateNewItemAsync(item).ConfigureAwait(false); await ctx.Channel.SendMessageAsync($"Item {item.Name} succesfully created!").ConfigureAwait(false); }
public async Task EmojiDialogue(CommandContext ctx) { await ctx.Message.DeleteAsync().ConfigureAwait(false); var yesStep = new TextStep("You chose yes", null); var noStep = new IntStep("You chose no", null); var emojiStep = new ReactionStep("Yes Or No?", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":thumbsup:"), new ReactionStepData { Content = "Yes", NextStep = yesStep } }, { DiscordEmoji.FromName(ctx.Client, ":thumbsdown:"), new ReactionStepData { Content = "No", NextStep = noStep } }, }); var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, emojiStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } }
public async Task AddEvent(CommandContext ctx) { var thirdStep = new TextStep("Who will be taking part in this event?", null); var secondStep = new TextStep("What is the Event name?", thirdStep); var firstStep = new DateTimeStep("What is the date/time you wish this event to take place on?\nStyle of Response Needed: DD/MM/YYYY HH:MM", secondStep); var newEvent = new EventList(); firstStep.OnValidResult += (result) => newEvent.DateTime = $"{result}"; secondStep.OnValidResult += (result) => newEvent.EventName = $"{result}"; thirdStep.OnValidResult += (result) => newEvent.Attendees = $"{result}"; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, firstStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await _eventService.CreateNewEvent(newEvent).ConfigureAwait(false); //Change this to -6 or -7 depending on DST var parsedTimeDate = DateTime.Parse(newEvent.DateTime).AddHours(-5); var embed = new DiscordEmbedBuilder { Title = "Event Created:", Color = DiscordColor.DarkRed, Description = $"Date/Time: {parsedTimeDate.ToShortDateString()} at {parsedTimeDate.ToShortTimeString()} (CST)\n\nEvent Name: {newEvent.EventName}\n\nAttendees: {newEvent.Attendees}", }; embed.AddField("MST:", $"{parsedTimeDate.AddHours(-2).ToLongDateString()} at {parsedTimeDate.AddHours(-2).ToShortTimeString()}"); embed.AddField("GMT:", $"{parsedTimeDate.AddHours(5).ToLongDateString()} at {parsedTimeDate.AddHours(5).ToShortTimeString()}"); embed.WithFooter($"Event ID: {newEvent.Id}"); var eventChannel = ctx.Guild.GetChannel(808076578725822474); await ctx.Channel.SendMessageAsync(embed : embed).ConfigureAwait(false); var eventMessage = await eventChannel.SendMessageAsync(embed : embed).ConfigureAwait(false); newEvent.EventChannelId = eventChannel.Id; newEvent.EventMessageId = eventMessage.Id; await _eventService.EditEvent(newEvent); }
private async Task SetId(CommandContext ctx, ulong memberId, bool userSelf) { Profile profile = await _profileService.GetOrCreateProfileAsync(memberId, ctx.Guild.Id); DiscordMember member = ctx.Guild.Members[profile.DiscordId]; long steamId = profile.SteamId; if (userSelf == false) { await ctx.Channel.SendMessageAsync("This user has not yet set their steamId, They must do this them self and cannot be done by others.").ConfigureAwait(false); return; } var SetSteamIdStep = new TextStep("Provide your SteamId. e.g. '12345678912345678'\nDO NOT REPLY TO THIS MESSAGE WITH W! [SteamId] Just enter your Id.\nTo get your steam ID use this [website](https://steamidfinder.com/lookup/) and use the steamID64, if you want to find information on what information your steam ID can provide follow [this link](https://developer.valvesoftware.com/wiki/Steam_Web_API).", null); string newSteamId = string.Empty; SetSteamIdStep.onValidResult += (result) => newSteamId = result; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, SetSteamIdStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } try { long newSteamIdLong = long.Parse(newSteamId); await _steamIdService.SetSteamIdAsync(memberId, ctx.Guild.Id, newSteamIdLong).ConfigureAwait(false); System.Threading.Thread.Sleep(500); await ctx.Channel.SendMessageAsync("Steam Id Set! try using the command now.").ConfigureAwait(false); return; } catch { await ctx.Channel.SendMessageAsync("That is not a valid steam Id.").ConfigureAwait(false); return; } }
protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { if (item == null) { return(null); } return(item switch { TextStep _ => _textTemplate, ImageStep _ => _imageTemplate, _ => throw new NotImplementedException() });
public async Task TOther(CommandContext ctx) { var ThankStep = new TextStep("Thank you for your time! We will get back to you as soon as we can. Type anything to end the dialogue.", nextStep: null); var IssueStep = new TextStep("Please describe your issue so that we may get back to you with a resolution as soon as possible.", nextStep: ThankStep, 1); var OtherIssueStep = new TextStep("What 'Category' could your issue be classified under? i.e. Monster Hunter World.", nextStep: IssueStep, 1); string input1 = string.Empty; string input2 = string.Empty; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, OtherIssueStep ); IssueStep.OnValidResult += (result) => { input1 = result; }; OtherIssueStep.OnValidResult += (result) => { input2 = result; }; var OtherSupportChannel = await ctx.Client.GetChannelAsync(670899812354359296).ConfigureAwait(false); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } var otherembed = new DiscordEmbedBuilder { Title = input2, Description = input1, Footer = new DiscordEmbedBuilder.EmbedFooter() { Text = ctx.User.Username, } }; var TicketMessage1 = await OtherSupportChannel.SendMessageAsync(embed : otherembed).ConfigureAwait(false); }
public async Task Dialogue(CommandContext ctx) { var thirdStep = new TextStep("Enter something sad!", null); var secondStep = new TextStep("Enter something boring!", thirdStep); var inputStep = new TextStep("Enter something interesting!", secondStep); var funnyStep = new IntStep("Haha funny", null, 4, 10); string input = string.Empty; int value = 0; funnyStep.OnValidResult += (result) => value = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, inputStep); List <DiscordMessage> dialogue = inputDialogueHandler.GetDialogue(); bool succeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); StringBuilder inputDialogue = new StringBuilder(); foreach (var message in dialogue) { inputDialogue.Append($"** {message.Content} ** \n"); } var finalEmbed = new DiscordEmbedBuilder { Description = inputDialogue.ToString(), Color = DiscordColor.DarkBlue, Title = "Dialogue" }; if (!succeded) { return; } await ctx.Channel.SendMessageAsync(embed : finalEmbed).ConfigureAwait(false); await ctx.Channel.SendMessageAsync(value.ToString()).ConfigureAwait(false); }
private static TextStep EvaluateTextNode(TextNode node, List <Character> characters) { var text = node.text; var character = GetCharacter(node.speaker_id, characters); var ts = new TextStep(text, character); var dic = new Dictionary <string, string>(); for (var i = 0; i < node.additionalDataKeys.Count; i++) { dic.Add(node.additionalDataKeys[i], node.additionalDataValues[i]); } ts.SetAdditionalData(dic); return(ts); }
public async Task TSuggestion(CommandContext ctx) { var ThankStep = new TextStep("Thank you for your time! We will get back to you as soon as we can. Type anything to end the dialogue.", nextStep: null); var IssueStep = new TextStep("Please describe your suggestion so that we may begin consideration / implementation.", nextStep: ThankStep, 1); string input1 = string.Empty; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, IssueStep ); IssueStep.OnValidResult += (result) => { input1 = result; }; var SuggestionsChannel = await ctx.Client.GetChannelAsync(668744199612661781).ConfigureAwait(false); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } var suggestionembed = new DiscordEmbedBuilder { Title = "Suggestion Ticket", Description = input1, Footer = new DiscordEmbedBuilder.EmbedFooter() { Text = ctx.User.Username, } }; var TicketMessage1 = await SuggestionsChannel.SendMessageAsync(embed : suggestionembed).ConfigureAwait(false); }
public async Task TGame(CommandContext ctx) { var ThankStep = new TextStep("Thank you for your time! We will get back to you as soon as we can. Type anything to end the dialogue.", nextStep: null); var IssueStep = new TextStep("Please describe your issue so that we may get back to you with a resolution as soon as possible.", nextStep: ThankStep, 1); string input1 = string.Empty; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, IssueStep ); IssueStep.OnValidResult += (result) => { input1 = result; }; var GameSupportChannel = await ctx.Client.GetChannelAsync(670899748634361876).ConfigureAwait(false); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } var gameembed = new DiscordEmbedBuilder { Title = "Game Support Ticket", Description = input1, Footer = new DiscordEmbedBuilder.EmbedFooter() { Text = ctx.User.Username, } }; var TicketMessage1 = await GameSupportChannel.SendMessageAsync(embed : gameembed).ConfigureAwait(false); }
public async Task RemoveDino(CommandContext ctx) { var itemNameStep = new TextStep("Which item are you gonna remove?", null); string itemName = string.Empty; itemNameStep.OnValidResult += (result) => itemName = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, itemNameStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { await ctx.Channel.SendMessageAsync($"Error").ConfigureAwait(false); return; } Item item = await _itemService.GetItemByNameAsync(itemName).ConfigureAwait(false); if (item == null) { await ctx.Channel.SendMessageAsync($"There is no item called {itemName}").ConfigureAwait(false); return; } bool delete = await _itemService.RemoveItemAsync(itemName); if (delete == false) { await ctx.Channel.SendMessageAsync($"Error while removing item called {itemName}").ConfigureAwait(false); return; } if (delete == true) { await ctx.Channel.SendMessageAsync($"{itemName} got removed from the database").ConfigureAwait(false); return; } }
private async Task ValidateOrSetId(CommandContext ctx, ulong memberId) { var SetBsIdStep = new TextStep("To find your Beatsaber Id either follow this URL replacing 'username' With your username https://scoresaber.com/global?search=username then open your profile and get your Id from the URL e.g. '76561198169909801'. Or user your steam Id if you are a steam user get your steam ID using this [website](https://steamidfinder.com/lookup/) and use the steamID64.", null); string newBsId = string.Empty; SetBsIdStep.onValidResult += (result) => newBsId = result; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, SetBsIdStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } try { long newSteamIdLong = long.Parse(newBsId); await SetBsId(ctx, ctx.Member.Id, newSteamIdLong); System.Threading.Thread.Sleep(500); await ctx.Channel.SendMessageAsync("Beatsaber Id Set! try using the command now.").ConfigureAwait(false); return; } catch { await ctx.Channel.SendMessageAsync("That is not a valid Beatsaber Id.").ConfigureAwait(false); return; } }
public async Task Dialogue(CommandContext ctx) { await ctx.Message.DeleteAsync().ConfigureAwait(false); var inputStep = new TextStep("Введите анонимное сообщение!", null, 2); var funnyStep = new IntStep("ну привет!", null, maxValue: 100); string input = string.Empty; int value = 0; inputStep.OnValidResult += (result) => { input = result; if (result == "привет") { inputStep.SetNextStep(funnyStep); } }; funnyStep.OnValidResult += (result) => value = result; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, inputStep); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } await ctx.Channel.SendMessageAsync(input).ConfigureAwait(false); //await ctx.Channel.SendMessageAsync(value.ToString()).ConfigureAwait(false); }
public async Task AddNoteToVersion(CommandContext ctx, [Description("The version number.")] string versionNumber) { var noteStep = new TextStep("What is the note you want to add.", null); var boolStep = new TextStep("Is this note a minor change or bug fix? True or False.", noteStep); bool isMinor = false; string newNote = string.Empty; boolStep.onValidResult += (result) => { isMinor = bool.Parse(result); }; noteStep.onValidResult += (result) => { newNote = result; }; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, boolStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } _versionService.AddPatchNoteToVersion(versionNumber, $"- newNote", isMinor); await ctx.RespondAsync($"New note for version {versionNumber} was added: {newNote}").ConfigureAwait(false); }
public async Task Dialogue(CommandContext ctx) { var inputStep = new TextStep("Enter something interesting!", null, 1, 150); var funnyStep = new IntStep("Haha, funny", null, maxValue: 100); string input = string.Empty; int value = 0; inputStep.OnValidResult += (result) => { input = result; if (result == "something interesting") { inputStep.SetNextStep(funnyStep); } }; funnyStep.OnValidResult += (result) => value = result; var userChannel = await ctx.Member.CreateDmChannelAsync(); var inputDialogueHandler = new DialogueHandler(ctx.Client, userChannel, ctx.User, inputStep); bool succeeded = await inputDialogueHandler.ProcessDialogue(); if (!succeeded) { return; } if (succeeded) { await userChannel.SendMessageAsync(input); } }
public async Task Configurate(CommandContext ctx) { var moderatorRoleStep = new TextStep("What is the name of the role of the moderator?", null); var autoRoleNameStep = new TextStep("What is the default role called when a new member joins?", moderatorRoleStep); var createMessageChannelStep = new UlongStep("Id Create Message Channel", autoRoleNameStep); var updateMessageChannelStep = new UlongStep("Id Update Message Channel", createMessageChannelStep); var deleteMessageChannelStep = new UlongStep("Id Delete Message Channel", updateMessageChannelStep); var autoRoleStep = new BoolStep("Включить ли автороль?", deleteMessageChannelStep); var autoWelcomeMessageStep = new BoolStep("Включить ли автоприветствие?", autoRoleStep); var autoLogCreateMessageStep = new BoolStep("Log when creating posts?", autoWelcomeMessageStep); var autoLogUpdateMessageStep = new BoolStep("Log when editing posts?", autoLogCreateMessageStep); var autoLogDeleteMessageStep = new BoolStep("Log when deleting posts?", autoLogUpdateMessageStep); bool autoRole = false; bool autoWelcomeMessage = false; var autoLogCreateMessage = false; var autoLogUpdateMessage = false; var autoLogDeleteMessage = false; string moderatorRole = ""; string autoRoleName = ""; ulong createMessageChannel = 0; ulong updateMessageChannel = 0; ulong deleteMessageChannel = 0; autoRoleStep.OnValidResult += (result) => autoRole = result; autoWelcomeMessageStep.OnValidResult += (result) => autoWelcomeMessage = result; autoLogCreateMessageStep.OnValidResult += (result) => autoLogCreateMessage = result; autoLogUpdateMessageStep.OnValidResult += (result) => autoLogUpdateMessage = result; autoLogDeleteMessageStep.OnValidResult += (result) => autoLogDeleteMessage = result; moderatorRoleStep.OnValidResult += (result) => moderatorRole = result; autoRoleNameStep.OnValidResult += (result) => autoRoleName = result; createMessageChannelStep.OnValidResult += (result) => createMessageChannel = result; updateMessageChannelStep.OnValidResult += (result) => updateMessageChannel = result; deleteMessageChannelStep.OnValidResult += (result) => deleteMessageChannel = result; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, autoLogDeleteMessageStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } var guildSettingsService = Program.Container.Resolve <IGuildSettingsService>(); if (await guildSettingsService.GetGuildSettingsByIdAsync(ctx.Guild.Id) == null) { await guildSettingsService.CreateGuildSettingsAsync(ctx.Guild.Id, autoRoleName, moderatorRole, createMessageChannel, updateMessageChannel, deleteMessageChannel, autoRole, autoWelcomeMessage, autoLogCreateMessage, autoLogUpdateMessage, autoLogDeleteMessage); } else { await guildSettingsService.UpdateGuildSettingsAsync(ctx.Guild.Id, autoRoleName, moderatorRole, createMessageChannel, updateMessageChannel, deleteMessageChannel, autoRole, autoWelcomeMessage, autoLogCreateMessage, autoLogUpdateMessage, autoLogDeleteMessage); } }
public async Task Ticket(CommandContext ctx) { var CorrectStep1 = new TextStep("Please type the command 'TDiscord' in the discord server so that we you can make a support ticket.", nextStep: null, 1); var CorrectStep2 = new TextStep("Please type the command 'TUser' in the discord server so that we you can make a support ticket.", nextStep: null, 1); var CorrectStep3 = new TextStep("Please type the command 'TGame' in the discord server so that we you can make a support ticket.", nextStep: null, 1); var CorrectStep4 = new TextStep("Please type the command 'TSuggestion' in the discord server so that we you can make a support ticket.", nextStep: null, 1); var CorrectStep5 = new TextStep("Please type the command 'TOther' in the discord server so that we you can make a support ticket.", nextStep: null, 1); var CancelStep = new TextStep("The dialogue has been canceled.", null); var DiscordStep = new ReactionStep("You chose support with Discord.", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":white_check_mark:"), new ReactionStepData { Content = "Correct?", NextStep = CorrectStep1 } }, { DiscordEmoji.FromName(ctx.Client, ":x:"), new ReactionStepData { Content = "Cancel?", NextStep = CancelStep } } }); var UserStep = new ReactionStep("You chose support with another User.", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":white_check_mark:"), new ReactionStepData { Content = "Correct?", NextStep = CorrectStep2 } }, { DiscordEmoji.FromName(ctx.Client, ":x:"), new ReactionStepData { Content = "Cancel?", NextStep = CancelStep } } }); var GameStep = new ReactionStep("You chose support in/with ARK:Survival Evolved or the server.", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":white_check_mark:"), new ReactionStepData { Content = "Correct?", NextStep = CorrectStep3 } }, { DiscordEmoji.FromName(ctx.Client, ":x:"), new ReactionStepData { Content = "Cancel?", NextStep = CancelStep } } }); var SuggestionStep = new ReactionStep("You chose Suggestions.", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":white_check_mark:"), new ReactionStepData { Content = "Correct?", NextStep = CorrectStep4 } }, { DiscordEmoji.FromName(ctx.Client, ":x:"), new ReactionStepData { Content = "Cancel?", NextStep = CancelStep } } }); var OtherStep = new ReactionStep("You chose support with something not currently listed.", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":white_check_mark:"), new ReactionStepData { Content = "Correct?", NextStep = CorrectStep5 } }, { DiscordEmoji.FromName(ctx.Client, ":x:"), new ReactionStepData { Content = "Cancel?", NextStep = CancelStep } } }); var emojiStep = new ReactionStep("What do you need support with? :one: - Discord? :two: - Another User? :three: - In/with our server on ARK: Survival Evolved? :four: - Have a suggestion? :five: Something currently not listed?", new Dictionary <DiscordEmoji, ReactionStepData> { { DiscordEmoji.FromName(ctx.Client, ":one:"), new ReactionStepData { Content = "Discord?", NextStep = DiscordStep } }, { DiscordEmoji.FromName(ctx.Client, ":two:"), new ReactionStepData { Content = "Another User?", NextStep = UserStep } }, { DiscordEmoji.FromName(ctx.Client, ":three:"), new ReactionStepData { Content = "In/with our server on ARK: Survival Evolved?", NextStep = GameStep } }, { DiscordEmoji.FromName(ctx.Client, ":four:"), new ReactionStepData { Content = "Have a suggestion?", NextStep = SuggestionStep } }, { DiscordEmoji.FromName(ctx.Client, ":five:"), new ReactionStepData { Content = "With something not currently listed?", NextStep = OtherStep } } }); var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, userChannel, ctx.User, emojiStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } }
public async Task AddOrModify(CommandContext ctx) { var guildPrefs = await _guildPreferences.GetOrCreateGuildPreferences(ctx.Guild.Id); DiscordChannel parentChannel = ctx.Guild.GetChannel(guildPrefs.StatChannelCatergoryId); if (parentChannel == null) { throw new Exception("You have not yet added a category where stats will be shown under. `w@guild stat setcategory <Channel category>`."); } var messageStep = new TextStep("What would you like the channel name to say? Will show as `<Your text here>: [stat] [Members name]` the limited number of characters is set low to prevent the stat from being hidden.", null, 0, 12); var statStep = new IntStep("What kind of stat would you like to track you can only have one of each type, to modify an existing one just select the same option? Please enter the corresponding number.\nMost gold - 0\nRobbing attack success rate - 1\nRobbing defense success rate - 2\nXp - 3\nGots - 4\nBoganness - 5\nGold Stolen - 6\nSpelling accuracy - 7\nGold Lost From Theft - 8\nRobbing Attack Wins - 9\nRobbing Defend Wins - 10\nHeads or tails wins - 11\nHeads or tails losses - 12\nCoin flip Win Rate - 13", messageStep, 0, 13); int statInput; StatOption stat = StatOption.Gold; string msgInput; string message = "1"; statStep.OnValidResult += (result) => { statInput = result; stat = (StatOption)result; statStep.SetNextStep(messageStep); }; messageStep.onValidResult += (result) => { msgInput = result; message = result; }; var userChannel = await ctx.Member.CreateDmChannelAsync().ConfigureAwait(false); var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, statStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { return; } ulong channelId; if (guildPrefs.StatChannels.Exists(x => x.StatOption == stat)) { channelId = guildPrefs.StatChannels.Where(x => x.StatOption == stat).FirstOrDefault().ChannelId; } else { channelId = ctx.Guild.CreateVoiceChannelAsync("waiting for update...", parentChannel).Result.Id; } await _statChannelService.CreateOrModifyStatChannel(ctx.Guild.Id, channelId, stat, message); await ctx.Channel.SendMessageAsync("There should be a new text channel in the specified category and will be updated on the next stat update cycle.").ConfigureAwait(false); }
public async Task ammo(CommandContext ctx) { var ammo = new Random().Next(0, 30); bool enemy = new Random().NextDouble() > 0.5; if (ammo == 0) { await ctx.Channel.SendMessageAsync($"shit ya got no ammo"); return; } else if (ammo == 30) { await ctx.Channel.SendMessageAsync($"Your good for ammo 30 out of 30"); return; } var msg = new TextStep($"You only have {ammo} out of 30, you think someone is around the corner. time for a reload?\nYes or No.", null, null); string response = string.Empty; msg.onValidResult += (result) => response = result; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, msg ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (response.ToLower() == "yes") { if (enemy) { await ctx.Channel.SendMessageAsync("You reload as fast as possible, but you get peaked and die to the AWP."); } if (!enemy) { await ctx.Channel.SendMessageAsync("You reload as fast as possible, no one peaks. maybe you scared them off?"); } } else if (response.ToLower() == "no") { if (enemy) { if (ammo < 10) { await ctx.Channel.SendMessageAsync($"You stand your ground, with only {ammo} bullets. But you cant aim for shit and die to the bottom frag on a P90."); } else { await ctx.Channel.SendMessageAsync($"You stand your ground, with only {ammo} bullets. Plenty to obliterate the T with an Ak."); } } if (!enemy) { await ctx.Channel.SendMessageAsync("You stand your ground, but no enemy is around the corner, your safe for now."); } } else { if (enemy) { await ctx.Channel.SendMessageAsync("You didn't say Yes or No. So i assume your still thinking about it, but in the mean time you let the enemy through and your team looses the round."); } if (!enemy) { await ctx.Channel.SendMessageAsync("You didn't say Yes or No. So i assume your still thinking about it, luck no one was there or you probably would have died."); } } }
public async Task DinoInfo(CommandContext ctx) { var itemNameStep = new TextStep("Which dino are you looking for?", null); string itemName = string.Empty; itemNameStep.OnValidResult += (result) => itemName = result; var inputDialogueHandler = new DialogueHandler( ctx.Client, ctx.Channel, ctx.User, itemNameStep ); bool succeeded = await inputDialogueHandler.ProcessDialogue().ConfigureAwait(false); if (!succeeded) { await ctx.Channel.SendMessageAsync($"Error").ConfigureAwait(false); return; } Item item = await _itemService.GetItemByNameAsync(itemName).ConfigureAwait(false); if (item == null) { await ctx.Channel.SendMessageAsync($"There is no item called {itemName}").ConfigureAwait(false); return; } string getGender = string.Empty; bool isGender = Convert.ToBoolean(item.Gender); if (isGender == false) { getGender = "Male"; } else if (isGender == true) { getGender = "Female"; } else { getGender = "Unknown"; } var itemUpdate = new DiscordEmbedBuilder(); itemUpdate.WithColor(DiscordColor.White); itemUpdate .WithTitle("Dino Info") .WithAuthor(ctx.Member.DisplayName + " executed this command") .WithDescription($"Info about {item.Name}") .AddField("Name", item.Name) .AddField("Real Name", item.RealName) .AddField("Price", item.Price.ToString()) .AddField("Gender", getGender) .WithTimestamp(ctx.Message.CreationTimestamp); await ctx.Channel.SendMessageAsync(embed : itemUpdate).ConfigureAwait(false); }