public async Task CommandRespond(CommandContext context, string message) { if (context.Channel.IsPrivate) { await context.Message.RespondAsync($"{message}"); } else { lastComment = await lastComment.ModifyAsync($"{message}"); } }
public async Task Refresh(string code) { int index = 0; string time = ""; string zone = ""; try { index = Schedule.Codes.IndexOf(code); time = Schedule.AdjustedTime(Schedule.Relations[index]); zone = Schedule.Zones[index]; } catch { timer = await timer.ModifyAsync($"Sorry, but I couldn't find that time zone..."); await Task.Delay(2000); await Refresh(); return; } refreshRequested = true; timer = await timer.ModifyAsync($"Need a refresh? Sure, I can do that for ya. One moment, please..."); string schedule = await Schedule.GenerateSchedule(); timer = await timer.ModifyAsync($"Refreshed for **{nickname}** at **{time} {code.ToUpper()} ({zone})**! :sunglasses:\n\n" + $"{schedule}\n" + $"Please feel free to help us keep track of **field bosses** and **Golden Bells** by letting me know where you spot them!\n\n" + $"You are also welcome to share this timer with any friendly spirits who cross your path.\n\n" + $"https://discord.gg/ndVAvQ3"); }
public async Task Ping(CommandContext ctx) { DSharpPlus.Entities.DiscordMessage return_message = await ctx.Message.RespondAsync("Pinging..."); ulong ping = (return_message.Id - ctx.Message.Id) >> 22; Char[] choices = new Char[] { 'a', 'e', 'o', 'u', 'i', 'y' }; Char letter = choices[Program.rnd.Next(0, choices.Length)]; await return_message.ModifyAsync($"P{letter}ng! 🏓\n" + $"• It took me `{ping}ms` to reply to your message!\n" + $"• Last Websocket Heartbeat took `{ctx.Client.Ping}ms`!"); }
public async Task Refresh() { refreshRequested = true; timer = await timer.ModifyAsync($"Need a refresh? Sure, I can do that for ya. One moment, please..."); string schedule = await Schedule.GenerateSchedule(); timer = await timer.ModifyAsync($"Refreshed for **{nickname}** at **{DateTime.Now.ToString("h:mm tt")} (North American Eastern Standard Time)**! :sunglasses:\n\n" + $"{schedule}\n" + $"Please feel free to help us keep track of **field bosses** and **Golden Bells** by letting me know where you spot them!\n\n" + $"You are also welcome to share this timer with any friendly spirits who cross your path.\n\n" + $"https://discord.gg/ndVAvQ3"); }
public static async Task FinishArkLink(string playerName, string steamName, DSharpPlus.Entities.DiscordMessage msg, ulong id) { //Fetch this user DiscordUser u = new DiscordUser("", id, DiscordUserPermissionLevel.admin); //We have the user and the player. Finish link u.isArkLinked = true; u.arkLinkedUsername = playerName; u.arkLinkedSteamName = steamName; var embed = Tools.GenerateEmbed("Ark Link", "Nice job!", "Ark link completed! You're now linked with " + u.arkLinkedUsername + "!", DiscordColor.Green); //Close user to save. u.CloseUser(); //Write to the list of linked users. ArkLinkList.WriteToUserList(new ArkLinkItem(steamName.Trim(' '), id, playerName.Trim(' '))); await msg.ModifyAsync(embed : embed); //Done. }
public async Task Existence() { while (true) { var remaining = 60 - Int32.Parse(DateTime.Now.ToString("ss")); var context = await interactivity.WaitForMessageAsync(data => !data.Author.IsBot, TimeSpan.FromSeconds(remaining)); string message; if (Received(context)) { message = Message(context.Message.ToString()).ToLower(); nickname = Nickname(context.User.ToString()); } else { message = ""; nickname = ""; } if (Received(context) && context.Message.Author.IsBot) { // Do nothing and wait for next message. } else if (Howdy(message)) { await Respond(context, $"I couldn't be better! And how are you?"); } else if (OfferingHelp(message)) { await Respond(context, $"Keeping me in the loop is super easy! " + $"Let's say `the Dim Tree Spirit` spawns on `Balenos 3`. You can tell me by saying:\n\n" + $"\t`Tree is up on Balenos 3.`\n\n" + $"The period is optional, and you can say (most) standard variations of field boss names, such as `Dim Tree`. " + $"*However*, you ***must*** say `is up on` between the boss name and the server name.\n\n" + $"Now, let's say a someone activates a **Golden Bell** after the Dim Tree Spirit dies:\n\n" + $"\t`Bell 60 Balenos 3.`\n\n" + $"Again, the period is optional but the rest of the format of the command is not. `60` represents the remaining time on the bell's XP buff. " + $"If you know about a bell that only has `20` minutes left, you would just change the `60` to a `20`.\n\n" + $"All commands are also **case-insensitive** (as they should be). " + $"If you're confused or a command isn't working, just ask **Zendachi Kazenai** for more assistance. " + $"May the force be with you, mi dachi! :wink:"); askedToHelp = true; } else if (WantsLink(message)) { await Respond(context, $"If I'm not mistaken, you're looking for this:" + $"\n\nhttps://discord.gg/ndVAvQ3"); } else if (Grateful(message)) { var lastMessage = Message(lastComment.ToString()); await Respond(context, $"{lastMessage}\nDon't mention it, homie! :smiley:"); } else if (RequestingUntag(message)) { await Unregister(context); } else if (RequestingTag(message)) { await Register(context); } else if (Farewell(message)) { await Respond(context, $"Health, wealth, and stealth, my dachi! Have a lovely grind. :smiley:"); } else if (Blank(message)) { refreshRequested = false; timer = await timer.ModifyAsync($"One moment, please. I'm just refreshing the timer..."); string schedule = await Schedule.GenerateSchedule(); timer = await timer.ModifyAsync($"I refreshed the timer at **{DateTime.Now.ToString("h:mm tt")} (North American Eastern Standard Time)**!\n\n" + $"{schedule}\n" + $"Please feel free to help us keep track of **field bosses** and **Golden Bells** by letting me know where you spot them!\n\n" + $"You are also welcome to share this timer with any friendly spirits who cross your path.\n\n" + $"https://discord.gg/ndVAvQ3"); if (!askedToHelp) { await Respond(context, $"Health, wealth, and stealth, my dachi! Have a lovely grind. :smiley:"); } else { askedToHelp = false; } } else if (ActivatingFieldBoss(message)) { await Respond(context, $"Thanks for letting me know! I'll relay the message..."); try { AddBoss(message); } catch { await Respond(context, $"Oh dear, I'm so confused... Can you please double-check your input?" + $"\nIf it looks good to you, please ask Kazenai what's wrong. He knows me better than I know myself..."); } finally { refreshRequested = true; await Refresh(); } } else if (DeactivatingFieldBoss(message)) { if (message.StartsWith("field boss")) { try { int bossIndex = Int32.Parse(message.Split(' ')[2]) - 1; if (Schedule.BonusUp) { bossIndex++; } Schedule.DeactivateFieldBoss(bossIndex); await Respond(context, $"If I recall correctly, death is good in this context... :smiley:"); } catch { await Respond(context, $"Oh dear, I'm so confused... Can you please double-check your input?" + $"\nIf it looks good to you, please ask Kazenai what's wrong. He knows me better than I know myself..."); } finally { refreshRequested = true; await Refresh(); } } else if (message.StartsWith("boss")) { try { int bossIndex = Int32.Parse(message.Split(' ')[1]) - 1; Schedule.DeactivateFieldBoss(bossIndex); await Respond(context, $"If I recall correctly, death is good in this context... :smiley:"); } catch { await Respond(context, $"Oh dear, I'm so confused... Can you please double-check your input?" + $"\nIf it looks good to you, please ask Kazenai what's wrong. He knows me better than I know myself..."); } finally { refreshRequested = true; await Refresh(); } } } else if (WhatIsBell(message)) { await Respond(context, $"A **Golden Bell** grants **100% Bonus Combat Experience** to everyone on one server channel for one hour. If any bells are active, I'll post them below the boss times. :smiley:"); } else if (ActivatingBell(message)) { await Respond(context, $"Thanks! I've made sure our friends can see that."); int duration = 0; string server = ""; if (message.Split(' ').Length > 2) { duration = Int32.Parse(message.Split(' ')[1]); server = Server(message.Split(' ')[2]); } try { server += " " + message.Split(' ')[3]; } catch { // No worries, just Arsha. } try { await Schedule.ActivateBell(server, duration); } catch { await Respond(context, $"Oh dear, I'm so confused... Can you please double-check your input?" + $"\nIf it looks good to you, please ask Kazenai what's wrong. He knows me better than I know myself..."); } finally { refreshRequested = true; await Refresh(); } } else if (DeactivatingBell(message)) { try { int bellIndex = Int32.Parse(message.Split(' ')[2]) - 1; string server = Schedule.BellServers[bellIndex]; Schedule.DeactivateBell(bellIndex); foreach (DiscordMember member in Commander.TaggedMembers) { await member.SendMessageAsync($"The **Golden Bell on {server}** ***was a mistake!*** Please disregard that alert."); } await Respond(context, $"No problem, I've deactivated that alert."); } catch { await Respond(context, $"Oh dear, I'm so confused... Can you please double-check your input?" + $"\nIf it looks good to you, please ask Kazenai what's wrong. He knows me better than I know myself..."); } finally { refreshRequested = true; await Refresh(); } } else if (SleepCommand(message)) { await context.Message.DeleteAsync(); await timer.DeleteAsync(); await lastComment.DeleteAsync(); Environment.Exit(0); } else if (RefreshTimeZoneCode(message)) { string code = message.Split(' ')[1].Replace(".", "").Replace("!", "").Replace("?", "").Trim(); await Refresh(code); } else if (TimeZoneCode(message)) { string code = message.Split(' ')[0].Replace(".", "").Replace("!", "").Replace("?", "").Trim(); await Refresh(code); } else if (RequestingRefresh(message)) { await Refresh(); } else { await Respond(context, $"Sorry, but I don't know what that means! :sweat_smile:"); } if (context != null && !context.Channel.IsPrivate) { await context.Message.DeleteAsync(null); } } }