-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/deso85/Antony into main
- Loading branch information
Showing
4 changed files
with
51 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,32 @@ | ||
package bot.antony.commands; | ||
|
||
import bot.antony.Antony; | ||
import bot.antony.commands.types.IServerCommand; | ||
import bot.antony.commands.types.ServerCommand; | ||
import net.dv8tion.jda.api.entities.Member; | ||
import net.dv8tion.jda.api.entities.Message; | ||
import net.dv8tion.jda.api.entities.TextChannel; | ||
|
||
public class PnLink implements IServerCommand { | ||
public class PnLink extends ServerCommand { | ||
|
||
private TextChannel channel; | ||
// -------------------------------------------------- | ||
// Constructor | ||
// -------------------------------------------------- | ||
public PnLink() { | ||
super(); | ||
this.privileged = false; | ||
this.name = "pnlink"; | ||
this.description = "Mit diesem Befehl lässt sich die Vorlage für einen Link zu einem Kanal ausgeben, den man auch in einer PN nutzen kann."; | ||
this.shortDescription = "Befehl zur Ausgabe eines Kanal-Links."; | ||
this.example = "#channel"; | ||
this.cmdParams.put("#channel", "Gibt einen Kanal-Link zu #channel aus."); | ||
} | ||
|
||
@Override | ||
public void performCommand(Member member, TextChannel channel, Message message) { | ||
|
||
setChannel(channel); | ||
|
||
String[] userMessage = message.getContentDisplay().split(" "); | ||
|
||
if (userMessage.length > 1 && message.getMentions().getChannels().size() > 0) { | ||
|
||
if (message.getMentions().getChannels().size() > 0) { | ||
channel.sendMessage("Hier ist der Link zu deinem Kanal: <#" + message.getMentions().getChannels().get(0).getId() + " >").complete(); | ||
|
||
} else { | ||
printHelp(); | ||
printHelp(channel); | ||
} | ||
|
||
} | ||
|
||
|
||
private void printHelp() { | ||
getChannel().sendMessage("Benutzung: " + Antony.getCmdPrefix() + "pnlink #Kanal").complete(); | ||
} | ||
|
||
|
||
// -------------------------------------------------- | ||
// Getter & Setter | ||
// -------------------------------------------------- | ||
|
||
public TextChannel getChannel() { | ||
return channel; | ||
} | ||
|
||
public void setChannel(TextChannel channel) { | ||
this.channel = channel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters