🚑 Load user of guild on load + fetch on api call for mutuals guilds
This commit is contained in:
parent
606d223361
commit
fdb118fb53
@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Service
|
||||
public class GuildService {
|
||||
public List<Guild> getMutualGuilds(UserEntity user) {
|
||||
User discordUser = CacheTools.getJdaUser(user);
|
||||
User discordUser = MainBot.jda.retrieveUserById(user.getDiscordId()).complete();
|
||||
List<net.dv8tion.jda.api.entities.Guild> mutualGuilds = discordUser.getMutualGuilds();
|
||||
List<Guild> guildList = new ArrayList<>();
|
||||
|
||||
|
@ -193,6 +193,9 @@ public class BotListener extends ListenerAdapter {
|
||||
logger.info("Join new guild! (" + event.getGuild().getName() + " " + event.getGuild().getMembers().size() + " Members)");
|
||||
super.onGuildJoin(event);
|
||||
getPreference(event.getGuild());
|
||||
event.getGuild().loadMembers().onSuccess((members -> {
|
||||
logger.debug("[" + event.getGuild().getName() + "] Members loaded");
|
||||
}));
|
||||
EmbedBuilder eb = new EmbedBuilder().setColor(Color.GREEN)
|
||||
.setTitle("Hello there !")
|
||||
.setDescription("Allow me to introduce myself -- I am a CL4P-TP the discord bot, but my friends call me Claptrap ! Or they would, if any of them were real...\n" +
|
||||
@ -207,6 +210,7 @@ public class BotListener extends ListenerAdapter {
|
||||
for (TextChannel chan : event.getGuild().getTextChannels()) {
|
||||
if (chan.canTalk()) {
|
||||
chan.sendMessage(message).queue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user