Esempio n. 1
0
        public async Task DisplayConfigAllAsync()
        {
            EmbedBuilder builder = ConfigEmbedBuilder();

            _lastConfigMessage = await Context.Channel.SendMessageAsync(string.Empty, false, builder.Build());

            _currentPage = 0;
            (Context.Client as DiscordSocketClient).ReactionAdded += HandleReactionAddedAsync;
            var emojis = new Emoji[] { new Emoji("\U00002B05"), new Emoji("\U000027A1") };  // Unicode characters for left and right arrows, respectively
            await _lastConfigMessage.AddReactionsAsync(emojis);
        }
 public static void InitializeMain(Service[] allServices)
 {
     if (!Platform.Ready)
     {
         throw new Exception("Please initialize the platform first");
     }
     ServiceManager.Initialize(allServices.ToList());
     ServiceUserSettingsManager.LoadAll();
     Emoji.Initalize(Platform.GetEmojisPath());
     BubbleGroupFactory.LoadAllPartiallyIfPossible();
 }
Esempio n. 3
0
        public string Help()
        {
            return($@"*Список доступных команд:*

{convertEmoji = new Emoji(new int[] { 0x0031, 0x20E3 })} /help \- просмотреть список команд
{convertEmoji = new Emoji(new int[] { 0x0032, 0x20E3 })} /start \- старт/презагрузка бота
{convertEmoji = new Emoji(new int[] { 0x0033, 0x20E3 })} /personality \- выбор личности
{convertEmoji = new Emoji(new int[] { 0x0034, 0x20E3 })} /reset \- перезапуск бота
{convertEmoji = new Emoji(new int[] { 0x0035, 0x20E3 })} /contacts \- контакты с разработчиком
{convertEmoji = new Emoji(new int[] { 0x0036, 0x20E3 })} Меню \- главное меню");
        }
Esempio n. 4
0
        private static async Task HandleLineCount(SocketUserMessage message, SocketCommandContext context)
        {
            if (Utils.LineCountCheckPassed(message.Content))
            {
                return;
            }

            if (!IsMod(context.User.Username))
            {
                string url = await HassBotUtils.Utils.Paste2Ubuntu(message.Content, context.User.Username);

                if (url == string.Empty)
                {
                    // untutu paste failed... try hastebin
                    url = HassBotUtils.Utils.Paste2HasteBin(message.Content);
                    if (url == string.Empty)
                    {
                        // hastebin paste ALSO failed... just warn the user, and drop a poop emoji :)
                        var poopEmoji = new Emoji(POOP);
                        await message.Channel.SendMessageAsync(string.Format(Constants.MAXLINELIMITMESSAGE, context.User.Mention));

                        await context.Message.AddReactionAsync(poopEmoji);

                        return;
                    }
                }

                //List<Violation> violations = ViolationsManager.TheViolationsManager.GetIncidentsByUser(context.User.Id);
                //int totalViolations = 0;
                //if (null != violations)
                //    totalViolations = violations.Count;

                // publish the URL link
                string response = string.Format(HASTEBIN_MESSAGE, context.User.Mention, url);
                await Helper.CreateEmbed(context, content : response, hidefooter : true);

                //// Violation Management
                //ViolationsManager.TheViolationsManager.AddIncident(context.User.Id, context.User.Username, CommonViolationTypes.Codewall.ToString(), context.Channel.Name);
                //if (null != violations)
                //{
                //    if (violations.Count >= 3 && violations.Count <= 5 )
                //    {
                //        await KickWarningMessage(context);
                //    }
                //    else if (violations.Count > 5)
                //    {
                //        await KickMessage(message, context);
                //    }
                //}

                // and, delete the original message!
                await context.Message.DeleteAsync();
            }
        }
Esempio n. 5
0
        public string AppendNTimes(string str, Emoji emoji, int n)
        {
            var returnVal = str;

            for (int i = 1; i < n; i++)
            {
                returnVal += emoji.Item;
            }

            return(returnVal);
        }
Esempio n. 6
0
        public static async Task ReadOptionAsync(OrikivoCommandContext Context, Emoji e)
        {
            if (!OptionsHelper.TryParseOption(e, out AccountOption ao))
            {
                await ReadOptionAsync(Context, e.Name);

                //await Context.Channel.ThrowAsync("Invalid context.", "The icon specified led to no results.");
                return;
            }
            await Context.Channel.ReadAsync(ao.Interpret(), Context.Account);
        }
Esempio n. 7
0
 private async void FieldEmoji_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(FieldEmoji.Text))
     {
         EmojiCollection.Source = Toolbar.ItemsSource;
     }
     else
     {
         EmojiCollection.Source = await Emoji.SearchAsync(ViewModel.ProtoService, FieldEmoji.Text, _selected);
     }
 }
        public async Task bambie()
        {
            await ReplyAsync("**C'est trop meugnon**");

            var message = await Context.Channel.SendFileAsync("assets/bambie.png");

            var heartEmoji = new Emoji(":heart:");
            await message.AddReactionAsync(heartEmoji);

            await ReplyAsync("Si tu aime réagit avec un coeur");
        }
Esempio n. 9
0
 private static async Task OnReactionAdded(Cacheable <IUserMessage, ulong> cache, ISocketMessageChannel channel, SocketReaction reaction)
 {
     if (reaction.MessageId == Global.MessageIdTracker)
     {
         if (reaction.Emote.Name == "👌")
         {
             Emoji emoji = (Emoji)reaction.Emote;
             await cache.Value.AddReactionAsync(emoji);
         }
     }
 }
Esempio n. 10
0
        private async Task CheckSignature(SocketUserMessage msg)
        {
            var db        = new BotBaseContext();
            var signature = db.Signature.AsQueryable().AsQueryable().Where(sig => sig.UserId == msg.Author.Id).FirstOrDefault();

            if (signature != null)
            {
                Emoji react = new Emoji(signature.Signature1);
                await msg.AddReactionAsync(react);
            }
        }
Esempio n. 11
0
 private async void FieldEmoji_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(FieldEmoji.Text))
     {
         EmojiCollection.Source = Toolbar.ItemsSource;
     }
     else
     {
         EmojiCollection.Source = await Emoji.SearchAsync(ViewModel.ProtoService, FieldEmoji.Text, _selected, CoreTextServicesManager.GetForCurrentView().InputLanguage.LanguageTag);
     }
 }
        public static bool TryGetIcon(this PropertyInfo property, out Emoji icon)
        {
            icon = null;
            IconAttribute ico = property.GetCustomAttribute <IconAttribute>();

            if (ico.Exists())
            {
                icon = ico.Icon;
                return(true);
            }
            return(false);
        }
Esempio n. 13
0
 public void TestSendEmojiMessage()
 {
     this.GetTestConversation("junwu", "58be1f5392509726c3dc1c8b").ContinueWith(t =>
     {
         var conversation = t.Result;
         var emojiMessage = new Emoji()
         {
             Ecode = "#e001",// 应用内置的表情编码
         };
         return(conversation.SendMessageAsync(emojiMessage));
     });
 }
Esempio n. 14
0
        public static string ResolveEmoji([NotNull] Emoji emoji)
        {
            if (emoji.Id is null)
            {
                return(Uri.EscapeDataString(emoji.Name));
            }
            var animated = emoji.Animated == true ? "a" : "n";
            var name     = emoji.Name.Replace(RegexEmojiNameArtifact, groups => "");
            var id       = emoji.Id;

            return($"{animated}:{name}:{id}");
        }
Esempio n. 15
0
        public void SendMessage(string channel, string text, Emoji icon, string username)
        {
            var slackMessage = new SlackMessage
            {
                Channel   = channel,
                Text      = text,
                IconEmoji = icon,
                Username  = username
            };

            _client.Post(slackMessage);
        }
Esempio n. 16
0
 public static string GetUrl(IEmoji emoji)
 {
     return(emoji switch
     {
         Emoji e => FormatEmojiUrl(GetUnicodeCodePoints(e)),
         LocalEmoji localEmoji => FormatEmojiUrl(GetUnicodeCodePoints(localEmoji)),
         LocalCustomEmoji localCustomEmoji => localCustomEmoji.GetUrl(),
         CustomEmoji customEmoji => customEmoji.GetUrl(),
         CachedGuildEmoji cachedEmoji => cachedEmoji.GetUrl(),
         RestGuildEmoji restEmoji => restEmoji.GetUrl(),
         _ => throw new ArgumentOutOfRangeException(nameof(emoji))
     });
Esempio n. 17
0
 internal Poll(RestUserMessage message, string title, SocketUser usr, params string[] options)
 {
     PollCreator = usr;
     PollMessage = message;
     PollTitle   = title;
     PollId      = GetNextId();
     for (int i = 1; i <= options.Length; i++)
     {
         Emoji e = new Emoji($"{i.ToString()}\u20E3");
         PollOptions.Add(new PollOption(options[i - 1], e));
     }
 }
Esempio n. 18
0
        public async Task EditCommandAsync(string command, params string[] output)
        {
            CommandServiceResponse response = _customCommandService.EditCommand(command, string.Join(' ', output), Context);

            Emoji reaction = response switch
            {
                CommandServiceResponse.Success => new Emoji("✅"),
                _ => new Emoji("❌")
            };

            await Context.Message.AddReactionAsync(reaction);
        }
Esempio n. 19
0
            /// <inheritdoc />
            protected override IEnumerable <Result <Uri> > GetImageUris
            (
                Optional <CDNImageFormat> imageFormat = default,
                Optional <ushort> imageSize           = default
            )
            {
                var emoji = new Emoji(new Snowflake(0), null);

                yield return(CDN.GetEmojiUrl(emoji, imageFormat, imageSize));

                yield return(CDN.GetEmojiUrl(emoji.ID !.Value, imageFormat, imageSize));
            }
Esempio n. 20
0
        public async Task AddReminder(IUserMessage message, ulong userId, DateTime reminderTime)
        {
            var reminder = new Reminder(message.GetGuild().Id, message.Channel.Id, message.Id, reminderTime);

            reminder.Users.Add(userId);
            reminders.Add(message.Id, reminder);
            SaveData();

            var emoji = new Emoji(emojiId);

            await message.AddReactionAsync(emoji);
        }
Esempio n. 21
0
        private async void AddReaction(string fightId)
        {
            var emote = new Emoji(_config.CurrentValue.WarcraftLogs.DoneEmoteCode);
            var msgs  = await _discordContext.GetChannelMessages(_config.CurrentValue.LogChannelId);

            foreach (var msg in msgs.Where(msg => msg.Content.Contains(fightId) || msg.Embeds.Any(x => x.Url.Contains(fightId))))
            {
                await msg.AddReactionAsync(emote, RequestOptions.Default);

                break;
            }
        }
        public async Task Vote([Remainder] string msg = null)
        {
            Emoji yes  = new Emoji("❤");
            Emoji wait = new Emoji("✋");
            Emoji no   = new Emoji("👎");

            IEmote[] emotes = new IEmote[3] {
                yes, wait, no
            };

            await Context.Message.AddReactionsAsync(emotes);
        }
Esempio n. 23
0
        public async Task SendYosano([Remainder] int repeat = 1)
        {
            var yosano = Emoji.GetEmojis().Single(x => x.Name == "yosano");
            var sb     = new StringBuilder();

            for (int i = 0; i < repeat; i++)
            {
                sb.Append(yosano.ToString());
            }

            await ReplyAsync(sb.ToString());
        }
Esempio n. 24
0
            public async Task Unload(string role)
            {
                RoleSetting       roleSetting = Methods.Data.GetRoleSetting(role);
                SocketTextChannel channel     = Constants.IGuilds.Jordan(Context).Channels.Where(x => x.Id == Methods.Data.GetChnlId("role-selection")).FirstOrDefault() as SocketTextChannel;
                IUserMessage      msg         = channel.GetMessageAsync(roleSetting.id).Result as IUserMessage;
                Embed             embed       = msg.Embeds.FirstOrDefault() as Embed;

                if (embed.Fields.FirstOrDefault().Name == $"There are no {roleSetting.group.ToLower()} roles available at the moment.")
                {
                    //Message is empty
                    await ReplyAsync(":x: Role is not loaded.");
                }

                string rolename = Constants.IGuilds.Jordan(Context).Roles.Where(x => x.Id == roleSetting.roleid).FirstOrDefault().Name;

                foreach (EmbedField field in embed.Fields)
                {
                    if (field.Name == rolename)
                    {
                        //Role is loaded
                        EmbedBuilder embedBuilder = new EmbedBuilder();
                        embedBuilder.WithTitle(embed.Title);
                        embedBuilder.WithColor(embed.Color.Value);
                        if (embed.Fields.Count() == 1)
                        {
                            embedBuilder.AddField($"There are no {roleSetting.group.ToLower()} roles available at the moment.", "Check back later for another event.");
                        }
                        else
                        {
                            foreach (EmbedField field_ in embed.Fields)
                            {
                                if (field_.Name != rolename)
                                {
                                    embedBuilder.AddField(field_.Name, field_.Value);
                                }
                            }
                        }
                        if (embed.Footer != null)
                        {
                            embedBuilder.WithFooter(embed.Footer.Value.Text);
                        }

                        await msg.ModifyAsync(x => x.Embed = embedBuilder.Build());
                        await ReplyAsync(":white_check_mark: Role unloaded.");

                        IEmote emote = new Emoji("");
                        emote = new Emoji(Methods.Data.GetRoleSetting(role).emoji);
                        await msg.RemoveReactionAsync(emote, Context.Client.CurrentUser);

                        return;
                    }
                }
            }
Esempio n. 25
0
        private void dataGridViewImage_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int r        = dataGridViewImage.CurrentCell.RowIndex;
            int c        = dataGridViewImage.CurrentCell.ColumnIndex;
            int location = r * col + c;

            if (location < emojiList.Count)
            {
                emojiSelected     = emojiList[location];
                selectedText.Text = emojiSelected.ToString();
            }
        }
Esempio n. 26
0
        public void Get()
        {
            Emoji.Get(":grinning:").Should().NotBe(GEmoji.Empty);
            Emoji.Get(":fail:").Should().Be(GEmoji.Empty);
            Emoji.Get(":grinning:").Should().Be(Emoji.Get("grinning"));
            Emoji.Get(":laughing:").Should().Be(Emoji.Get(":satisfied:"));

            var octocat = Emoji.Get(":octocat:");

            octocat.Should().NotBe(GEmoji.Empty);
            octocat.Raw.Should().BeEmpty();
        }
Esempio n. 27
0
        private void TryIncrementUnicodeFromMessage(string content, DiscordUser user)
        {
            var emojis = content.Codepoints()
                         .Where(o => Emoji.IsKnownEmoji(o))
                         .Distinct()
                         .Select(o => o.AsString().Trim());

            foreach (var emoji in emojis)
            {
                IncrementCounter(emoji, true, user);
            }
        }
Esempio n. 28
0
 private static Emoji GetEmoji(string iconemoji, Emoji defaultEmoji)
 {
     try
     {
         return((Emoji)Enum.Parse(typeof(Emoji), iconemoji));
     }
     catch
     {
         print($"Warning: {iconemoji} was not recognized as an iconemoji option. Use {opt_help_long} iconemoji for more information.");
         return(defaultEmoji);
     }
 }
Esempio n. 29
0
        /// <summary>
        /// Reply with a reaction to a users message as well as a message response
        /// </summary>
        /// <param name="message">User message</param>
        /// <param name="emoji">Emoji to react with</param>
        /// <param name="response">Message response</param>
        /// <returns>Reaction and Message or Message</returns>
        public Task <IUserMessage> ReplyReactionMessage(IUserMessage message, Emoji emoji, string response)
        {
            if (message.Reactions.ContainsKey(emoji))
            {
                return(Context.Channel.SendMessageAsync(response));
            }

            else
            {
                var t1 = message.AddReactionAsync(emoji); var t2 = Context.Channel.SendMessageAsync(response); Task.WhenAll(t1, t2); return(t2);
            }
        }
Esempio n. 30
0
        public async Task Stop()
        {
            SocketTextChannel channel = Constants.IGuilds.Jordan(Context).Channels.FirstOrDefault(x => x.Id == Methods.Data.GetChnlId("bot-log")) as SocketTextChannel;
            await channel.SendMessageAsync($"[{DateTime.Now} at Commands] Stopping [{Environment.GetEnvironmentVariable("SystemType").ToUpper()}] instance...");

            IEmote emote = new Emoji("✅");
            await Context.Message.AddReactionAsync(emote);

            await Context.Client.LogoutAsync();

            Environment.Exit(1);
        }
Esempio n. 31
0
    public static void loadWords()
    {
        JSONObject wordsText = null;
        if (json != null) {
            wordsText = json["words"];
        }
        else {
            loadFile ();
            loadWords();
        }

        for (int i=0; i < wordsText.Count; i++) {
            Word word = new Word ();

            JSONObject wordText = wordsText[i];
            string complete = wordText["complete"].ToString().Trim('"');
            word.setComplete(complete);

            JSONObject emojisText = wordText["emojis"];

            List<Emoji> emojis = new List<Emoji>();

            for (int e=0; e < emojisText.Count; e++) {
                Emoji emoji = new Emoji();

                JSONObject etext = emojisText[e];
                string wordAText = etext["word"].ToString().Trim('"');
                if (wordAText == "") {
                    break;
                }
                string color = etext["color"].ToString().Trim('"');
                string filename = findEmojiForWord(wordAText);

                emoji.setColor(color);
                emoji.setWord(wordAText);
                emoji.setFilename(filename);

                if (unlockAll) {
                    addToUnlocked(filename);
                }

                emojis.Add(emoji);
            }
            word.setEmojis(emojis);

            words.Add (word);
        }

        //int count = wordsText.Count;
        //for (int l=0; l < count; l++) {
        //	if (unlockAll) {
        //		emojis.Add (emojis[l]);
        //	}
        //}
        //printOutUnused();
    }
Esempio n. 32
0
    public static void loadEmojis()
    {
        JSONObject mappingsText = null;
        if (json != null) {
            mappingsText = json["mappings"];
        }
        else {
            loadFile ();
            loadEmojis();
        }

        for (int i=0; i < mappingsText.Count; i++) {
            Emoji emoji = new Emoji();
            JSONObject wordText = mappingsText[i];

            string word = wordText["word"].ToString().Trim('"');
            string filename = wordText["emoji"].ToString().Trim('"');

            emoji.setWord(word);
            emoji.setFilename(filename);
            emojis.Add (emoji);
        }
    }
Esempio n. 33
0
 public EmojiIconId(Emoji.Emoji emoji)
 {
     Emoji = emoji;
 }
		private static Completion EmojiCompletion(Emoji emoji)
		{
			var name = $":{emoji.Name}:";
			return new Completion(name, name, name, emoji.Bitmap(), name);
		}
Esempio n. 35
0
 public EmojiCompletion(Emoji emoji)
     : base()
 {
     _emoji = emoji;
     _name = $":{emoji.Name}:";
 }
Esempio n. 36
0
 public EmojiLookupItem(Emoji.Emoji emoji) : base(true)
 {
     Text = $":{emoji.Name}:";
     Image = new EmojiIconId(emoji);
 }
Esempio n. 37
0
    Emoji pickRandomEmoji()
    {
        Emoji e = new Emoji();
        string myRandomEmoji = "";
        string emojiList = "";
        // pick a word

        bool okay = false;

        while (!okay) {
            okay = true;
            int rand = UnityEngine.Random.Range (0, LoadSave.emojis.Count - 1);
            myRandomEmoji = LoadSave.emojis [rand].getWord ();
            emojiList = LoadSave.emojis [rand].getFilename ();

            // make sure it is not a duplicate of something already picked or random word

            // make sure it's not the two cards we need
            if (wordValues.Count > 1 && (wordValues [0].getFilename () == emojiList || wordValues [1].getFilename () == emojiList)) {
                //Debug.Log ("try again, it's a card you need");
                okay = false;
                //e = pickRandomEmoji ();
            }
            // make sure it's not already on the board (found this doesn't work)
            for (int i=0; i < someValues.Count; i++) {
                //Debug.Log (someValues[i].getFilename() + " " + emojiList);
                if (someValues[i].getFilename() == emojiList) {
                    // repeat, try again
                    //Debug.Log ("try again, already on board");
                    //e = pickRandomEmoji ();
                    okay = false;
                }
            }

        }
        e.setWord (myRandomEmoji);
        e.setFilename (emojiList);

        return e;
    }
Esempio n. 38
-1
		public EmojiTag(Emoji emoji)
		{
			Emoji = emoji;
		}