implement logging feature base
This commit is contained in:
@ -5,6 +5,7 @@ import cc.fascinated.bat.common.ProfileHolder;
|
||||
import cc.fascinated.bat.common.Serializable;
|
||||
import cc.fascinated.bat.features.base.profile.FeatureProfile;
|
||||
import cc.fascinated.bat.features.birthday.profile.BirthdayProfile;
|
||||
import cc.fascinated.bat.features.logging.LogProfile;
|
||||
import cc.fascinated.bat.features.namehistory.profile.guild.NameHistoryProfile;
|
||||
import cc.fascinated.bat.premium.PremiumProfile;
|
||||
import cc.fascinated.bat.service.DiscordService;
|
||||
@ -109,6 +110,15 @@ public class BatGuild extends ProfileHolder {
|
||||
return getProfile(BirthdayProfile.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the log profile
|
||||
*
|
||||
* @return the log profile
|
||||
*/
|
||||
public LogProfile getLogProfile() {
|
||||
return getProfile(LogProfile.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the user
|
||||
*/
|
||||
|
@ -1,8 +1,11 @@
|
||||
package cc.fascinated.bat.model;
|
||||
|
||||
import cc.fascinated.bat.service.DiscordService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import org.springframework.data.redis.core.RedisHash;
|
||||
|
||||
/**
|
||||
@ -46,4 +49,31 @@ public class DiscordMessage {
|
||||
* Whether the message was deleted
|
||||
*/
|
||||
private boolean deleted;
|
||||
|
||||
/**
|
||||
* Gets the author of the message
|
||||
*
|
||||
* @return the author
|
||||
*/
|
||||
public User getAuthor() {
|
||||
return DiscordService.JDA.getUserById(this.authorId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the channel the message was sent in
|
||||
*
|
||||
* @return the channel
|
||||
*/
|
||||
public TextChannel getChannel() {
|
||||
return DiscordService.JDA.getTextChannelById(this.channelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL of the message
|
||||
*
|
||||
* @return the URL
|
||||
*/
|
||||
public String getMessageUrl() {
|
||||
return "https://discord.com/channels/%s/%s/%s".formatted(this.guildId, this.channelId, this.id);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user