Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F554726
EightBall.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
EightBall.java
View Options
package
me.despawningbone.discordbot.command.misc
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Random
;
import
me.despawningbone.discordbot.command.Command
;
import
me.despawningbone.discordbot.command.CommandResult
;
import
me.despawningbone.discordbot.command.CommandResult.CommandResultType
;
import
net.dv8tion.jda.api.entities.Message
;
import
net.dv8tion.jda.api.entities.channel.concrete.TextChannel
;
import
net.dv8tion.jda.api.entities.User
;
public
class
EightBall
extends
Command
{
public
EightBall
()
{
this
.
name
=
"8ball"
;
//override name
this
.
desc
=
"Ask the almighty 8ball!"
;
this
.
usage
=
"<question>"
;
}
private
List
<
String
>
responses
=
Arrays
.
asList
(
"`Seems true.`"
,
"`Oops. Don't count on that.`"
,
"`What did you say again?`"
,
"`Sure.`"
,
"`Nope. Just no.`"
,
"`Ask your mom.`"
,
"`Aint gonna answer ;)`"
,
"`I approve.`"
,
"`Chance of speaking the truth: 0.001%.`"
);
@Override
public
CommandResult
execute
(
TextChannel
channel
,
User
author
,
Message
msg
,
String
[]
args
)
{
if
(
args
.
length
<
1
)
return
new
CommandResult
(
CommandResultType
.
INVALIDARGS
,
"Well, what do you even want to ask?"
);
int
choice
=
new
Random
().
nextInt
(
responses
.
size
());
channel
.
sendMessage
(
"The 8ball says:\n"
+
responses
.
get
(
choice
)).
queue
();
return
new
CommandResult
(
CommandResultType
.
SUCCESS
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Feb 10, 9:47 PM (1 d, 11 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
15/78/2685325cbd5143c6bd9494b3a822
Attached To
rDESB despbot
Event Timeline
Log In to Comment