Discord bot that plays music from every website ever via youtube-dl
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Chords/src/main/java/moe/nekojimi/chords/commands/Invocation.java

90 lines
2.2 KiB

/*
* Copyright (C) 2022 jimj316
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package moe.nekojimi.chords.commands;
import java.util.List;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.requests.FluentRestAction;
import net.dv8tion.jda.api.requests.restaction.MessageCreateAction;
/**
*
* @author jimj316
*/
public class Invocation
{
private Message requestMessage;
private Message responseMessage;
private final MessageReceivedEvent event;
private final List<String> args;
public Invocation(MessageReceivedEvent event, List<String> args)
{
this.event = event;
this.args = args;
}
public MessageReceivedEvent getEvent()
{
return event;
}
public List<String> getArgs()
{
return args;
}
@SuppressWarnings("null")
public void respond(String text)
{
FluentRestAction<Message, ?> action = null;
if (responseMessage == null)
{
action = requestMessage.reply(text);
} else
{
action = responseMessage.editMessage(text);
}
responseMessage = action.complete();
}
public Message getRequestMessage()
{
return requestMessage;
}
public void setRequestMessage(Message requestMessage)
{
this.requestMessage = requestMessage;
}
public Message getResponseMessage()
{
return responseMessage;
}
public void setResponseMessage(Message responseMessage)
{
this.responseMessage = responseMessage;
}
}