Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F368992
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.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
Sun, Jul 6, 3:55 AM (13 h, 47 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a9/a1/98147252c90beda3849722c127fd
Attached To
rDESB despbot
Event Timeline
Log In to Comment