Skip to content

GooBot DiscordBot Features: There is 3 here#77

Open
zhaoyd5268 wants to merge 10 commits intoLEAGUE-Level6:developmentfrom
zhaoyd5268:Feature-1
Open

GooBot DiscordBot Features: There is 3 here#77
zhaoyd5268 wants to merge 10 commits intoLEAGUE-Level6:developmentfrom
zhaoyd5268:Feature-1

Conversation

@zhaoyd5268
Copy link

Hi! To preface, there is three features in this one, so it counts as three

Feature 1: Greeting
(When you type !greeting in the discord chat, GooBot will pick one of 3 greetings and say it in the chat.)

Feature 2: Calculator
(This one take two numbers and does the specified operation on them. Included operations are +, -, /, x, ^, and %. When entering numbers to test, make sure to have it in this format: !calculator ? space ?. Examples: !calculator 5 x 5, !calculator 7 / 1)

Feature 3: Random word generator
(Exactly what is says! Simply enter !CoolWord in the discord chat and the api should get a word and send it in the chat!

Copy link
Collaborator

@Whale92130 Whale92130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall no major problems and good code

answer = calculate(event, num1, num2, op);
event.getChannel().sendMessage("I got the answer! It is... " + answer);
} else {
event.getChannel().sendMessage("Sorry, we've ran into an error. To be specific, the operation" +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message to the user should be more concise

public String getCoolWord() {
String word = "error";
try {
URLConnection con = url.openConnection();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is ambiguous should be uCon or urlCon

}

public static double calculate(MessageCreateEvent event, double num1, double num2, String Op2) {
answer = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should set answer to integer.MAX_VALUE then check later if it changed as a way to check that an operation happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants