-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
314 additions
and
182 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
33 changes: 20 additions & 13 deletions
33
src/main/java/pw/chew/chanserv/commands/AdminCommand.java
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
33 changes: 20 additions & 13 deletions
33
src/main/java/pw/chew/chanserv/commands/HalfopCommand.java
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,30 +1,41 @@ | ||
package pw.chew.chanserv.commands; | ||
|
||
import com.jagrosh.jdautilities.command.Command; | ||
import com.jagrosh.jdautilities.command.CommandEvent; | ||
import com.jagrosh.jdautilities.command.SlashCommand; | ||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; | ||
import net.dv8tion.jda.api.interactions.commands.OptionType; | ||
import net.dv8tion.jda.api.interactions.commands.build.OptionData; | ||
import pw.chew.chanserv.util.Community; | ||
|
||
public class JoinCommand extends Command { | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class JoinCommand extends SlashCommand { | ||
|
||
public JoinCommand() { | ||
this.name = "join"; | ||
this.aliases = new String[]{"j"}; | ||
this.guildOnly = true; | ||
this.guildId = "134445052805120001"; | ||
|
||
OptionData data = new OptionData(OptionType.STRING, "community", "The community to join.") | ||
.setRequired(true); | ||
|
||
for (Community community : Community.values()) { | ||
data.addChoice(community.name(), community.name()); | ||
} | ||
|
||
List<OptionData> dataList = new ArrayList<>(); | ||
dataList.add(data); | ||
|
||
this.options = dataList; | ||
} | ||
|
||
@Override | ||
protected void execute(CommandEvent event) { | ||
String channel = event.getArgs().toUpperCase().replace(" ", ""); | ||
event.getMessage().delete().queue(); | ||
|
||
Community community; | ||
try { | ||
community = Community.valueOf(channel); | ||
} catch (IllegalArgumentException e) { | ||
event.reply("Not a valid community!"); | ||
return; | ||
} | ||
protected void execute(SlashCommandEvent event) { | ||
String channel = event.getOption("community").getAsString(); | ||
|
||
Community community = Community.valueOf(channel); | ||
community.addMember(event.getMember()); | ||
|
||
event.reply("Joined!").setEphemeral(true).queue(); | ||
} | ||
} |
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,21 +1,22 @@ | ||
package pw.chew.chanserv.commands; | ||
|
||
import com.jagrosh.jdautilities.command.Command; | ||
import com.jagrosh.jdautilities.command.CommandEvent; | ||
import com.jagrosh.jdautilities.command.SlashCommand; | ||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; | ||
import pw.chew.chanserv.util.Community; | ||
|
||
public class LeaveCommand extends Command { | ||
public class LeaveCommand extends SlashCommand { | ||
|
||
public LeaveCommand() { | ||
this.name = "leave"; | ||
this.guildOnly = true; | ||
this.guildId = "134445052805120001"; | ||
} | ||
|
||
@Override | ||
protected void execute(CommandEvent event) { | ||
event.getMessage().delete().queue(); | ||
protected void execute(SlashCommandEvent event) { | ||
if (event.getTextChannel().getParent().getId().equals(Community.categoryId)) { | ||
Community.valueOf(event.getChannel().getName().toUpperCase()).removeMember(event.getMember()); | ||
} | ||
event.acknowledge().queue(); | ||
} | ||
} |
Oops, something went wrong.