175 lines
4.8 KiB
Java
175 lines
4.8 KiB
Java
package cutthecord.commands.commands;
|
||
|
||
import androidx.annotation.Nullable;
|
||
|
||
import com.discord.stores.StoreStream;
|
||
import com.discord.stores.StoreUserSettings;
|
||
|
||
import cutthecord.commands.CommandHandler;
|
||
import lanchon.dexpatcher.annotation.DexAdd;
|
||
|
||
@DexAdd
|
||
public class CmdCtc extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
// Command only has subcommands
|
||
return "CTC: No known command supplied. (available: "+ getSubCommandNames() +". Everything except specified token needs to be lowercase)";
|
||
}
|
||
|
||
@DexAdd
|
||
@Nullable
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return null;
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcChannelLeak extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
StoreStream.getUserSettings().setLeakChannels(msg.startsWith("false"));
|
||
return "CTC: Successfully set channelleak state.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Shows all channels, even those you don’t have permissions to view";
|
||
}
|
||
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcShowTyping extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
StoreStream.getUserSettings().setShowTyping(msg.startsWith("true"));
|
||
return "CTC: Successfully set showtyping state.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Change typing event so that its visible/not when you type";
|
||
}
|
||
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcToken extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
if (msg.isEmpty()) {
|
||
// Print token
|
||
return StoreStream.getUserSettings().getStoredToken();
|
||
}
|
||
|
||
// Set token
|
||
StoreStream.getUserSettings().setStoredToken(msg);
|
||
return "CTC: Successfully changed token. Please restart application.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Gives or sets token";
|
||
}
|
||
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcAccount extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
String trim = msg.trim();
|
||
StoreUserSettings userSettings = StoreStream.getUserSettings();
|
||
String accountToken = userSettings.getAccountToken(trim);
|
||
if (accountToken.startsWith("none")) {
|
||
return "CTC: No such account found.";
|
||
}
|
||
|
||
userSettings.setStoredToken(accountToken);
|
||
return "CTC: Successfully changed accounts. Please restart application.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Switches to the account specified";
|
||
}
|
||
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcAddAccount extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
String substring3 = msg.substring(msg.indexOf(" "));
|
||
String trim2 = msg.replace(substring3, "").trim();
|
||
String trim3 = substring3.trim();
|
||
StoreUserSettings userSettings2 = StoreStream.getUserSettings();
|
||
if (trim2.startsWith("current")) {
|
||
trim2 = userSettings2.getStoredToken();
|
||
}
|
||
userSettings2.setAccountToken(trim2, trim3);
|
||
return "CTC: Added account.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Adds an account to the account switcher";
|
||
}
|
||
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcNoDelete extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
StoreStream.getUserSettings().setNoDelete(msg.startsWith("true"));
|
||
return "CTC: Successfully set nodelete state.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Disables handling of message delete events";
|
||
}
|
||
|
||
}
|
||
|
||
@DexAdd
|
||
public static class CmdCtcGifAutoPlay extends CommandHandler.PrivateCommand {
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String handleCommand(String msg) {
|
||
StoreStream.getUserSettings().setAutoplayGifs(msg.startsWith("true"));
|
||
return "CTC: Successfully set gifautoplay state.";
|
||
}
|
||
|
||
@DexAdd
|
||
@Override
|
||
public String getPopupInfo() {
|
||
return "Disables auto play of GIFs";
|
||
}
|
||
|
||
}
|
||
|
||
}
|