Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F571982
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.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.MessageBuilder
;
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>"
;
}
@Override
public
CommandResult
execute
(
TextChannel
channel
,
User
author
,
Message
msg
,
String
[]
args
)
{
Random
randomno
=
new
Random
();
MessageBuilder
ans
=
new
MessageBuilder
();
if
(
args
.
length
<
1
)
{
return
new
CommandResult
(
CommandResultType
.
INVALIDARGS
,
"Well, what do you even want to ask?"
);
}
else
{
ans
.
append
(
"The 8ball says:\n"
);
int
ran
=
randomno
.
nextInt
(
9
)
+
1
;
if
(
ran
==
1
)
{
ans
.
append
(
"`Seems true.`"
);
}
if
(
ran
==
2
)
{
ans
.
append
(
"`Oops. Don't count on that.`"
);
}
if
(
ran
==
3
)
{
ans
.
append
(
"`What did you say again?`"
);
}
if
(
ran
==
4
)
{
ans
.
append
(
"`Sure.`"
);
}
if
(
ran
==
5
)
{
ans
.
append
(
"`Nope. Just no.`"
);
}
if
(
ran
==
6
)
{
ans
.
append
(
"`Ask your mom.`"
);
}
if
(
ran
==
7
)
{
ans
.
append
(
"`Aint gonna answer ;)`"
);
}
if
(
ran
==
8
)
{
ans
.
append
(
"`I approve.`"
);
}
if
(
ran
==
9
)
{
ans
.
append
(
"`Chance of speaking the truth: 0.001%.`"
);
}
}
Message
fans
=
ans
.
build
();
channel
.
sendMessage
(
fans
).
queue
();
return
new
CommandResult
(
CommandResultType
.
SUCCESS
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, Mar 2, 12:08 AM (1 d, 2 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
78/26/ce8aa51ccc44d7ed370d2c426432
Attached To
rDESB despbot
Event Timeline
Log In to Comment