mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-25 12:25:15 +01:00
Username fixes
This commit is contained in:
parent
3d6c7f72de
commit
8de37ce767
@ -56,6 +56,14 @@ public interface DiscordUser extends JDAEntity<User>, Snowflake, Mentionable {
|
||||
@NotNull
|
||||
String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the effective display name of the Discord user.
|
||||
* @return the user's effective display name
|
||||
*/
|
||||
@Placeholder("user_effective_name")
|
||||
@NotNull
|
||||
String getEffectiveName();
|
||||
|
||||
/**
|
||||
* Gets the Discord user's discriminator.
|
||||
* @return the user's discriminator
|
||||
@ -85,7 +93,7 @@ public interface DiscordUser extends JDAEntity<User>, Snowflake, Mentionable {
|
||||
* Gets the Discord user's username followed by a {@code #} and their discriminator.
|
||||
* @return the Discord user's username and discriminator in the following format {@code Username#1234}
|
||||
*/
|
||||
@Placeholder("user_tag")
|
||||
@Deprecated
|
||||
default String getAsTag() {
|
||||
return getUsername() + "#" + getDiscriminator();
|
||||
}
|
||||
|
@ -94,18 +94,18 @@ public interface DiscordGuildMember extends JDAEntity<Member>, Mentionable {
|
||||
* Gets the effective name of this Discord server member.
|
||||
* @return the Discord server member's effective name
|
||||
*/
|
||||
@Placeholder("user_effective_name")
|
||||
@Placeholder("user_effective_server_name")
|
||||
@NotNull
|
||||
default String getEffectiveName() {
|
||||
default String getEffectiveServerName() {
|
||||
String nickname = getNickname();
|
||||
return nickname != null ? nickname : getUser().getUsername();
|
||||
return nickname != null ? nickname : getUser().getEffectiveName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the avatar url that is active for this user in this server.
|
||||
* @return the user's avatar url in this server
|
||||
*/
|
||||
@Placeholder("user_effective_avatar_url")
|
||||
@Placeholder("user_effective_server_avatar_url")
|
||||
@NotNull
|
||||
String getEffectiveServerAvatarUrl();
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class DebugCommand extends CombinedCommand {
|
||||
String key = new String(KEY_ENCODER.encode(paste.decryptionKey()), StandardCharsets.UTF_8);
|
||||
String url = String.format(URL_FORMAT, paste.id(), key);
|
||||
|
||||
execution.send(new Text(url));
|
||||
execution.send(new Text(url)); // TODO: fix in-game click
|
||||
return null;
|
||||
} catch (Throwable e) {
|
||||
return e;
|
||||
|
@ -35,11 +35,11 @@ public class DiscordToMinecraftChatConfig {
|
||||
|
||||
@Comment("The Discord to Minecraft message format for regular users and bots")
|
||||
@Untranslated(Untranslated.Type.VALUE)
|
||||
public String format = "[ᛩF2Discord&r] [hover:show_text:Tag: %user_tag%&r\nRoles: %user_roles:', '|text:'&7&oNone'%]%user_color%%user_effective_name%&r » %message%%message_attachments%";
|
||||
public String format = "[ᛩF2Discord&r] [hover:show_text:Tag: %user_tag%&r\nRoles: %user_roles:', '|text:'&7&oNone'%]%user_color%%user_effective_server_name%&r » %message%%message_attachments%";
|
||||
|
||||
@Comment("The Discord to Minecraft message format for webhook messages (if enabled)")
|
||||
@Untranslated(Untranslated.Type.VALUE)
|
||||
public String webhookFormat = "[ᛩF2Discord&r] [hover:show_text:Webhook message]%user_name%&r » %message%%message_attachments%";
|
||||
public String webhookFormat = "[ᛩF2Discord&r] [hover:show_text:Webhook message]%user_effective_name%&r » %message%%message_attachments%";
|
||||
|
||||
@Comment("Attachment format")
|
||||
@Untranslated(Untranslated.Type.VALUE)
|
||||
@ -61,7 +61,7 @@ public class DiscordToMinecraftChatConfig {
|
||||
|
||||
public Format role = new Format("ᛩf2@%role_name%", "ᛩf2@deleted-role");
|
||||
public Format channel = new Format("[hover:show_text:Click to go to channel][click:open_url:%channel_jump_url%]ᛩf2#%channel_name%", "ᛩf2#deleted-channel");
|
||||
public Format user = new Format("[hover:show_text:Tag: %user_tag%&r\nRoles: %user_roles:', '|text:'&7&oNone'%]ᛩf2@%user_effective_name|user_name%", "ᛩf2@Unknown user");
|
||||
public Format user = new Format("[hover:show_text:Username: @%user_name%&r\nRoles: %user_roles:', '|text:'&7&oNone'%]ᛩf2@%user_effective_server_name|user_effective_name%", "ᛩf2@Unknown user");
|
||||
|
||||
public String messageUrl = "[hover:show_text:Click to go to message][click:open_url:%jump_url%]ᛩf2#%channel_name% > ...";
|
||||
|
||||
|
@ -33,10 +33,10 @@ public class MirroringConfig {
|
||||
@Comment("The format of the username of mirrored messages\n"
|
||||
+ "It's recommended to include some special character if in-game messages use webhooks,\n"
|
||||
+ "in order to prevent Discord users and in-game players with the same name being grouped together")
|
||||
public String usernameFormat = "%user_effective_name% \uD83D\uDD03";
|
||||
public String usernameFormat = "%user_effective_server_name|user_effective_name% \uD83D\uDD03";
|
||||
|
||||
@Comment("Content to append to the beginning of a message if the message is replying to another")
|
||||
public String replyFormat = "[In reply to %user_effective_name|user_name%](%message_jump_url%)\n";
|
||||
public String replyFormat = "[In reply to %user_effective_server_name|user_effective_name%](%message_jump_url%)\n";
|
||||
|
||||
@Comment("Attachment related options")
|
||||
public AttachmentConfig attachments = new AttachmentConfig();
|
||||
|
@ -61,6 +61,11 @@ public class DiscordUserImpl implements DiscordUser {
|
||||
return user.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getEffectiveName() {
|
||||
return user.getEffectiveName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getDiscriminator() {
|
||||
return user.getDiscriminator();
|
||||
|
@ -638,7 +638,7 @@ public class JDAConnectionManager implements DiscordConnectionManager {
|
||||
discordSRV.logger().error("| server requiring 2FA for moderation actions");
|
||||
if (user != null) {
|
||||
discordSRV.logger().error("|");
|
||||
discordSRV.logger().error("| The Discord bot's owner is " + user.getAsTag() + " (" + user.getId() + ")");
|
||||
discordSRV.logger().error("| The Discord bot's owner is " + user.getUsername() + " (" + user.getId() + ")");
|
||||
}
|
||||
discordSRV.logger().error("|");
|
||||
discordSRV.logger().error("| You can view instructions for enabling 2FA here:");
|
||||
|
Loading…
Reference in New Issue
Block a user