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

Java RoleDeleteEvent类代码示例

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

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



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

示例1: onRoleDelete

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
@Override
public void onRoleDelete(RoleDeleteEvent event) {
    GuildTransformer transformer = GuildController.fetchGuild(avaire, event.getGuild());
    if (transformer == null || transformer.getSelfAssignableRoles().isEmpty()) {
        return;
    }

    if (!transformer.getSelfAssignableRoles().containsKey(event.getRole().getId())) {
        return;
    }

    try {
        transformer.getSelfAssignableRoles().remove(event.getRole().getId());
        avaire.getDatabase().newQueryBuilder(Constants.GUILD_TABLE_NAME)
            .where("id", event.getGuild().getId())
            .update(statement -> {
                statement.set("claimable_roles", AvaIre.GSON.toJson(transformer.getSelfAssignableRoles()), true);
            });
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
开发者ID:avaire,项目名称:avaire,代码行数:23,代码来源:GuildRoleDelete.java


示例2: onRoleDelete

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
@Override
public void onRoleDelete(RoleDeleteEvent e) {
	GuildObject g = GuildObject.guildMap.get(e.getGuild().getId());
	String roleId = e.getRole().getId();
	// Joinable
	if (g.isJoinableRole(e.getRole().getId())) {
		g.removeJoinableRole(e.getRole().getId());
	}
	// Auto assign
	if (g.getConfig().getAutoAssignRoleId().equals(roleId)) {
		g.getConfig().setAutoAssignRoleId("");
	}
	// DJ
	if (g.getConfig().getDjRoleId().equals(roleId)) {
		g.getConfig().setDjRoleId("");
	}
	// Mute
	if (g.getConfig().getMutedRoleId().equals(roleId)) {
		g.getConfig().setMutedRoleId("");
	}

}
 
开发者ID:paul-io,项目名称:momo-2,代码行数:23,代码来源:Listeners.java


示例3: handleRoleDeletion

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
public static void handleRoleDeletion(RoleDeleteEvent event) {
    File file = new File("data/ranks/" + event.getGuild().getId() + ".dat");
    Configuration ranks = new Configuration(file);
    Role role = event.getRole();
    if (!isRank(role)) return;
    ranks.unset(role.getName());
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:8,代码来源:CommandRanks.java


示例4: handleInternally

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
@Override
protected Long handleInternally(JSONObject content)
{
    final long guildId = content.getLong("guild_id");
    if (api.getGuildLock().isLocked(guildId))
        return guildId;

    GuildImpl guild = (GuildImpl) api.getGuildMap().get(guildId);
    if (guild == null)
    {
        api.getEventCache().cache(EventCache.Type.GUILD, guildId, () -> handle(responseNumber, allContent));
        EventCache.LOG.debug("GUILD_ROLE_DELETE was received for a Guild that is not yet cached: {}", content);
        return null;
    }

    final long roleId = content.getLong("role_id");
    Role removedRole = guild.getRolesMap().remove(roleId);
    if (removedRole == null)
    {
        api.getEventCache().cache(EventCache.Type.ROLE, roleId, () -> handle(responseNumber, allContent));
        EventCache.LOG.debug("GUILD_ROLE_DELETE was received for a Role that is not yet cached: {}", content);
        return null;
    }

    //Now that the role is removed from the Guild, remove it from all users.
    for (Member m : guild.getMembersMap().valueCollection())
    {
        MemberImpl member = (MemberImpl) m;
        member.getRoleSet().remove(removedRole);
    }
    api.getEventManager().handle(
            new RoleDeleteEvent(
                    api, responseNumber,
                    removedRole));
    api.getEventCache().clear(EventCache.Type.ROLE, roleId);
    return null;
}
 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:38,代码来源:GuildRoleDeleteHandler.java


示例5: onRoleDelete

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
@Override
public void onRoleDelete(RoleDeleteEvent event) {
    CommandRanks.handleRoleDeletion(event);
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:5,代码来源:RoleListener.java


示例6: onEvent

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
@Override
public void onEvent(Event event) {

	if (event instanceof ReconnectedEvent || event instanceof ResumedEvent) {
		ConstellationManager.restartConstellation();
		System.out.println("Constellation has been restarted due to a Discord reconnect.");
	} else if (event instanceof GenericGuildEvent) {
		GenericGuildEvent gge = ((GenericGuildEvent) event);

		if (event instanceof GuildMemberJoinEvent) {
			GuildMemberJoinEvent gmje = ((GuildMemberJoinEvent) gge);

			List<BTBRole> roles = DbManager.readTeamRolesForGuild(Long.parseLong(gmje.getGuild().getId()));

			for (BTBRole role : roles) {
				List<BeamTeamUser> teamMembers = BeamManager.getTeamMembers(role.getTeamID());

				for (BeamTeamUser member : teamMembers) {
					if (null != member.social && StringUtils.isNotBlank(member.social.discord)) {
						if (StringUtils.containsIgnoreCase(member.social.discord,
								gmje.getMember().getUser().getName())) {
							JDAManager.giveTeamRoleToUser(role, gmje.getMember().getUser());
							break;
						}
					}
				}
			}
		} else if (event instanceof GuildJoinEvent) {
			GuildManager.getGuild(gge.getGuild());
			System.out.println(String.format("%s has added the bot, they have been added to the database.",
					gge.getGuild().getName()));
		} else if (event instanceof GuildLeaveEvent) {
			GuildManager.deleteGuild(Long.parseLong(gge.getGuild().getId()));
			System.out.println(String.format(
					"%s has removed the bot, they and all relevant records have been purged from the database.",
					gge.getGuild().getName()));
		}
	} else if (event instanceof RoleDeleteEvent) {
		// TODO: delete role config from DB
	}
}
 
开发者ID:StreamerSpectrum,项目名称:BeamTeamDiscordBot,代码行数:42,代码来源:BTBListener.java


示例7: onRoleDelete

import net.dv8tion.jda.core.events.role.RoleDeleteEvent; //导入依赖的package包/类
public void onRoleDelete(RoleDeleteEvent event) {} 
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:2,代码来源:ListenerAdapter.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java DisplayType类代码示例发布时间:2022-05-22
下一篇:
Java ModelReader类代码示例发布时间: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