private async Task GetEmotes(RestUserMessage t, RoleSelector rsm) { int inc = -1; for (int i = 0; i < rsm.roles.Count; i++) { inc++; if (rsm.roles[inc].DefaultEmoji) { Emoji e = new Emoji(rsm.roles[inc].Emote); if (t.Reactions.Where(f => f.Key.Name == e.Name).ToList().Count == 0) { await t.AddReactionAsync(e); } } else { if (Emote.TryParse(rsm.roles[inc].Emote, out var emote)) { if (t.Reactions.Where(f => f.Key.Name == emote.Name).ToList().Count == 0) { await t.AddReactionAsync(emote); } } } } }
public static async Task Rules(IMessage message, ISocketMessageChannel channel) { await message.DeleteAsync(); var nie = Emote.Parse("<:WrongMark:460770239286870017>"); var tak = Emote.Parse("<:CheckMark:460770234177945610>"); EmbedBuilder eb = new EmbedBuilder(); eb.WithTitle(""); eb.WithAuthor("Czy zapoznałeś się i akceptujesz regulamin?"); eb.Author.WithIconUrl("https://i.imgur.com/C0jZgFX.png"); eb.AddField($"{nie} Nie, nie akceptuje", ""); eb.AddField($"{tak} Tak, zapoznałem się i akceptuje.", ""); eb.WithColor(new Color(32, 163, 102)); RestUserMessage msg = await channel.SendMessageAsync("", false, eb.Build()); ReactionChannels.channels.rules = msg.Id; ReactionChannels.SaveChannels(); await msg.AddReactionAsync(nie); await msg.AddReactionAsync(tak); }
public async Task Help() { var serverAccount = ServerAccounts.GetAccount(Context.Guild); var embed = new EmbedBuilder(); embed.WithTitle("Page 1/2"); embed.WithDescription($"**Server Prefix:** `{serverAccount.Prefix}`"); embed.WithImageUrl("https://i.imgur.com/9ImiHyn.png"); RestUserMessage msg = await Context.Channel.SendMessageAsync("", false, embed.Build()); Global.MessageToToTrack = msg.Id; var one = new Emoji("\U00000031\U000020e3"); var two = new Emoji("\U00000032\U000020e3"); var delete = new Emoji("\U000023f9"); var questionmark = new Emoji("\U00002754"); await msg.AddReactionAsync(one); await msg.AddReactionAsync(two); await msg.AddReactionAsync(delete); await msg.AddReactionAsync(questionmark); }
public async Task AddPlayer(ulong id, string name, ulong channelId) { if (Program.PlayerList.ContainsKey(id)) { await Program.GetGuild(ulong.Parse(Environment.GetEnvironmentVariable("GUILD_ID"))) .GetTextChannel(ulong.Parse(Environment.GetEnvironmentVariable("CHANNEL_ID"))) .SendMessageAsync("You already have a character!"); return; } _newPlayerId = id; _newPlayerName = name; _channelId = channelId; var embed = new EmbedBuilder { Color = Color.Blue, Title = _newPlayerName + ": Choose Your Faction" }; embed.AddField("1. Human", "Humans are dumb. Only plebs choose to be a human."); embed.AddField("2. Klingon", "The boys be crazy. Total warrior tribe vibes. Like to kill, love to die."); embed.AddField("3. Vulcan", "Everything is logic with these guys. They also have pointy ass ears. Nerds."); _message = await Program.GetGuild(ulong.Parse(Environment.GetEnvironmentVariable("GUILD_ID"))) .GetTextChannel(_channelId) .SendMessageAsync("", false, embed.Build()); await _message.AddReactionAsync(new Emoji(One)); await _message.AddReactionAsync(new Emoji(Two)); await _message.AddReactionAsync(new Emoji(Three)); Program.AddReactionEvent(ChooseFaction); }
public static async Task Meme(IUserMessage message, ISocketMessageChannel channel) { await message.DeleteAsync(); var tuple = Helpers.GetMeme(); string MemeUrl = tuple.url; string MemeAlt = tuple.alt; var meme = new Emoji("🤣"); var joke = new Emoji("🍞"); EmbedBuilder eb = new EmbedBuilder(); eb.WithTitle(MemeAlt); eb.WithImageUrl(MemeUrl); eb.WithColor(Color.Gold); RestUserMessage msg = await channel.SendMessageAsync("", false, eb.Build()); ReactionChannels.channels.meme = msg.Id; ReactionChannels.SaveChannels(); await msg.AddReactionAsync(meme); await msg.AddReactionAsync(joke); }
public static async Task Gender(IMessage message, ISocketMessageChannel channel) { await message.DeleteAsync(); var m = new Emoji("🚹"); var k = new Emoji("🚺"); var arrow = new Emoji("➡"); EmbedBuilder eb = new EmbedBuilder(); eb.WithTitle(""); eb.WithAuthor("PŁEĆ\n"); eb.Author.WithIconUrl("https://i.imgur.com/rwJ1dxk.png"); eb.WithTitle("Wybierz swoją płeć klikając w odpowiednią reakcje"); eb.WithDescription("🚹 Mężczyzna\n\n🚺 Kobieta"); eb.WithColor(Color.LighterGrey); RestUserMessage msg = await channel.SendMessageAsync("", false, eb.Build()); ReactionChannels.channels.gender = msg.Id; ReactionChannels.SaveChannels(); await msg.AddReactionAsync(m); await msg.AddReactionAsync(k); await msg.AddReactionAsync(arrow); }
public async void ConstructBookMessage(RestUserMessage message, string header, string [] pages) { bookMessages.Add(message.Id, new BookMessage(message.Channel.Id, message.Id, header, pages)); await message.AddReactionAsync(new Emoji ("⬅")); await message.AddReactionAsync(new Emoji ("➡")); bookMessages [message.Id].TurnPage(0); }
public async Task Start() { //await FillPages(); RestUserMessage msg = (RestUserMessage)await _context.Message.ReplyAsync("", false, CreatePage().Build()); await msg.AddReactionAsync(new Emoji("\u23EA")); await msg.AddReactionAsync(new Emoji("\u25B6")); }
public async Task Wreact( [Summary("The message")] ulong mid, [Summary("The reaction")] string reaction) { RestUserMessage rum = null; var items = await Context.Channel.GetMessagesAsync(2).Flatten(); int i = 0; foreach (IMessage message in items) { if (i == 1) { rum = await Context.Channel.GetMessageAsync(mid) as RestUserMessage; } i++; } if (rum == null) { return; } await Context.Message.DeleteAsync(); reaction = reaction.ToUpper(); Console.WriteLine(reaction); foreach (char c in reaction) { if ('A' <= c && c <= 'Z') { int index = c - 'A'; if (index < 0 || index > 26) { continue; } Emoji r = LookupData.Emojis[index]; await rum.AddReactionAsync(r); } else { return; int index = c - '0'; if (index < 0 || index > 10) { continue; } Emoji r = LookupData.Emojis[index + 26]; await rum.AddReactionAsync(r); } } }
private async Task ChooseFaction(Cacheable <IUserMessage, ulong> cache, ISocketMessageChannel channel, SocketReaction reaction) { if (reaction.MessageId != _message.Id || reaction.UserId != _newPlayerId) { return; } Program.RemoveReactionEvent(ChooseFaction); switch (reaction.Emote.Name) { case One: _newPlayerFaction = "Human"; break; case Two: _newPlayerFaction = "Klingon"; break; case Three: _newPlayerFaction = "Vulcan"; break; default: Program.AddReactionEvent(ChooseFaction); break; } await _message.DeleteAsync(); var embed = new EmbedBuilder { Color = Color.Blue, Title = _newPlayerName + ": Choose Your Class" }; embed.AddField("1. Captain", "70 Health\n7 Strength\n10 Defence"); embed.AddField("2. Marksman", "70 Health\n10 Strength\n7 Defence"); embed.AddField("3. Smuggler", "100 Health\n7 Strength\n7 Defence"); _message = await Program.GetGuild(ulong.Parse(Environment.GetEnvironmentVariable("GUILD_ID"))) .GetTextChannel(_channelId) .SendMessageAsync("", false, embed.Build()); await _message.AddReactionAsync(new Emoji(One)); await _message.AddReactionAsync(new Emoji(Two)); await _message.AddReactionAsync(new Emoji(Three)); Program.AddReactionEvent(ChooseClass); }
public async Task start(ISocketMessageChannel txtChnl) { try { if (pages.Count > 0) { msg = await txtChnl.SendMessageAsync("", false, pages[0]); await msg.AddReactionAsync(new Emoji("◀")); await msg.AddReactionAsync(new Emoji("▶")); async Task ReacRec(Cacheable <IUserMessage, ulong> arg1, ISocketMessageChannel arg2, SocketReaction arg3) { var arg1Msg = await arg1.GetOrDownloadAsync(); if (arg2.Id == channelid && arg1Msg.Id == msg.Id && arg3.User.GetValueOrDefault().Id == userid) { await arg1Msg.RemoveReactionAsync(arg3.Emote, arg3.User.GetValueOrDefault()); var thisPg = pages[index]; if (arg3.Emote.Name == "▶" && index + 1 < pages.Count) { index++; await arg1Msg.ModifyAsync(x => { x.Content = ""; x.Embed = pages[index]; }); } else if (arg3.Emote.Name == "◀" && index - 1 >= 0) { index--; await arg1Msg.ModifyAsync(x => { x.Embed = pages[index]; }); } } } Program.client.ReactionAdded += ReacRec; } } catch (Exception e) { Console.WriteLine(e); } }
public static async Task Profile(ISocketMessageChannel channel, IUser user, IMessage message) { await message.DeleteAsync(); var account = UserAccounts.GetAccount(user); string avatar = user.GetAvatarUrl(); string userlvl = account.LevelNumber.ToString(); string userexp = account.XP.ToString(); string username = user.Username; string moneyw = account.MoneyWallet.ToString(); string moneyac = account.MoneyAccount.ToString(); string NoWarns = account.Warns.ToString(); EmbedBuilder eb = new EmbedBuilder(); eb.WithAuthor($"Kliknij aby załadować swój profil"); eb.Author.WithIconUrl("https://cdn4.iconfinder.com/data/icons/social-messaging-ui-color-squares-01/3/30-512.png"); eb.WithThumbnailUrl("https://cdn4.iconfinder.com/data/icons/social-messaging-ui-color-squares-01/3/30-512.png"); eb.AddField("Nazwa:", "-", true); eb.AddField("Liczba ostrzeżeń:", "-", true); eb.AddField("Poziom:", "-", true); eb.AddField("Exp:", "-", true); eb.AddField("Portfel:", "-", true); eb.AddField("Konto:", "-", true); eb.WithColor(Color.DarkGrey); RestUserMessage msg = await channel.SendMessageAsync("", false, eb.Build()); ReactionChannels.channels.profile = msg.Id; ReactionChannels.SaveChannels(); var reaction = new Emoji("🚹"); await msg.AddReactionAsync(reaction); }
public async Task PingAsync() { RestUserMessage msg = await Context.Channel. SendMessageAsync("**__Hi there! I'm Waggles, let me show you what I can do!__** \n I don't wanna cloud your view, so I made a machine to help me help you. All you have to do is react with one of the following emojis to get its corresponding page. \n :wrench: - My admin tools! \n :tada: - The funnest commands! \n :house: - Takes you to the homepage. \n :horse: - Derpibooru commands!"); await msg.AddReactionAsync(new Emoji("🔧")); await msg.AddReactionAsync(new Emoji("🎉")); await msg.AddReactionAsync(new Emoji("🏠")); await msg.AddReactionAsync(new Emoji("🐴")); Global.MessageIdToTrack[Context.Channel.Id] = msg.Id; Global.MessageTotrack[Context.Channel.Id] = msg; }
private static async Task AddPollReactions(RestUserMessage message, List <string> pollOptions) { for (var i = 0; i < pollOptions.Count; ++i) { await message.AddReactionAsync(new Emoji(numberEmoji[i].Replace(":", ""))); } }
internal static async void CoinflipVsAccepted(ISocketMessageChannel Context) { IUser usr = Global.vsusr; IUser user = Global.thisusr; RestUserMessage msg = await Context.SendMessageAsync("What will you choose? Head or Tail?"); var emote = new Emoji(":expressionless:"); await msg.AddReactionAsync(emote); emote = new Emoji(":chipmunk:"); await msg.AddReactionAsync(emote); Global.messageIDtoTrack = msg.Id; Global.emoteMethod = "cointossChoose"; }
static async Task UserJoined(SocketGuildUser user) { if (logChannel == null) { logChannel = user.Guild.GetChannel(334933825383563266) as SocketTextChannel; } if (gettingStartedChannel == null) { gettingStartedChannel = (user.Guild.GetChannel(450499963999223829) as ITextChannel).Mention; } RestUserMessage welcome = await logChannel.SendMessageAsync($"A newcomer has arrived. Welcome {user.Mention}!\nCheck out {gettingStartedChannel} (includes download link!)"); await welcome.AddReactionAsync(Emojis.Wave); Console.WriteLine("User Joined : " + user.Username + " . Member Count : " + logChannel.Guild.MemberCount); if ((logChannel.Guild.MemberCount % 1000) == 0) { await logChannel.SendMessageAsync($"We've now hit {logChannel.Guild.MemberCount} members! Wooooo!"); await Task.Delay(1000 * 20); await logChannel.SendMessageAsync($"Partaayyy!"); } }
public async Task AnnounceRegistration(SocketTextChannel channel, RestUserMessage message) { var embed1 = new EmbedBuilder() .WithColor(new Color(114, 137, 218)) .WithTitle("IT BEGINS TO RAIN!") .WithImageUrl(_config["rainImageUrlAnnouncement"]) .Build(); var embed2 = new EmbedBuilder() .WithColor(new Color(114, 137, 218)) .WithTitle("QUICK, SEND ME YOUR WALLET ADDRESSES!") .WithDescription($"YOU HAVE ``{_registerDelay.TotalSeconds}`` SECONDS TO SEND ME YOUR WALLET ADDRESS.\nDON'T FORGET TO ADD THE REACTION I WILL SEND YOU BACK.") .WithImageUrl(_config["rainImageUrlRegistration"]) .Build(); await message.ModifyAsync(m => m.Embed = embed1); foreach (var emote in ReactionEmotes) { await message.AddReactionAsync(emote); await Task.Delay(2500); } _logger.LogInformation("=== ACCEPT REGISTRATION ==="); _guildUsers = await _guild.GetUsersAsync(); State = RainServiceState.AcceptingRegistrations; await message.ModifyAsync(m => m.Embed = embed2); }
public async Task Vote([Remainder] string text) { Context.Message.DeleteAsync(); VoteController vc = VoteControllerManager.GetVoteController(Context.Channel); vc.SetOptions(text); if (vc.GetOptions().Count == 0) { vc.ResetOptions(); } Poll vote = vc.NewPoll(); foreach (string option in vc.GetOptions()) { RestUserMessage message = Context.Channel.SendMessageAsync(option).Result; vote.AddOptionMessage(message); message.AddReactionAsync(new Emoji("👌")); } await Task.Delay(1000 *ResourceController.GetVoteDelay()); if (!vc.CurrentPoll.IsClosed) { await vc.ClosePoll(Context); } }
private async Task AddDayReactions(RestUserMessage reply, DayOfWeek startDay) { foreach (var reaction in GetDayReactions(startDay)) { await reply.AddReactionAsync(reaction); } }
public async Task e621SearchSort(int sort, [Remainder] string srch) { await Context.Channel.TriggerTypingAsync(); if (srch.Contains("loli") || srch.Contains("foalcon") || srch.Contains("cub")) { await ReplyAsync("Those search terms(loli, foalcon, or cub) are not allowed! Try again!"); return; } //if sort integer is too small or big, give help if (sort - 1 > sortingOptions.Length || sort < 0) { await ReplyAsync("Sorting integers are: \n```0:Default, newest to oldest. \n1:Oldest to newest. \n2:Score. \n3:FavCount. \n4:Random.```" + "\nManual sorting can be done by using this chart https://e621.net/help/show/cheatsheet#sorting and inserting it into a search as a tag. " + "\nEx: Overriding default search order with mpixels order.```~e order:mpixels horse```"); return; } //url for use, explicit images and inserts provided tags straight in. string url; //if channel is not on the explicit channels list, if (!DBTransaction.isChannelWhitelisted(Context.Channel.Id) && !Context.IsPrivate) { url = $"https://e621.net/posts.json?tags=order:{sortingOptions[sort]}+{srch}+rating:s&limit=50"; } else { url = $"https://e621.net/posts.json?tags=order:{sortingOptions[sort]}+{srch}+-cub+-loli+-foalcon&limit=50"; } string respond = e621.getJSON(url).Result; if (respond == "failure") { await ReplyAsync("An error occurred! " + url); return; } ImageList responseList = JsonConvert.DeserializeObject <ImageRoot>(respond).posts; if (responseList.Count == 0) { await ReplyAsync("No results! The tag may be misspelled, or the results could be filtered out due to channel!"); } else { Global.e621Searches[Context.Channel.Id] = respond; Random rand = new Random(); Global.e621SearchIndex[Context.Channel.Id] = rand.Next(0, responseList.Count); e621.Post chosenImage = responseList[Global.e621SearchIndex[Context.Channel.Id]]; RestUserMessage msg = await Context.Channel.SendMessageAsync(chosenImage.file.url + "\n" + string.Join(",", chosenImage.tags.artist)); await msg.AddReactionAsync(new Emoji("▶")); //set random info for running ~enext through emoji reactions. Global.e621Context[Context.Channel.Id] = Context; Global.e621MessageToTrack[Context.Channel.Id] = msg.Id; } }
public async Task ReactionRoleAsync() { RestUserMessage msg = await Context.Channel.SendMessageAsync("React to me!"); await msg.AddReactionAsync(new Emoji("👌")); Global.ReactionMessageID = msg.Id; }
public string ApproveRequest(int index) { string path = Data.FILE_PATH + Data.REQUEST_FILE; List <string> existingRequests = Data.GetContainers <string>(path); string request = existingRequests[index]; // Put the request up for voting RestUserMessage m = ((SocketTextChannel)Context.Guild.GetChannel(Data.CHANNEL_ID_REQUEST_VOTING)).SendMessageAsync(request).GetAwaiter().GetResult(); m.AddReactionAsync(new Emoji("👍")).GetAwaiter().GetResult(); m.AddReactionAsync(new Emoji("👎")).GetAwaiter().GetResult(); RemoveRequest(index); index++; //So the number matches the list, starting at 1 again. return("The request at the `" + index + Data.GetIndexEnding(index) + "` position have been approved and posted in " + ((SocketTextChannel)Context.Guild.GetChannel(Data.CHANNEL_ID_REQUEST_VOTING)).Mention + " for voting.\nApproved request:\n`" + request + "`"); }
public async Task CreateVote([Remainder] string input) { await Context.Message.DeleteAsync(); RestUserMessage message = await Context.Channel.SendMessageAsync("", false, new EmbedBuilder() .WithTitle(Text("vote_head").ToString()) .WithDescription( input + "\n\n" + "<:THK_Good:575051447599628311>" + Text("vote_good").ToString() + "<:THK_Bad:575796719078473738>" + Text("vote_bad").ToString()) .WithFooter(Text("vote_by").ToString() + (Context.User as SocketGuildUser).Nickname) .WithColor(Color.Red) .Build()); await message.AddReactionAsync(Emote.Parse("<:THK_Good:575051447599628311>")); await message.AddReactionAsync(Emote.Parse("<:THK_Bad:575796719078473738>")); }
public async Task <RestUserMessage> CreateEmbed(ISocketMessageChannel channel) { embedBuilder.Description = $"{user.Mention} начал голосование за пропуск песни **{_player.Track.Title}**. \n Нажмите на реакцию для пропуска трека."; RestUserMessage msg = await channel.SendMessageAsync("", false, embedBuilder.Build()); await msg.AddReactionAsync(new Emoji("\u2611")); return(msg); }
public async Task HelpAsync() { await Check(); await Emotion("<:ThinkRadiance:567800282797309957>"); if (Global.HelpHandler.Item1 != null) { try { await Global.HelpHandler.Item1.DeleteAsync(); } catch { } } Fields.curren = 0; EmbedBuilder builder = new EmbedBuilder(); builder .WithTitle(Language(32)) .WithColor(Color.DarkBlue); switch (Context.Guild.VoiceRegionId) { case "russia": builder .AddField(Fields.FielderTitleRU[Fields.curren], Fields.FielderRU[Fields.curren]) .WithFooter(Language(33) + (Fields.curren + 1).ToString() + "/" + Fields.FielderTitleRU.Length.ToString()); break; default: builder .AddField(Fields.FielderTitleEN[Fields.curren], Fields.FielderEN[Fields.curren]) .WithFooter(Language(33) + (Fields.curren + 1).ToString() + "/" + Fields.FielderTitleEN.Length.ToString()); break; } RestUserMessage a = await Context.Channel.SendMessageAsync("", false, builder.Build()); await a.AddReactionAsync(new Emoji("◀")); await a.AddReactionAsync(new Emoji("▶")); Global.HelpHandler = (a, Context.Guild.VoiceRegionId); }
//To-DO private PostsUpdateEventArgs _redditService_PostsUpdated(PostsUpdateEventArgs eve) { IEnumerable <Channel> channels = _channelRepo.GetChannelByType(Models.Domain.ChannelType.approval); foreach (Channel chan in channels) { SocketGuild guild = _client.Guilds.FirstOrDefault(g => g.Id == chan.Guild.GuildID); if (guild != null) { foreach (Post pos in eve.Added) { var pos2 = pos.Listing; Embed emb; if (postmediaTypes.Contains(pos2.PostHint)) { emb = EmbedService.BuildMediaRedditPost(pos, guild).Build(); } else { emb = EmbedService.BuildRedditPost(pos, guild).Build(); } ISocketMessageChannel chanel = (ISocketMessageChannel)guild.GetChannel(chan.ChanelID); RestUserMessage msg = chanel.SendMessageAsync(embed: emb).Result; msg.AddReactionAsync(check); msg.AddReactionAsync(cross); Message mesg = new Message() { Channel = chan, ChannelID = chan.ChanelID, MessageID = msg.Id }; _messageRepo.AddMessage(mesg); _messages.Add(mesg); } } } return(eve); }
public async Task VoteCommand([Remainder] string args) { string[] numbers = new string[] { ":one:", ":two:", ":three:", ":four:", ":five:", ":six:", ":seven:", ":eight:", ":nine:" }; var emojis = new Emoji[] { new Emoji("1️⃣"), new Emoji("2️⃣"), new Emoji("3️⃣"), new Emoji("4️⃣"), new Emoji("5️⃣"), new Emoji("6️⃣"), new Emoji("7️⃣"), new Emoji("8️⃣"), new Emoji("9️⃣") }; List <string> choices = args.Split("\"") .Select(x => x.Trim()) .Where(x => !String.IsNullOrEmpty(x)) .ToList(); string title = choices[0]; choices.RemoveAt(0); EmbedBuilder builder = new EmbedBuilder() .WithColor(new Color(33, 176, 252)) .WithTitle(title); //Limit imposed because no more number emotes are available if (numbers.Length < choices.Count) { await Context.Channel.SendMessageAsync("Too many options. please limit yourself to 9"); return; } for (int i = 0; i < choices.Count; i++) { builder.AddField(numbers[i], choices[i]); } builder.AddField(":track_next:", "I dont care"); Embed embed = builder.Build(); RestUserMessage message = await Context.Channel.SendMessageAsync(null, false, embed); for (int i = 0; i < choices.Count; i++) { await message.AddReactionAsync(emojis[i]); } await message.AddReactionAsync(new Emoji("⏩")); }
public async Task BongTrap() { if (Context.Channel is SocketTextChannel channel) { RestUserMessage message = await channel.SendMessageAsync("Bong!"); DiscordClient.BongTrapMessageId = message.Id; await message.AddReactionAsync(new Emoji("⏰")); } }
public async Task StartRPS(SocketCommandContext context) { if (!await Utilities.CheckForChannel(context, 518846214603669537, context.User)) { return; } string name = ((SocketGuildUser)context.User).Nickname ?? context.User.Username; RestUserMessage m = await context.Channel.SendMessageAsync("", false, embed("Pick your play and see if you can beat me!", $"{name} is playing.")); await m.AddReactionAsync(new Emoji("📰")); await m.AddReactionAsync(new Emoji("✂")); await m.AddReactionAsync(new Emoji("🌑")); isPlaying = true; MessageID = m.Id; Player = (SocketGuildUser)context.User; }
private static async Task AddRaidEmojisAsync(RestUserMessage signupMessage) { foreach (var icon in AbfConfiguration.RaidEmbedIcons) { if (!signupMessage.Reactions.ContainsKey(icon)) { await signupMessage.AddReactionAsync(icon); } } }