本文整理汇总了Java中sx.blah.discord.handle.impl.events.guild.GuildCreateEvent类的典型用法代码示例。如果您正苦于以下问题:Java GuildCreateEvent类的具体用法?Java GuildCreateEvent怎么用?Java GuildCreateEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GuildCreateEvent类属于sx.blah.discord.handle.impl.events.guild包,在下文中一共展示了GuildCreateEvent类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onGuildCreate
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@EventSubscriber
public void onGuildCreate(GuildCreateEvent event) {
Console.println("==================NEW SERVER |" + event.getGuild().getName() + "| " + event.getGuild().getStringID());
if (SERVER_CONTROL.checkServerisBanned(event.getGuild())) {
Console.println("Leave Banned Server: "+event.getGuild().getName());
BotUtils.sendPrivMessage(event.getGuild().getOwner().getOrCreatePMChannel(), "Your Server is on the banned Server List. Please contact [email protected] and describe why do you want to get unbanned.", false);
event.getGuild().leave();
} else {
if (running) {
Stats.addServer(event.getGuild());
Console.debug("Adding Permission for new Server");
List<IGuild> server = new ArrayList<>();
server.add(event.getGuild());
PERM.setDefaultPermissions(server, true);
Console.debug("Adding Disabled Server for new Server");
saveGuild(event.getGuild());
DRIVER.saveJson();
}
Console.debug("===================new Server added====");
}
}
开发者ID:ModdyLP,项目名称:MoMuOSB,代码行数:22,代码来源:ServerListener.java
示例2: onGuildCreate
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@EventSubscriber
public void onGuildCreate(GuildCreateEvent event) {
if (event.getGuild() == null) {
return;
}
discordToMinecraft = new ArrayList<>();
minecraftToDiscord = new ArrayList<>();
List<String> dTm = getConfig().getStringList("settings.channels.discord_to_minecraft");
List<String> mTd = getConfig().getStringList("settings.channels.minecraft_to_discord");
for (IChannel channel : getClient().getChannels(false)) {
if (dTm.contains(channel.getName())) {
discordToMinecraft.add(channel);
}
if (mTd.contains(channel.getName())) {
minecraftToDiscord.add(channel);
}
}
getLogger().info("Successfully logged in with '" + event.getClient().getOurUser().getName() + "'");
}
开发者ID:manuelgu,项目名称:DiscordMC,代码行数:24,代码来源:DiscordMC.java
示例3: onGuildEvent
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@EventSubscriber
public void onGuildEvent(GuildEvent event) {
ShardManager.getThreadPool(event.getGuild()).execute(() -> {
if(event instanceof GuildCreateEvent) {
this.onGuildCreateEvent((GuildCreateEvent) event);
} else if(event instanceof GuildLeaveEvent) {
this.onGuildLeaveEvent((GuildLeaveEvent) event);
}
});
}
开发者ID:Shadorc,项目名称:Shadbot,代码行数:11,代码来源:GuildListener.java
示例4: onGuildCreateEvent
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
/**
* Guild create event fires when a guild connects or the bot joins the guild
* @param e
*/
@EventSubscriber
public void onGuildCreateEvent(GuildCreateEvent e) {
File f;
if(!(f = new File("resources/guilds/" + e.getGuild().getID() +"/")).exists()) {
try {
FileUtils.forceMkdir(f);
FileUtils.copyFile(new File("resources/guilds/template.properties"),
new File("resources/guilds/" + e.getGuild().getID()+"/GuildProperties.properties"));
FileUtils.copyFile(new File("resources/guilds/template.db"),
new File("resources/guilds/" + e.getGuild().getID()+"/Data.db"));
FileUtils.copyFile(new File("resources/guilds/template.json"),
new File("resources/guilds/" + e.getGuild().getID()+"/IdlePlaylist.json"));
Bot.getInstance().getLogger().info("Guild has joined: {}", e.getGuild().getName());
} catch (IOException e1) {
e1.printStackTrace();
}
}
Guild g = new Guild(e.getGuild());
if(g.getGuildConfig().isFirstTime()) {
MessageUtils.sendMessage(e.getGuild().getChannels().get(0), "Hi, I'm Momo! You are my "
+ Util.ordinal(Bot.getInstance().getBot().getGuilds().size()) + " server.\n"
+ "If you want a list of commands, use `$commandlist`. If you want some tutorials on my features, "
+ "do `$howto` - I suggest doing `$howto setup` immediately. For easy, one time configuration, do `$configure`");
Guild.guildMap.get(e.getGuild().getID()).getGuildConfig().setFirstTime(false);
}
}
开发者ID:paul-io,项目名称:momo-discord-old,代码行数:33,代码来源:Listeners.java
示例5: onGuildCreateEvent
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
private void onGuildCreateEvent(GuildCreateEvent event) {
LogUtils.infof("Shadbot connected to a guild. (ID: %d | Users: %d)",
event.getGuild().getLongID(), event.getGuild().getUsers().size());
}
开发者ID:Shadorc,项目名称:Shadbot,代码行数:5,代码来源:GuildListener.java
示例6: onReady
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@EventSubscriber
public void onReady(GuildCreateEvent event) {
ClientConfig.setSentryContext(event.getGuild(), null, null, null);
if(!Guild.getGuilds().containsKey(event.getGuild().getStringID())) {
Guild guild = new Guild(event.getGuild().getStringID(), event.getGuild().getName(),
Translator.detectLanguage(event.getGuild().getDefaultChannel()));
guild.addToDatabase();
Language lg = guild.getLanguage();
LOG.info("La guilde " + guild.getId() + " - " + guild.getName() + " a ajouté " + Constants.name);
String customMessage = Translator.getLabel(lg, "welcome.message");
customMessage = customMessage
.replaceAll("\\{name\\}", Constants.name)
.replaceAll("\\{game\\}", Constants.game)
.replaceAll("\\{prefix\\}", Constants.prefixCommand)
.replaceAll("\\{help\\}", HelpCommand.NAME)
.replaceAll("\\{server\\}", new ServerCommand().getName())
.replaceAll("\\{lang\\}", new LanguageCommand().getName())
.replaceAll("\\{twitter\\}", new TwitterCommand().getName())
.replaceAll("\\{almanax\\}", new AlmanaxCommand().getName())
.replaceAll("\\{rss\\}", new RSSCommand().getName())
.replaceAll("\\{owner\\}", event.getGuild().getOwner().mention())
.replaceAll("\\{guild\\}", event.getGuild().getName());
if(event.getGuild().getDefaultChannel() != null && event.getGuild().getDefaultChannel()
.getModifiedPermissions(ClientConfig.DISCORD().getOurUser())
.contains(Permissions.SEND_MESSAGES))
Message.sendText(event.getGuild().getDefaultChannel(), customMessage);
else try {
Message.sendText(event.getGuild().getOwner().getOrCreatePMChannel(), customMessage);
} catch(DiscordException e){
LOG.warn("onReady", "Impossible de contacter l'administrateur de la guilde ["
+ guild.getName() + "].");
}
Message.sendText(ClientConfig.DISCORD().getChannelByID(Constants.chanReportID),
"[NEW] **" + guild.getName() + "** (" + guild.getLanguage().getAbrev() + "), +"
+ event.getGuild().getUsers().size() + " utilisateurs");
}
}
开发者ID:Kaysoro,项目名称:KaellyBot,代码行数:45,代码来源:GuildCreateListener.java
示例7: onReady
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@EventSubscriber
public void onReady(ReadyEvent event) {
LOG.info(Constants.name + "Bot connecté !");
LOG.info("Ajout des différents listeners");
ClientConfig.DISCORD().getDispatcher().registerListener(new GuildCreateListener());
ClientConfig.DISCORD().getDispatcher().registerListener(new GuildLeaveListener());
ClientConfig.DISCORD().getDispatcher().registerListener(new GuildUpdateListener());
ClientConfig.DISCORD().getDispatcher().registerListener(new ChannelDeleteListener());
ClientConfig.DISCORD().getDispatcher().registerListener(new TrackFinishListener());
LOG.info("Check des guildes");
for(IGuild guild : ClientConfig.DISCORD().getGuilds())
if (Guild.getGuilds().containsKey(guild.getStringID())
&& !guild.getName().equals(Guild.getGuild(guild).getName()))
Guild.getGuild(guild).setName(guild.getName());
else
ClientConfig.DISCORD().getDispatcher().dispatch(new GuildCreateEvent(guild));
// Check des guildes éventuellement supprimé durant l'absence
List<String> ids = new ArrayList<>(Guild.getGuilds().keySet());
for(String guildID : ids)
if (ClientConfig.DISCORD().getGuildByID(Long.parseLong(guildID)) == null) {
LOG.info(Guild.getGuilds().get(guildID).getName() + " a supprimé "
+ Constants.name + " en son absence.");
Guild.getGuilds().get(guildID).removeToDatabase();
}
// Joue à...
ClientConfig.DISCORD().changePresence(StatusType.ONLINE, ActivityType.WATCHING, Constants.discordInvite);
LOG.info("Ecoute des flux RSS du site Dofus...");
RSSFinder.start();
LOG.info("Récupération des positions de portails...");
PortalFinder.start();
LOG.info("Lancement du calendrier Almanax...");
AlmanaxCalendar.start();
LOG.info("Connexion à l'API Twitter...");
TwitterFinder.start();
LOG.info("Ecoute des messages...");
ClientConfig.DISCORD().getDispatcher().registerListener(new MessageListener());
}
开发者ID:Kaysoro,项目名称:KaellyBot,代码行数:48,代码来源:ReadyListener.java
示例8: handle
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@Override
public void handle(GuildCreateEvent guildCreateEvent) {
GuildMusicManager gm = Karren.bot.createGuildMusicManager(guildCreateEvent.getGuild());
guildCreateEvent.getGuild().getAudioManager().setAudioProvider(gm.getAudioProvider());
Karren.log.info("Guild " + guildCreateEvent.getGuild().getName() + " has been registered with the database, and a GuildMusicManager has been spawned.");
}
开发者ID:ripxfrostbite,项目名称:karren-sama,代码行数:7,代码来源:GuildCreateListener.java
示例9: onGuildJoin
import sx.blah.discord.handle.impl.events.guild.GuildCreateEvent; //导入依赖的package包/类
@EventSubscriber
public void onGuildJoin(GuildCreateEvent event) {
}
开发者ID:chrislo27,项目名称:Baristron,代码行数:5,代码来源:Baristron.java
注:本文中的sx.blah.discord.handle.impl.events.guild.GuildCreateEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论