parent
916e73eebd
commit
ca3ebd712b
@ -0,0 +1,89 @@ |
|||||||
|
/* |
||||||
|
* 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.guild.GuildMessageReceivedEvent; |
||||||
|
import net.dv8tion.jda.api.requests.restaction.MessageAction; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author jimj316 |
||||||
|
*/ |
||||||
|
public class Invocation |
||||||
|
{ |
||||||
|
|
||||||
|
private Message requestMessage; |
||||||
|
private Message responseMessage; |
||||||
|
|
||||||
|
private final GuildMessageReceivedEvent event; |
||||||
|
private final List<String> args; |
||||||
|
|
||||||
|
public Invocation(GuildMessageReceivedEvent event, List<String> args) |
||||||
|
{ |
||||||
|
this.event = event; |
||||||
|
this.args = args; |
||||||
|
} |
||||||
|
|
||||||
|
public GuildMessageReceivedEvent getEvent() |
||||||
|
{ |
||||||
|
return event; |
||||||
|
} |
||||||
|
|
||||||
|
public List<String> getArgs() |
||||||
|
{ |
||||||
|
return args; |
||||||
|
} |
||||||
|
|
||||||
|
@SuppressWarnings("null") |
||||||
|
public void respond(String text) |
||||||
|
{ |
||||||
|
MessageAction 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; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue