• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Status类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
public static void main(String... args) throws Exception{
	System.out.println("Pokebot version "+VERSION);
	if(config.TOKEN.isEmpty()){
		System.out.println("Error: No token found in pokebot.conf file");
		System.exit(0);
	}
	if(config.WEBENABLED){
		System.out.println("Web interface enabled on port "+config.PORT);
		WebInterface.initWebInterface(config.REDIRECT_URL, config.PORT);
	}
	client = new ClientBuilder().withToken(config.TOKEN).login();
	System.out.println("Logging in");
	client.getDispatcher().registerListener(new BotReadyHandler(Thread.currentThread()));
	timer.scheduleAtFixedRate(PlayerHandler::saveAll, SAVE_DELAY, SAVE_DELAY, TimeUnit.MINUTES);
	timer.scheduleAtFixedRate(Pokebot::sendAllMessages, MESSAGE_DELAY, MESSAGE_DELAY,
			TimeUnit.MILLISECONDS);
	timer.scheduleAtFixedRate(() -> Pokebot.client.changeStatus(Status.game(Pokebot.getRandomGame()))
			, GAME_DELAY, GAME_DELAY, TimeUnit.MINUTES);
	//Now that the main thread is done doing it's business and the bot is busy logging in...
	Move.registerMoves();
}
 
开发者ID:Coolway99,项目名称:Discord-Pokebot,代码行数:22,代码来源:Pokebot.java


示例2: start

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
public final void start() {
    LOGGER.traceEntry();

    final IDiscordClient client;
    try {
        client = new ClientBuilder()
                .withToken(ConfigurationManager.Configurations.BotToken.value())
                .setDaemon(false)
                .login();
    } catch (DiscordException e) {
        LOGGER.fatal("Fail to login to discord.", e);
        throw new BotLoginFailedException(e);
    }
    this.discordClient = client;
    this.discordClient.getShards().forEach(s -> s.changeStatus(Status.game("IntelliJ IDEA")));

    this.invite = new BotInviteBuilder(discordClient)
            .withClientID(ConfigurationManager.Configurations.ClientID.value().toString())
            .withPermissions(EnumSet.of(Permissions.ADMINISTRATOR))
            .build();
    System.out.println(MessageFormat.format("Bot Created, invitation link: {0}", invite));


    addEventManager();

    LOGGER.traceExit();
}
 
开发者ID:ViniciusArnhold,项目名称:ProjectAltaria,代码行数:28,代码来源:BotManager.java


示例3: onReadyEvent

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
@EventSubscriber
public void onReadyEvent(ReadyEvent event) {
    event.getClient().changeStatus(Status.game("~help | " + String.valueOf(event.getClient().getGuilds().size()) + " Servers"));
    System.out.println("" +
            "\nYo\n" +
            "His palms are sweaty, knees weak, arms are heavy\n" +
            "There's vomit on his sweater already, mom's spaghetti.\n" +
            "Bot Ready.\n\n");
}
 
开发者ID:nbd9,项目名称:PastaBot,代码行数:10,代码来源:InterfaceListener.java


示例4: dispatch

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
@Override
public void dispatch(String[] args, IUser sender, IChannel channel) {
    if (args.length == 1) {
        IUser converted = Parsing.mentionToUser(args[0]);
        if (converted == null) {
            Messages.send("No such user!", channel);
            return;
        }
        StringBuilder response = new StringBuilder();
        response.append("About ID is: ").append(converted.getID());
        response.append("\nNicnkame: ").append(converted.getDisplayName(channel.getGuild()));
        response.append("\nTheir full name is: ").append(converted.getName());
        response.append("\nDiscriminator is: ").append(converted.getDiscriminator());
        response.append("\nTheir avatar URL is: ").append(converted.getAvatarURL());
        response.append("\nTheir presence is: ").append(converted.getPresence().name());
        response.append(converted.getStatus().getStatusMessage() == null ?
                "\nStatus: Not set" :
                (converted.getStatus().getType() == Status.StatusType.GAME ?
                        "\nThey're playing: " + converted.getStatus().getStatusMessage() :
                        "\nThey're streaming: " + converted.getStatus().getStatusMessage()));
        response.append("\nThey made their account on: ").append(converted.getCreationDate().format(DateTimeFormatter.ISO_DATE));
        response.append(converted.isBot() ? "\nThey are a bot" : "");
        response.append(channel.getGuild().getOwner().equals(converted) ? "\nThey are the owner of this guild" : "");
        response.append("\nTheir roles are: \n```xl\n");
        Set<String> roles = getPermissions(channel).getUser(converted).getRoles();
        for (String role : roles) {
            response.append(role);
            response.append('\n');
        }
        response.append("```");
        Messages.send(response.toString().trim(), channel);
    } else
        Messages.send("Incorrect usage! " + usage(), channel);
}
 
开发者ID:ArsenArsen,项目名称:ABot,代码行数:35,代码来源:About.java


示例5: update

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
/**
 * Update to the newest version of FlareBot!
 *
 * @param force   If the version number has not changed this will need to be true in order to update it.
 * @param channel Channel the command was sent in.
 */
public static void update(boolean force, IChannel channel) {
    try {
        URL url = new URL("https://raw.githubusercontent.com/ArsenArsen/FlareBot/master/pom.xml");
        BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
        String line;
        while (true) {
            line = br.readLine();
            if (line != null && (line.contains("<version>") && line.contains("</version>"))) {
                String latestVersion = line.replace("<version>", "").replace("</version>", "").replaceAll(" ", "").replaceAll("\t", "");
                String currentVersion = FlareBot.getInstance().getVersion();
                if (force || isHigher(latestVersion, currentVersion)) {
                    FlareBot.getInstance().getClient().changeStatus(Status.game("Updating.."));
                    if (channel != null)
                        MessageUtils.sendMessage("Updating to version `" + latestVersion + "` from `" + currentVersion + "`", channel);
                    UPDATING.set(true);
                    FlareBot.getInstance().quit(true);
                } else {
                    if (channel != null)
                        MessageUtils.sendMessage("I am currently up to date! Current version: `" + currentVersion + "`", channel);
                }
                break;
            }
        }
    } catch (IOException e) {
        FlareBot.LOGGER.error("Could not update!", e);
    }
}
 
开发者ID:ArsenArsen,项目名称:FlareBot,代码行数:34,代码来源:UpdateCommand.java


示例6: onGuildAdded

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
@EventSubscriber
public void onGuildAdded(GuildCreateEvent event) {
    event.getClient().changeStatus(Status.game("~help | " + String.valueOf(event.getClient().getGuilds().size()) + " Servers"));
}
 
开发者ID:nbd9,项目名称:PastaBot,代码行数:5,代码来源:InterfaceListener.java


示例7: onGuildRemoved

import sx.blah.discord.handle.obj.Status; //导入依赖的package包/类
@EventSubscriber
public void onGuildRemoved(GuildLeaveEvent event) {
    event.getClient().changeStatus(Status.game("~help | " + String.valueOf(event.getClient().getGuilds().size()) + " Servers"));
}
 
开发者ID:nbd9,项目名称:PastaBot,代码行数:5,代码来源:InterfaceListener.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RasterGraphics类代码示例发布时间:2022-05-22
下一篇:
Java GeoPackageException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap