Page Menu
Home
desp's stash
Search
Configure Global Search
Log In
Files
F554572
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
Tue, Feb 10, 5:21 PM (1 d, 10 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
71/0a/cc4e9d58d9e3517f42d2387f19e0
Attached To
rDESB despbot
Event Timeline
Log In to Comment