use of me.TechsCode.TechDiscordBot.util.Plugin in project TechDiscordBot by TechsCode-Team.
the class SupportWrongChannelModule method triggerMessage.
public void triggerMessage(Message sentMessage, Member member) {
if (messages.containsValue(member.getId()))
return;
TextChannel verificationChannel = bot.getChannel("907349490556616745");
TechEmbedBuilder teb = new TechEmbedBuilder().text("Hello, " + member.getAsMention() + "! I've detected that you might be trying to get help in this channel! To verify your purchase, we ask you to fill out this [form](https://forms.gle/PBX7z5LaXqdYh7wF6) in order to get help, thanks!\n\n*If you are not trying to get help, you can delete this message by reacting to it!*").error();
// TextChannel verificationChannel = bot.getChannel("907349490556616745");
// TechEmbedBuilder teb = new TechEmbedBuilder()
// .text("Hello, " + member.getAsMention() + "! I've detected that you might be trying to get help in this channel! Please verify in " + verificationChannel.getAsMention() + " in order to get help, thanks!\n\n*If you are not trying to get help, you can delete this message by reacting to it!*")
// .error();
Message message;
Verification verification = TechDiscordBot.getStorage().retrieveVerificationWithDiscord(member);
if (verification != null) {
List<Plugin> pc = Arrays.stream(Plugin.values()).filter(p -> member.getRoles().stream().anyMatch(r -> r.getName().equals(p.getRoleName()))).collect(Collectors.toList());
if (pc.size() > 0) {
StringBuilder sb = new StringBuilder();
String plugins = Plugin.getEmotesByList(pc.stream().map(Plugin::getRoleName).collect(Collectors.toList()));
sb.append("Hello, ").append(member.getAsMention()).append("!\n\n It looks like you have bought ").append(pc.size() == 1 ? "this plugin" : "these plugins").append(" already: ").append(plugins).append("\nHere are the corresponding channels:\n\n");
StringBuilder channels = new StringBuilder();
pc.forEach(p -> channels.append("- ").append(TechDiscordBot.getJDA().getTextChannelById(p.getChannelId()).getAsMention()).append("\n"));
sb.append(channels.toString());
sb.append("\nPlease use the corresponding plugin channel above to get support.\nThis channel is **not** a support channel.\n\n*If you are not trying to get help, you can delete this message by reacting to it!*");
message = new TechEmbedBuilder().text(sb.toString()).error().reply(sentMessage);
} else {
message = teb.reply(sentMessage);
}
} else {
message = teb.reply(sentMessage);
}
if (message != null) {
message.addReaction("\u274C").queue();
messages.put(message.getId(), member.getId());
}
}
use of me.TechsCode.TechDiscordBot.util.Plugin in project TechDiscordBot by TechsCode-Team.
the class TicketModule method sendPluginInstructions.
public void sendPluginInstructions(Member member) {
if (selectionStep != 1)
return;
selectionUserId = member.getId();
isSelection = true;
selectionStep = 2;
String sb = PLUGIN_EMOTES.query().all().stream().map(emote -> emote.getAsMention() + " - " + Plugin.byEmote(emote).getRoleName()).collect(Collectors.joining("\n"));
if (lastInstructions != null)
lastInstructions.delete().queue();
TechEmbedBuilder plugin = new TechEmbedBuilder("Ticket Creation (" + member.getEffectiveName() + ")").text("Please select which plugin the issue corresponds with below:", "", sb, "", ERROR_EMOTE.query().first().getAsMention() + " - Cancel", "");
plugin.queue(channel, message -> setLastInstructions(message, msg -> {
PLUGIN_EMOTES.query().all().stream().filter(emote -> msg != null).forEach(emote -> msg.addReaction(emote).queue((msg2) -> {
try {
msg.addReaction(ERROR_EMOTE.query().first()).queue();
} catch (Exception ignored) {
}
}));
}));
}
use of me.TechsCode.TechDiscordBot.util.Plugin in project TechDiscordBot by TechsCode-Team.
the class WikiCommand method showCurrentChannel.
public void showCurrentChannel(SlashCommandEvent e, TextChannel channel) {
if (Plugin.isPluginChannel(channel)) {
Plugin plugin = Plugin.byChannel(channel);
if (!plugin.hasWiki()) {
new TechEmbedBuilder("Wikis").error().text(plugin.getEmoji().getAsMention() + " " + plugin.getRoleName() + " unfortunately does not have a wiki!").sendTemporary(channel, 10);
return;
}
e.replyEmbeds(new TechEmbedBuilder("Wikis").text("*Showing the wiki of the support channel you're in.*\n\n" + plugin.getEmoji().getAsMention() + " " + plugin.getWiki() + "\n\nFor more info please execute the command `wiki help`.").build()).queue();
}
}
use of me.TechsCode.TechDiscordBot.util.Plugin in project TechDiscordBot by TechsCode-Team.
the class ActivitiesModule method checkResources.
public void checkResources() {
if (!TechDiscordBot.getBot().getSpigotStatus().isUsable())
return;
TechDiscordBot.getSpigotAPI().getSpigotResources().forEach(resource -> {
Plugin plugin = Plugin.fromId(resource.getId());
if (plugin == null)
return;
Update latestUpdate = plugin.getLatestUpdate();
boolean isNewUpdate = isNewUpdate(resource.getId(), latestUpdate.getId());
if (isNewUpdate) {
printUpdate(plugin, latestUpdate);
}
});
}
use of me.TechsCode.TechDiscordBot.util.Plugin in project TechDiscordBot by TechsCode-Team.
the class PluginCommand method onCommand.
@Override
public void onCommand(TextChannel channel, Member m, SlashCommandEvent e) {
Plugin plugin = e.getOption("plugin") == null ? null : Plugin.byRoleName(e.getOption("plugin").getAsString());
if (plugin == null) {
e.reply("Could not find the plugin, this probably shouldn't be happening.").setEphemeral(true).queue();
return;
}
e.replyEmbeds(new TechEmbedBuilder(plugin.getRoleName()).text(plugin.getDescription() + ".").field("Download Links", plugin.getPluginMarketplace().toString(), true).field("Wiki", plugin.getWiki(), true).color(plugin.getColor()).thumbnail(plugin.getResourceLogo()).build()).queue();
}
Aggregations