Browse Source

07.07.2017 -- Invite Creater and Jenkins Test

pull/11/head
Niklas H. 2 years ago
parent
commit
4f3940d5c6
No known key found for this signature in database
2 changed files with 26 additions and 1 deletions
  1. +0
    -1
      momuosb.iml
  2. +26
    -0
      src/main/java/modules/InfoCommands.java

+ 0
- 1
momuosb.iml View File

@@ -10,7 +10,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.json:json:20140107" level="project" />
<orderEntry type="library" name="Maven: com.github.austinv11:Discord4J:2.8.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.24" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.6" level="project" />

+ 26
- 0
src/main/java/modules/InfoCommands.java View File

@@ -6,6 +6,7 @@ import discord.SystemInfo;
import events.Command;
import events.Module;
import storage.LanguageMethod;
import sx.blah.discord.handle.obj.IInvite;
import util.*;
import main.MoMuOSBMain;
import sx.blah.discord.handle.impl.events.guild.channel.message.MessageReceivedEvent;
@@ -111,6 +112,31 @@ public class InfoCommands extends Module implements Fast {

return true;
}
/**
* Send a invitation
*
* @param event MessageEvent
* @param args Argumente [Not needed]
* @return state
*/
@Command(
command = "createInvite",
description = "Invites the bot",
alias = "crei",
arguments = {"Server ID"},
permission = Globals.BOT_OWNER,
prefix = Globals.ADMIN_PREFIX
)
public boolean createInvite(MessageReceivedEvent event, String[] args) {
IInvite invite = INIT.BOT.getGuildByID(Long.valueOf(args[0])).getGeneralChannel().createInvite(0, 1, false, false);
if (invite != null) {
BotUtils.sendPrivMessage(event.getAuthor().getOrCreatePMChannel(), invite.toString() + " |||| " + invite.getCode(), false);
} else {
BotUtils.sendPrivMessage(event.getAuthor().getOrCreatePMChannel(), "The Bot cant create a InviteLink", false);
}
BotUtils.sendEmbMessage(event.getChannel(), SMB.shortMessage(LANG.SUCCESS + LANG.getTranslation("command_success")), true);
return true;
}

/**
* Stats Command

Loading…
Cancel
Save