當前位置: 首頁>>代碼示例>>Java>>正文


Java UserTypingEvent類代碼示例

本文整理匯總了Java中net.dv8tion.jda.core.events.user.UserTypingEvent的典型用法代碼示例。如果您正苦於以下問題:Java UserTypingEvent類的具體用法?Java UserTypingEvent怎麽用?Java UserTypingEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UserTypingEvent類屬於net.dv8tion.jda.core.events.user包,在下文中一共展示了UserTypingEvent類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onUserTyping

import net.dv8tion.jda.core.events.user.UserTypingEvent; //導入依賴的package包/類
@Override
public void onUserTyping(UserTypingEvent event)
{
    Logger LOG = LoggerFactory.getLogger("AFK Manager");
    User user = event.getUser();

    if(AfkManager.isAfk(user.getIdLong()))
    {
        user.openPrivateChannel().queue(pc -> pc.sendMessage(config.getDoneEmote()+" I've removed your AFK status.").queue(null,
                (e) -> LOG.warn("I was not able to DM "+user.getName()+"#"+user.getDiscriminator()+" about removing its AFK status.")));
        AfkManager.unsetAfk(user.getIdLong());
    }
}
 
開發者ID:EndlessBot,項目名稱:Endless,代碼行數:14,代碼來源:UserEvents.java

示例2: onUserTyping

import net.dv8tion.jda.core.events.user.UserTypingEvent; //導入依賴的package包/類
@Override
public void onUserTyping(UserTypingEvent event) {
    //TODO add user typing actions
}
 
開發者ID:MCPlummet,項目名稱:TransparentDiscord,代碼行數:5,代碼來源:MessageListener.java

示例3: handleInternally

import net.dv8tion.jda.core.events.user.UserTypingEvent; //導入依賴的package包/類
@Override
protected Long handleInternally(JSONObject content)
{
    final long channelId = content.getLong("channel_id");
    MessageChannel channel = api.getTextChannelMap().get(channelId);
    if (channel == null)
        channel = api.getPrivateChannelMap().get(channelId);
    if (channel == null)
        channel = api.getFakePrivateChannelMap().get(channelId);
    if (channel == null && api.getAccountType() == AccountType.CLIENT)
        channel = api.asClient().getGroupById(channelId);
    if (channel == null)
        return null;    //We don't have the channel cached yet. We chose not to cache this event
                        // because that happen very often and could easily fill up the EventCache if
                        // we, for some reason, never get the channel. Especially in an active channel.

    if (channel instanceof TextChannel)
    {
        final long guildId = ((TextChannel) channel).getGuild().getIdLong();
        if (api.getGuildLock().isLocked(guildId))
            return guildId;
    }

    final long userId = content.getLong("user_id");
    User user;
    if (channel instanceof PrivateChannel)
        user = ((PrivateChannel) channel).getUser();
    else if (channel instanceof Group)
        user = ((GroupImpl) channel).getUserMap().get(userId);
    else
        user = api.getUserMap().get(userId);

    if (user == null)
        return null;    //Just like in the comment above, if for some reason we don't have the user for some reason
                        // then we will just throw the event away.

    OffsetDateTime timestamp = Instant.ofEpochSecond(content.getInt("timestamp")).atOffset(ZoneOffset.UTC);
    api.getEventManager().handle(
            new UserTypingEvent(
                    api, responseNumber,
                    user, channel, timestamp));
    return null;
}
 
開發者ID:DV8FromTheWorld,項目名稱:JDA,代碼行數:44,代碼來源:TypingStartHandler.java


注:本文中的net.dv8tion.jda.core.events.user.UserTypingEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。