This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
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
8 changed files
with
503 additions
and
0 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
src/main/java/xyz/rc24/bot/commands/general/ReviveCmd.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2017-2020 RiiConnect24 and its contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package xyz.rc24.bot.commands.general; | ||
|
||
import com.jagrosh.jdautilities.command.SlashCommand; | ||
import net.dv8tion.jda.api.EmbedBuilder; | ||
import net.dv8tion.jda.api.Permission; | ||
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; | ||
import xyz.rc24.bot.Bot; | ||
import xyz.rc24.bot.commands.Categories; | ||
import xyz.rc24.bot.core.entities.Poll; | ||
import xyz.rc24.bot.core.entities.impl.MiitomoPoll; | ||
import xyz.rc24.bot.managers.PollManager; | ||
|
||
public class ReviveCmd extends SlashCommand | ||
{ | ||
private final PollManager manager; | ||
|
||
public ReviveCmd(Bot bot) | ||
{ | ||
this.name = "revive"; | ||
this.help = "Revives the chat by sending an Everybody Votes Channel or Miitomo poll for users to vote in."; | ||
this.category = Categories.GENERAL; | ||
this.botPermissions = new Permission[]{Permission.MESSAGE_EMBED_LINKS}; | ||
this.manager = bot.getPollManager(); | ||
} | ||
|
||
@Override | ||
protected void execute(SlashCommandEvent event) | ||
{ | ||
// Get a random poll | ||
Poll poll = manager.getRandomPoll(); | ||
|
||
// Now we need to build the embed | ||
EmbedBuilder embed = new EmbedBuilder() | ||
{{ | ||
setTitle("<:EverybodyVotesChannel:317090360449040388> " + poll.getQuestion()); | ||
|
||
if(!(poll instanceof MiitomoPoll)) | ||
{ | ||
setDescription("\uD83C\uDD70 " + poll.getResponse1() + "\n" + | ||
"_ _\n" + // Line separator | ||
"\uD83C\uDD71 " + poll.getResponse2()); | ||
setFooter("This question was from the " + poll.getCountryFlag() + " EVC", null); | ||
} | ||
else | ||
setFooter("This question was from Miitomo"); | ||
|
||
// setColor(event.getSelfMember().getColor()); | ||
}}; | ||
|
||
// Send embed to chat | ||
event.replyEmbeds(embed.build()).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2017-2020 RiiConnect24 and its contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package xyz.rc24.bot.core.entities; | ||
|
||
public interface Poll | ||
{ | ||
String getQuestion(); | ||
|
||
String getResponse1(); | ||
|
||
String getResponse2(); | ||
|
||
String getCountryFlag(); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/xyz/rc24/bot/core/entities/impl/MiitomoPoll.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package xyz.rc24.bot.core.entities.impl; | ||
|
||
public class MiitomoPoll extends PollImpl | ||
{ | ||
public MiitomoPoll(String question) | ||
{ | ||
super(question, null, null); | ||
} | ||
|
||
@Override | ||
public String getResponse1() | ||
{ | ||
throw new UnsupportedOperationException("Miitomo polls don't have responses!"); | ||
} | ||
|
||
@Override | ||
public String getResponse2() | ||
{ | ||
throw new UnsupportedOperationException("Miitomo polls don't have responses!"); | ||
} | ||
|
||
@Override | ||
public String getCountryFlag() | ||
{ | ||
throw new UnsupportedOperationException("Miitomo polls don't have country flag!"); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/main/java/xyz/rc24/bot/core/entities/impl/PollImpl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2017-2020 RiiConnect24 and its contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package xyz.rc24.bot.core.entities.impl; | ||
|
||
import xyz.rc24.bot.core.entities.Poll; | ||
|
||
public abstract class PollImpl implements Poll | ||
{ | ||
private String question, response1, response2; | ||
|
||
PollImpl(String question, String response1, String response2) | ||
{ | ||
this.question = question; | ||
this.response1 = response1; | ||
this.response2 = response2; | ||
} | ||
|
||
@Override | ||
public String getQuestion() | ||
{ | ||
return question; | ||
} | ||
|
||
@Override | ||
public String getResponse1() | ||
{ | ||
return response1; | ||
} | ||
|
||
@Override | ||
public String getResponse2() | ||
{ | ||
return response2; | ||
} | ||
|
||
@Override | ||
public abstract String getCountryFlag(); | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "Poll(" + getQuestion() + ")"; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/xyz/rc24/bot/core/entities/impl/UKPollImpl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2017-2020 RiiConnect24 and its contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package xyz.rc24.bot.core.entities.impl; | ||
|
||
public class UKPollImpl extends PollImpl | ||
{ | ||
public UKPollImpl(String question, String response1, String response2) | ||
{ | ||
super(question, response1, response2); | ||
} | ||
|
||
@Override | ||
public String getCountryFlag() | ||
{ | ||
return "\uD83C\uDDEC\uD83C\uDDE7"; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/xyz/rc24/bot/core/entities/impl/USPollImpl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2017-2020 RiiConnect24 and its contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package xyz.rc24.bot.core.entities.impl; | ||
|
||
public class USPollImpl extends PollImpl | ||
{ | ||
public USPollImpl(String question, String response1, String response2) | ||
{ | ||
super(question, response1, response2); | ||
} | ||
|
||
@Override | ||
public String getCountryFlag() | ||
{ | ||
return "\uD83C\uDDFA\uD83C\uDDF8"; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/xyz/rc24/bot/core/entities/impl/WorldPollImpl.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2017-2020 RiiConnect24 and its contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package xyz.rc24.bot.core.entities.impl; | ||
|
||
public class WorldPollImpl extends PollImpl | ||
{ | ||
public WorldPollImpl(String question, String response1, String response2) | ||
{ | ||
super(question, response1, response2); | ||
} | ||
|
||
@Override | ||
public String getCountryFlag() | ||
{ | ||
return "\uD83C\uDF0E"; | ||
} | ||
} |
Oops, something went wrong.