当前位置: 首页>>代码示例>>Java>>正文


Java EmojiParser类代码示例

本文整理汇总了Java中com.vdurmont.emoji.EmojiParser的典型用法代码示例。如果您正苦于以下问题:Java EmojiParser类的具体用法?Java EmojiParser怎么用?Java EmojiParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EmojiParser类属于com.vdurmont.emoji包,在下文中一共展示了EmojiParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newTopic

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@Override
public void newTopic(String title, String content) {
    mView.startLoading();

    title = EmojiParser.parseToAliases(title);
    content = EmojiParser.parseToAliases(content);

    NetworkTaskScheduler.getInstance().execute(new NewTopicTask(mView.getUrl(),
            title,
            content,
            new OnResponseListener<String>() {
                @Override
                public void onSucceed(String data) {
                    mView.stopLoading();
                    mView.onNewTopicSucceed();
                }

                @Override
                public void onFailed(String msg) {
                    mView.stopLoading();
                    mView.onNewTopicFailed(msg);
                }
    }));
}
 
开发者ID:mzlogin,项目名称:guanggoo-android,代码行数:25,代码来源:NewTopicPresenter.java

示例2: comment

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@Override
public void comment(String content) {
    mView.startLoading();
    content = EmojiParser.parseToAliases(content);
    NetworkTaskScheduler.getInstance().execute(new CommentTask(getUrl(), content, new OnResponseListener<String>() {
        @Override
        public void onSucceed(String data) {
            mView.stopLoading();
            mView.onCommentSucceed();
        }

        @Override
        public void onFailed(String msg) {
            mView.stopLoading();
            mView.onCommentFailed(msg);
        }
    }));
}
 
开发者ID:mzlogin,项目名称:guanggoo-android,代码行数:19,代码来源:TopicDetailPresenter.java

示例3: onMessage

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@Override
public void onMessage(String message) {
    message = EmojiParser.parseToAliases(message);
    if (message.startsWith("PING")) {
        sendPong();
    }

    if (message.startsWith(":") || message.startsWith("@")) {
        try {
            MessageRunnable messageRunnable = new MessageRunnable(message);
            new Thread(messageRunnable).start();
        } catch (Exception ex) {
            twitchWSIRCParser.parseData(message);
        }
    }
}
 
开发者ID:GloriousEggroll,项目名称:quorrabot,代码行数:17,代码来源:IRC.java

示例4: newUser

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
private void newUser(GuildMessageReceivedEvent event) {
	Connection connect = Connections.getConnection();
	
	try {
		String name = event.getAuthorName();
		if (name != null)
			name = EmojiParser.parseToUnicode(name);
		String nick = event.getAuthorNick();
		if (nick != null)
			nick = EmojiParser.parseToUnicode(nick);

		PreparedStatement ps = connect.prepareStatement("INSERT INTO users (userid, username, nickname) VALUES (?, ?, ?)");
		ps.setString(1, event.getAuthor().getId());
		ps.setString(2, name);
		ps.setString(3, nick);
		ps.executeUpdate();
	
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Bermos,项目名称:kokbot,代码行数:22,代码来源:Karma.java

示例5: emojiParse

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
public static String emojiParse(String text) {
    Matcher       m         = matcher("<span class=\"emoji emoji(.{1,10})\"></span>", text);
    StringBuilder sb        = new StringBuilder();
    int           lastStart = 0;
    while (m.find()) {
        String str = m.group(1);
        if (str.length() == 6) {

        } else if (str.length() == 10) {

        } else {
            str = "&#x" + str + ";";
            String tmp = text.substring(lastStart, m.start());
            sb.append(tmp + str);
            lastStart = m.end();
        }
    }
    if (lastStart < text.length()) {
        sb.append(text.substring(lastStart));
    }
    if (sb.length() > 0) {
        return EmojiParser.parseToUnicode(sb.toString());
    }
    return text;
}
 
开发者ID:biezhi,项目名称:wechat-api,代码行数:26,代码来源:WeChatUtils.java

示例6: updateArticle

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@Override
@Transactional
public String updateArticle(ContentVo contents) {
    if (null == contents) {
        return "文章对象为空";
    }
    if (StringUtils.isBlank(contents.getTitle())) {
        return "文章标题不能为空";
    }
    if (StringUtils.isBlank(contents.getContent())) {
        return "文章内容不能为空";
    }
    int titleLength = contents.getTitle().length();
    if (titleLength > WebConst.MAX_TITLE_COUNT) {
        return "文章标题过长";
    }
    int contentLength = contents.getContent().length();
    if (contentLength > WebConst.MAX_TEXT_COUNT) {
        return "文章内容过长";
    }
    if (null == contents.getAuthorId()) {
        return "请登录后发布文章";
    }
    if (StringUtils.isBlank(contents.getSlug())) {
        contents.setSlug(null);
    }
    int time = DateKit.getCurrentUnixTime();
    contents.setModified(time);
    Integer cid = contents.getCid();
    contents.setContent(EmojiParser.parseToAliases(contents.getContent()));

    contentDao.updateByPrimaryKeySelective(contents);
    relationshipService.deleteById(cid, null);
    metasService.saveMetas(cid, contents.getTags(), Types.TAG.getType());
    metasService.saveMetas(cid, contents.getCategories(), Types.CATEGORY.getType());
    return WebConst.SUCCESS_RESULT;
}
 
开发者ID:ZHENFENG13,项目名称:My-Blog,代码行数:38,代码来源:ContentServiceImpl.java

示例7: setGuildReactionOnMention

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
public final Config setGuildReactionOnMention(long guild_id, String reaction_on_mention) {
    if (reaction_on_mention == null) {
        final ConfigData configData = getConfigData(guild_id, 0, KEY_GUILD_REACTION_ON_MENTION);
        if (configData != null) {
            configData.delete();
        }
        return this;
    }
    if (!reaction_on_mention.startsWith(":") && !reaction_on_mention.endsWith(":")) {
        reaction_on_mention = EmojiParser.parseToAliases(reaction_on_mention);
    }
    setValue(guild_id, 0, KEY_GUILD_REACTION_ON_MENTION, reaction_on_mention);
    return this;
}
 
开发者ID:Panzer1119,项目名称:Supreme-Bot,代码行数:15,代码来源:Config.java

示例8: setGuildReactionOnCommandNotFound

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
public final Config setGuildReactionOnCommandNotFound(long guild_id, String reaction_on_command_not_found) {
    if (reaction_on_command_not_found == null) {
        final ConfigData configData = getConfigData(guild_id, 0, KEY_GUILD_REACTION_ON_COMMAND_NOT_FOUND);
        if (configData != null) {
            configData.delete();
        }
        return this;
    }
    if (!reaction_on_command_not_found.startsWith(":") && !reaction_on_command_not_found.endsWith(":")) {
        reaction_on_command_not_found = EmojiParser.parseToAliases(reaction_on_command_not_found);
    }
    setValue(guild_id, 0, KEY_GUILD_REACTION_ON_COMMAND_NOT_FOUND, reaction_on_command_not_found);
    return this;
}
 
开发者ID:Panzer1119,项目名称:Supreme-Bot,代码行数:15,代码来源:Config.java

示例9: setUserReactionOnCommandNotFound

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
public final Config setUserReactionOnCommandNotFound(long user_id, String reaction_on_command_not_found) {
    if (reaction_on_command_not_found == null) {
        final ConfigData configData = getConfigData(0, user_id, KEY_USER_REACTION_ON_COMMAND_NOT_FOUND);
        if (configData != null) {
            configData.delete();
        }
        return this;
    }
    if (!reaction_on_command_not_found.startsWith(":") && !reaction_on_command_not_found.endsWith(":")) {
        reaction_on_command_not_found = EmojiParser.parseToAliases(reaction_on_command_not_found);
    }
    setValue(0, user_id, KEY_USER_REACTION_ON_COMMAND_NOT_FOUND, reaction_on_command_not_found);
    return this;
}
 
开发者ID:Panzer1119,项目名称:Supreme-Bot,代码行数:15,代码来源:Config.java

示例10: onUpdateReceived

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@Override
public void onUpdateReceived(Update update) {
	String line = null;
	String prefix, comando, params;
	String[] response;

	// We check if the update has a message and the message has text
	if (update.hasMessage() && update.getMessage().hasText()) {
		// Set variables
		long chat_id = update.getMessage().getChatId();
		mchat = update.getMessage().getChat();
		prefix = update.getMessage().getFrom().getUserName();

		if (prefix == null) {
			prefix = update.getMessage().getFrom().getFirstName();
		}

		params = nickName + " :" + update.getMessage().getText().toLowerCase().trim();
		log.logga(prefix + " --> " + nickName + ": " + update.getMessage().getText().toLowerCase().trim());

		response = trattaPrivMsg(prefix, params);

		for (int i = 0; i < response.length; i++) {
			log.logga(nickName + " --> " + prefix + ": " + response[i]);
			SendMessage message = new SendMessage() // Create a message object object
					.setChatId(chat_id).setText(EmojiParser.parseToUnicode(response[i]));
			try {
				sendMessage(message); // Sending our message object to user
			} catch (TelegramApiException e) {
				e.printStackTrace();
			}
		}	
	}
}
 
开发者ID:alex321v,项目名称:iln,代码行数:35,代码来源:TelegramIlnBot.java

示例11: say

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
public void say(String message) {
    message = EmojiParser.parseToUnicode(message);
    if (message.startsWith(".timeout ")) { //check if the message starts with a "." for timeouts. ".timeout <user>".
        sendQueue.add(new Message(message));
        return;
    }
    messages.add(new Message(message));
}
 
开发者ID:GloriousEggroll,项目名称:quorrabot,代码行数:9,代码来源:Session.java

示例12: onMention

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@EventSubscriber
public void onMention(MentionEvent event) {
    IMessage message = event.getMessage();
    IChannel channel = event.getMessage().getChannel();
    IUser author = event.getMessage().getAuthor();
    boolean everyone = message.mentionsEveryone();
    boolean dm = channel.isPrivate();
    boolean self = event.getClient().getOurUser().equals(author);
    if (!everyone && !dm && !self) {
        CompletableFuture.runAsync(() -> {
            synchronized (lock) {
                channel.toggleTypingStatus();
                long start = System.currentTimeMillis();
                String content = EmojiParser.parseToAliases(message.getContent()
                        .replace(discordService.getClient().getOurUser().mention(), ""),
                    EmojiParser.FitzpatrickAction.REMOVE);
                try {
                    String response = chatterBotSessionMap.get(currentSession).think(content);
                    response = StringEscapeUtils.unescapeHtml4(response);
                    Matcher matcher = UNICODE.matcher(response);
                    while (matcher.find()) {
                        String hex = matcher.group(1);
                        response = matcher.replaceFirst(new String(Character.toChars(Integer.parseInt(hex, 16))));
                    }
                    long delay = System.currentTimeMillis() - start;
                    log.debug("Response took {} ms", delay);
                    if (delay < 3000L) {
                        Thread.sleep(3000L - delay);
                    }
                    discordService.sendMessage(channel, author.mention() + " " + response);
                } catch (Exception e) {
                    log.warn("Could not process chatter input", e);
                    channel.toggleTypingStatus();
                }
            }
        }, taskExecutor);
    }
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:39,代码来源:EtcCommands.java

示例13: transform

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
@Override
public FirehoseMessage transform(FirehoseMessage firehoseMessage) {
    FirehoseMessage msg = (FirehoseMessage) firehoseMessage.clone();
    msg.content = msg.content.replaceAll(":slightly_smiling_face:", ":smile:");
    msg.content = EmojiParser.parseToUnicode(msg.content);
    return msg;
}
 
开发者ID:dmitriid,项目名称:tetrad,代码行数:8,代码来源:TransformSlackSmileys.java

示例14: sendToMinecraft

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
/**
 * Send a chat message to the Minecraft server
 *
 * @param origin   {@link IChannel} the message came from
 * @param username player who sent the message
 * @param message  the actual message which gets sent
 */
public static void sendToMinecraft(IChannel origin, String username, String message) {
    String formattedMessage = getFormattedMessage(origin, username);

    DiscordMC.getSubscribedPlayers().forEach(uuid -> Bukkit.getPlayer(uuid).sendMessage(
            EmojiParser.parseToAliases(formattedMessage
                    .replaceAll("%message", ChatColor.stripColor(message)))));
}
 
开发者ID:manuelgu,项目名称:DiscordMC,代码行数:15,代码来源:MessageAPI.java

示例15: updateUsernames

import com.vdurmont.emoji.EmojiParser; //导入依赖的package包/类
void updateUsernames(JDA jda) {
	Connection connect = Connections.getConnection();

	try {
		PreparedStatement ps = connect.prepareStatement("SELECT userid FROM users");
		ResultSet rs = ps.executeQuery();

		ps = connect.prepareStatement("UPDATE users SET username = ?, nickname = ? WHERE userid = ?");
		while (rs.next()) {
			User user = jda.getUserById(rs.getString("userid"));
			if (user != null) {
				String name = user.getUsername();
				if (name != null)
					name = EmojiParser.parseToHtmlHexadecimal(name);
				String nick = jda.getGuildById("141575893691793408").getNicknameForUser(user);
				if (nick != null)
					nick = EmojiParser.parseToHtmlHexadecimal(nick);

				ps.setString(1, name);
				ps.setString(2, nick);
				ps.setString(3, rs.getString("userid"));
				ps.addBatch();
			}
		}

		ps.executeBatch();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Bermos,项目名称:kokbot,代码行数:31,代码来源:Karma.java


注:本文中的com.vdurmont.emoji.EmojiParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。