本文整理汇总了Java中sx.blah.discord.util.MessageBuilder.withChannel方法的典型用法代码示例。如果您正苦于以下问题:Java MessageBuilder.withChannel方法的具体用法?Java MessageBuilder.withChannel怎么用?Java MessageBuilder.withChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sx.blah.discord.util.MessageBuilder
的用法示例。
在下文中一共展示了MessageBuilder.withChannel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleTemplate
import sx.blah.discord.util.MessageBuilder; //导入方法依赖的package包/类
@Override
public String handleTemplate(String msg, Interaction interaction, MessageBuilder response, MessageReceivedEvent event) {
try {
response.withChannel(Karren.bot.getClient().getOrCreatePMChannel(event.getMessage().getAuthor()));
} catch (DiscordException | RateLimitException e) {
e.printStackTrace();
return "Template handler error, couldn't open private message channel!";
}
return msg;
}
示例2: handle
import sx.blah.discord.util.MessageBuilder; //导入方法依赖的package包/类
@Override
public void handle(MessageReceivedEvent event) {
if(event.getMessage().getContent().startsWith(Karren.bot.getGuildManager().getCommandPrefix(event.getGuild()) + "stats")){
MessageBuilder msg = new MessageBuilder(event.getClient());
msg.withChannel(event.getChannel());
msg.withContent("**Karren-sama Stats**");
msg.appendContent("```Bot Uptime: " + KarrenUtil.calcAway(Karren.startTime));
msg.appendContent("\n-------------Build Info-------------");
msg.appendContent("\nBot Version: " + Karren.botVersion);
msg.appendContent("\nCommit ID: " + Karren.jarProps.getProperty("git.commit.id"));
msg.appendContent("\nCommit Time: " + Karren.jarProps.getProperty("git.commit.time"));
msg.appendContent("\nCommit Message: " + Karren.jarProps.getProperty("git.commit.message.full"));
msg.appendContent("\nBuild Branch: " + Karren.jarProps.getProperty("git.branch"));
msg.appendContent("\n-------------Bot Status-------------");
msg.appendContent("\nConnected Guilds: " + Karren.bot.getClient().getGuilds().size());
msg.appendContent("\nConnected Shards: " + Karren.bot.getClient().getShardCount());
msg.appendContent("\nConnected Voice Channels: " + Karren.bot.getClient().getConnectedVoiceChannels().size());
msg.appendContent("\nInteraction System Tags: " + Karren.bot.getGuildManager().getTagHandlers().size());
msg.appendContent("\nTotal Users Visable: " + Karren.bot.getClient().getUsers().size());
msg.appendContent("\nWatchdog Interventions: " + Karren.watchdog.watchdogInterventions);
msg.appendContent("\n-------------Cache Status-------------");
msg.appendContent("\nCached Reminders: " + Karren.bot.getSql().getDbReminderCache().size());
msg.appendContent("\nCached Users: " + Karren.bot.getSql().getDbUserCache().size());
msg.appendContent("\nCached Guild Users: " + Karren.bot.getSql().getDbGuildUserCache().size());
msg.appendContent("\nCached Guilds: " + Karren.bot.getSql().getDbGuildCache().size());
msg.appendContent("\nCached Word Counts: " + Karren.bot.getSql().getDbWordcountCache().size());
msg.appendContent("```");
msg.send();
}
}
示例3: handleTemplate
import sx.blah.discord.util.MessageBuilder; //导入方法依赖的package包/类
@Override
public String handleTemplate(String msg, Interaction interaction, MessageBuilder response, MessageReceivedEvent event) {
response.withChannel(Karren.bot.getClient().getChannelByID(Long.getLong(interaction.getChannel())));
return msg;
}