-
Notifications
You must be signed in to change notification settings - Fork 6
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
4 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.github.bleuzen.blizcord.bot.commands; | ||
|
||
import com.github.bleuzen.blizcord.Config; | ||
import com.github.bleuzen.blizcord.bot.AudioPlayerThread; | ||
import com.github.bleuzen.blizcord.bot.Bot; | ||
import net.dv8tion.jda.api.entities.Guild; | ||
import net.dv8tion.jda.api.entities.MessageChannel; | ||
import net.dv8tion.jda.api.entities.User; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.InputStreamReader; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
|
||
class Rmlist extends Command { | ||
|
||
@Override | ||
public String getName() { | ||
return "rmlist"; | ||
} | ||
|
||
@Override | ||
public boolean isAdminOnly() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void execute(String arg, User author, MessageChannel channel, Guild guild) { | ||
// arg = playlist | ||
if(arg == null) { | ||
channel.sendMessage(author.getAsMention() + " ``Please specify a playlist name. Put it behind this command.``").queue(); | ||
return; | ||
} | ||
File playlistFile = new File(new File(Config.getAppDir(), "playlists"), arg); | ||
if(!playlistFile.exists()) { | ||
channel.sendMessage(author.getAsMention() + " Playlist doesn't exist: ``" + arg + "``").queue(); | ||
return; | ||
} | ||
try { | ||
playlistFile.delete(); | ||
channel.sendMessage(author.getAsMention() + " Playlist deleted: ``" + arg + "``").queue(); | ||
} catch (Exception e) { | ||
channel.sendMessage(author.getAsMention() + " Failed to delete playlist: ``" + arg + "``").queue(); | ||
} | ||
} | ||
|
||
} |