本文整理汇总了Java中net.dv8tion.jda.core.entities.Guild.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Guild.getId方法的具体用法?Java Guild.getId怎么用?Java Guild.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dv8tion.jda.core.entities.Guild
的用法示例。
在下文中一共展示了Guild.getId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IGuildSettings
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
/**
* Create a {@link GuildSettings} instance
* @param guild The Guild those settings are being linked to.
* @param bot A {@link LegendaryBot} instance.
*/
public IGuildSettings(Guild guild, LegendaryBot bot) {
this.bot = bot;
this.guildId = guild.getId();
try {
Connection conn = bot.getDatabase().getConnection();
PreparedStatement statement = conn.prepareStatement("SELECT configName,configValue FROM guild_config WHERE guildId=?");
statement.setString(1, guildId);
ResultSet set = statement.executeQuery();
while (set.next()) {
settings.put(set.getString("configName"),set.getString("configValue"));
}
set.close();
statement.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
bot.getStacktraceHandler().sendStacktrace(e, "guildId:" + guildId);
}
}
示例2: getMusicManager
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
private GuildMusicManager getMusicManager(Guild guild)
{
String guildId = guild.getId();
GuildMusicManager mng = musicManagers.get(guildId);
if (mng == null)
{
synchronized (musicManagers)
{
mng = musicManagers.get(guildId);
if (mng == null)
{
mng = new GuildMusicManager(playerManager);
mng.player.setVolume(DEFAULT_VOLUME);
musicManagers.put(guildId, mng);
}
}
}
return mng;
}
示例3: Server
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
public Server(Guild guild) {
this.guild = guild;
this.id = guild.getId();
Utils.createDir(String.format("%s/%s", "app_data", id));
qm = new QueueManager(id);
cmds = new Commands();
settings = new Settings(id);
qm.getQueueList().forEach((q) -> q.getPlayersInQueue().forEach((u) -> updateActivityList(u)));
// Insert guild into database
Database.insertDiscordServer(guild.getIdLong(), guild.getName());
// Insert members into database
for(Member m : guild.getMembers()){
Database.insertPlayer(m.getUser().getIdLong(), m.getEffectiveName());
Database.insertPlayerServer(guild.getIdLong(), m.getUser().getIdLong());
}
banList = Database.queryGetBanList(guild.getIdLong());
adminList = Database.queryGetAdminList(guild.getIdLong());
startAFKTimer();
}
示例4: resolveGuildId
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
public static final long resolveGuildId(Guild guild, String guild_id) {
if (guild != null && guild_id != null && (guild_id.equalsIgnoreCase("this") || guild_id.equalsIgnoreCase("current"))) {
guild_id = guild.getId();
} else if (guild_id != null && (guild_id.equalsIgnoreCase("user") || guild_id.equalsIgnoreCase("me"))) {
return -1;
} else if (guild_id == null || guild_id.equalsIgnoreCase("0")) {
return 0;
}
return resolveGuildId(guild_id);
}
示例5: GuildPlayer
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
@SuppressWarnings("LeakingThisInConstructor")
public GuildPlayer(JDA jda, Guild guild) {
this.jda = jda;
this.guildId = guild.getId();
subscriber = streamCombiner.subscribe();
AudioManager manager = guild.getAudioManager();
manager.setSendingHandler(this);
}
示例6: getMusicManager
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
/**
* Initialize music manager if not found and set audio provider
* @param g Guild
* @return GuildMusicManager
*/
public GuildMusicManager getMusicManager(Guild g) {
if (this.musicManager == null) {
this.musicManager = new GuildMusicManager(AudioManager.getMasterManager(), g.getId());
g.getAudioManager().setSendingHandler(this.musicManager.getSendHandler());
}
return this.musicManager;
}
示例7: getCompleteName
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
public static final String getCompleteName(Guild guild) {
if (guild == null) {
return null;
}
return "<" + guild.getName() + "#" + guild.getId() + ">";
}
示例8: onReady
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
@Override
public void onReady(ReadyEvent event){
String out = "\n This bot is running on the following servers: \n";
for (Guild g : event.getJDA().getGuilds()){
out += g.getName() + " (" + g.getId() + ") \n";
}
System.out.println(out);
STATICS.lastRestart = new Date();
Vote.loadPolls(event.getJDA());
}
示例9: run
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
public Result run(String[] argsOrig, MessageReceivedEvent e) {
//Check for proper argument length
if (argsOrig.length < 1) {
return new Result(Outcome.WARNING, ":warning: Please specify a guild.");
}
//Get guild
String[] args = ArrayUtils.remove(MessageUtils.getContent(e.getMessage(), true), 0);
Guild guild = null;
if (args[0].matches(MessageUtils.idRegex)) {
guild = DiscordUtils.getGuildById(args[0]);
} else {
return new Result(Outcome.ERROR, ":x: Not a valid guild!");
}
//Check for permissions
if (!guild.getSelfMember().hasPermission(Permission.NICKNAME_CHANGE)) {
return new Result(Outcome.WARNING, ":warning: No permissions!");
}
//Set the nickname
String name = Config.getName();
if (args.length > 1) {
name = String.join(" ", ArrayUtils.remove(args, 0));
}
guild.getController().setNickname(guild.getSelfMember(), name).queue();
//Log it
EmbedBuilder eb = new EmbedBuilder();
eb.setAuthor(e.getAuthor().getName() + " (" + e.getAuthor().getId() + ")",
null, e.getAuthor().getAvatarUrl());
String desc = null;
if (args.length == 1) {
desc = "**Reset nickname on `" + guild.getName() + "` (" + guild.getId() + "):**";
} else {
desc = "**Changed nickname on `" + guild.getName() + "` (" + guild.getId() + "):**\n" + name;
}
eb.setDescription(desc);
eb.setThumbnail(guild.getIconUrl());
MessageUtils.log(eb.build());
return new Result(Outcome.SUCCESS);
}
示例10: DefaultRole
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
public DefaultRole(Role role, Guild guild) {
this.guildID = guild.getId();
this.roleID = role.getId();
}
示例11: buildServer
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
private String buildServer(Guild server) {
return server.getName() + " (ID: " + server.getId() + ")";
}
示例12: getCacheString
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
public static String getCacheString(Guild guild) {
return CACHE_STRING + guild.getId();
}
示例13: play
import net.dv8tion.jda.core.entities.Guild; //导入方法依赖的package包/类
private static void play(Guild guild, AudioTrack track, String trackUrl, String titleOverride, Member member) {
TrackDetails details = new TrackDetails(trackUrl, titleOverride, member, track, guild.getId());
AudioManager.getGuildManager(guild).trackManager.queue(details);
}