forked from Fascinated/Bat
fix npe
This commit is contained in:
parent
11e7ca4aa6
commit
271a1cf88d
@ -64,7 +64,7 @@ public class MemberListener implements EventListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuildMemberLeave(@NonNull BatGuild guild, BatUser user, @NonNull GuildMemberRemoveEvent event) {
|
public void onGuildMemberLeave(@NonNull BatGuild guild, BatUser user, @NonNull GuildMemberRemoveEvent event) {
|
||||||
if (user.getDiscordUser().isBot()) return;
|
if (user == null || user.getDiscordUser().isBot()) return;
|
||||||
log.info("User \"{}\" left the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
|
log.info("User \"{}\" left the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
|
||||||
|
|
||||||
logFeature.sendLog(guild, LogType.MEMBER_LEAVE, EmbedUtils.errorEmbed()
|
logFeature.sendLog(guild, LogType.MEMBER_LEAVE, EmbedUtils.errorEmbed()
|
||||||
|
@ -12,12 +12,12 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class MongoService {
|
public class MongoService {
|
||||||
public static MongoService INSTANCE;
|
public static MongoService INSTANCE;
|
||||||
private final MongoTemplate mongo;
|
private final MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public MongoService(MongoTemplate mongo) {
|
public MongoService(MongoTemplate mongo) {
|
||||||
INSTANCE = this;
|
INSTANCE = this;
|
||||||
this.mongo = mongo;
|
this.mongoTemplate = mongo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,7 +26,7 @@ public class MongoService {
|
|||||||
* @return The guilds collection
|
* @return The guilds collection
|
||||||
*/
|
*/
|
||||||
public MongoCollection<Document> getGuildsCollection() {
|
public MongoCollection<Document> getGuildsCollection() {
|
||||||
return mongo.getCollection("guilds");
|
return mongoTemplate.getCollection("guilds");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,6 +35,6 @@ public class MongoService {
|
|||||||
* @return The users collection
|
* @return The users collection
|
||||||
*/
|
*/
|
||||||
public MongoCollection<Document> getUsersCollection() {
|
public MongoCollection<Document> getUsersCollection() {
|
||||||
return mongo.getCollection("users");
|
return mongoTemplate.getCollection("users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user