Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
jagrosh committed May 27, 2021
2 parents aec4c29 + ddcbba0 commit dc39509
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![CodeFactor](https://www.codefactor.io/repository/github/jagrosh/vortex/badge)](https://www.codefactor.io/repository/github/jagrosh/vortex)
<br>
[![PrivacyPolicy](https://img.shields.io/badge/Privacy%20Policy--lightgrey.svg?style=social)](https://gist.github.com/jagrosh/f1df4441f94ca06274fa78db7cc3c526#privacy-policy)
[![Support](https://discordapp.com/api/guilds/147698382092238848/widget.png?style=shield)](https://discord.gg/0p9LSGoRLu6Pet0k)
[![DevServer](https://discordapp.com/api/guilds/147698382092238848/widget.png?style=shield)](https://discord.gg/0p9LSGoRLu6Pet0k)


## Discord Moderation Bot
Expand All @@ -21,8 +21,7 @@ Vortex is a bot designed to keep your server safe and your staff team organized.
🛡 [Auto-Moderation](https://github.com/jagrosh/Vortex/wiki/Auto-Moderation)
🌟 [Vortex Pro](https://github.com/jagrosh/Vortex/wiki/Vortex-Pro)
📜 [Full Command Reference](https://github.com/jagrosh/Vortex/wiki/Commands)
[Troubleshooting](https://github.com/jagrosh/Vortex/wiki/Troubleshooting)
📥 [Support Server](https://discord.gg/0p9LSGoRLu6Pet0k)
[Troubleshooting](https://github.com/jagrosh/Vortex/wiki/Troubleshooting)


## How do I report a bug or suggest a feature?
Expand Down
51 changes: 29 additions & 22 deletions src/main/java/com/jagrosh/vortex/commands/tools/LookupCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class LookupCmd extends Command
private final static String BOT_EMOJI = "<:botTag:230105988211015680>";
private final static String USER_EMOJI = "\uD83D\uDC64"; // 👤
private final static String GUILD_EMOJI = "\uD83D\uDDA5"; // 🖥
private final static String UNKNOWN_ID = "\uD83C\uDD94"; // 🆔
private final static String LINESTART = "\u25AB"; // ▫

private final Vortex vortex;
Expand Down Expand Up @@ -161,7 +162,7 @@ private void lookupGuild(long guildId, CommandEvent event)
catch(Exception ignore) {}
}
}
event.reply(constructMessage(invite, widget));
event.reply(constructMessage(invite, widget, guildId));
}

private void lookupGuild(String inviteCode, CommandEvent event)
Expand Down Expand Up @@ -190,45 +191,51 @@ private void lookupGuild(String inviteCode, CommandEvent event)
catch(Exception ignore) {}
}
}
event.reply(constructMessage(invite, widget));
event.reply(constructMessage(invite, widget, 0));
}

private Message constructMessage(Invite invite, Widget widget)
private Message constructMessage(Invite invite, Widget widget, long input)
{
String gname;
long gid;
int users;
String gname = null;
long gid = 0L;
int users = -1;
if(invite == null)
{
if(widget == null)
return new MessageBuilder().append(Constants.ERROR + " No users, guilds, or invites found.").build();
else if (!widget.isAvailable())
return new MessageBuilder().append(Constants.SUCCESS + " Guild with ID `" + widget.getId() + "` found; no further information found.").build();
{
if(input == 0)
return new MessageBuilder().append(Constants.ERROR + " No users, guilds, or invites found.").build();

return new MessageBuilder()
.append(UNKNOWN_ID + " Information about an unknown ID:")
.setEmbed(new EmbedBuilder()
.appendDescription(LINESTART + "Creation: " + "**"+TimeUtil.getTimeCreated(input).format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**").build())
.build();
}


gid = widget.getIdLong();
gname = widget.getName();
users = widget.getMembers().size();
if(widget.isAvailable())
{
gname = widget.getName();
users = widget.getMembers().size();
}
}
else
{
Invite.Guild g = invite.getGuild();
if(g == null)
{
gid = 0L;
gname = "Unknown Guild";
users = 0;
}
else
if(g != null)
{
gid = g.getIdLong();
gname = g.getName();
users = g.getOnlineCount();
}
}

String text = GUILD_EMOJI + " Information about **" + gname + "**:";
String text = GUILD_EMOJI + " Information about " + (gname == null ? "an unknown guild" : "**"+gname+"**") + ":";
EmbedBuilder eb = new EmbedBuilder();
eb.appendDescription(LINESTART + "ID: **" + gid + "**"
+ "\n" + LINESTART + "Creation: **" + TimeUtil.getTimeCreated(gid).format(DateTimeFormatter.RFC_1123_DATE_TIME) + "**"
eb.appendDescription(LINESTART + "ID: " + (gid == 0 ? "N/A" : "**"+gid+"**")
+ "\n" + LINESTART + "Creation: " + (gid == 0 ? "N/A" : "**"+TimeUtil.getTimeCreated(gid).format(DateTimeFormatter.RFC_1123_DATE_TIME)+"**")
+ "\n" + LINESTART + "Users: " + (users == -1 ? "N/A" : "**" + users + "** online")
+ (widget != null && widget.isAvailable() ? "\n" + LINESTART + "Channels: **" + widget.getVoiceChannels().size() + "** voice" : ""));
if(invite != null)
Expand All @@ -243,4 +250,4 @@ else if (!widget.isAvailable())
}
return new MessageBuilder().append(FormatUtil.filterEveryone(text)).setEmbed(eb.build()).build();
}
}
}

0 comments on commit dc39509

Please sign in to comment.