-
Notifications
You must be signed in to change notification settings - Fork 23
BananaMath and WeatherAPI #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cb1658
wants to merge
10
commits into
LEAGUE-Level6:development
Choose a base branch
from
cb1658:feature1
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7da8c7d
Feature 1
24bcdd8
.gitignore now ignores /build/
4cf73ed
Feature 1 White Box Testing almost 100% coverage
95ecd72
BananaSoftware v0.1
482c859
BananaSoftware v1.0
2208923
BananaSoftware Testing Done
6949080
Feature 3 Weather Api Progress
05d5fed
Weather API Progress
7da1a5e
Basic Weather API Complete. Complete TODO later
3c344cc
Weather API/WeatherTesting DONE
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,5 @@ src/main/java/org.jointheleague.Launcher.java | |
| run.sh | ||
| appspec.yml | ||
| .gradle/ | ||
| /bin/ | ||
| /build/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
src/main/java/org/jointheleague/features/student/first_feature/BananaSoftware.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,192 @@ | ||
| package org.jointheleague.features.student.first_feature; | ||
|
|
||
| import org.jointheleague.features.help_embed.plain_old_java_objects.help_embed.HelpEmbed; | ||
| import org.jointheleague.api_wrapper.ReceivedMessage; | ||
| import org.jointheleague.features.abstract_classes.Feature; | ||
| import org.jointheleague.features.templates.FeatureTemplate; | ||
|
|
||
| import java.util.Random; | ||
| import java.util.Scanner; | ||
|
|
||
| public class BananaSoftware extends FeatureTemplate { | ||
|
|
||
| public BananaSoftware(String channelName) { | ||
| super(channelName); | ||
| } | ||
|
|
||
| public final String COMMAND = "banana"; | ||
| public final String password = "ON"; | ||
|
|
||
| public boolean BananaMode = false; | ||
|
|
||
| static public Random r = new Random(); | ||
|
|
||
| @Override | ||
| public void handle(ReceivedMessage event) { | ||
| String messageContent = event.getMessageContent(); | ||
|
|
||
|
|
||
| if(messageContent.toLowerCase().startsWith(COMMAND) && messageContent.toUpperCase().contains(password)) { | ||
| if(BananaMode) { | ||
| event.sendResponse("Message received! BananaMode is already on."); | ||
| } | ||
| else { | ||
| event.sendResponse("Message received! BananaMode is now on."); | ||
| BananaMode = true; | ||
| startupSequence(event); | ||
| } | ||
| } | ||
|
|
||
| else if (messageContent.toLowerCase().startsWith(COMMAND) && !BananaMode) { | ||
| event.sendResponse("Message received! BananaMode remains off."); | ||
| } | ||
|
|
||
| else if(messageContent.toLowerCase().startsWith(COMMAND) && BananaMode) { | ||
|
|
||
| String t = messageContent.substring(7); // good | ||
| String[] things = t.trim().split(" "); | ||
|
|
||
| if(things.length <3 && !things[0].toUpperCase().equals("OFF")) event.sendResponse("So youre meant to *include* __both__ numbers in your argument"); | ||
|
|
||
| switch(things[0].toLowerCase()) { | ||
|
|
||
| case "add": | ||
| String a; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. variables could be more specific |
||
| int b=0; | ||
| String c; | ||
| int d=0; | ||
| try { | ||
| a = things[1]; | ||
| b = Integer.parseInt(a); | ||
| c = things[2]; | ||
| d = Integer.parseInt(c); | ||
| event.sendResponse(b+d+""); | ||
| } | ||
| catch(Exception e){ | ||
| event.sendResponse("hey i dont think thats an integer"); | ||
| } | ||
|
|
||
| event.sendResponse("\n \nWhich one would you like to execute? [Add/Subt/Mult/Divi/OFF] Always start with the Banana keyword"); | ||
| event.sendResponse("Form: [Add/Subt/Mult/Divi/OFF] [Number 1] [Number 2]"); | ||
|
|
||
| break; | ||
|
|
||
| case "subt": | ||
| String aa; | ||
| int bb=0; | ||
| String cc; | ||
| int dd=0; | ||
| try { | ||
| aa = things[1]; | ||
| bb = Integer.parseInt(aa); | ||
| cc = things[2]; | ||
| dd = Integer.parseInt(cc); | ||
| event.sendResponse(bb-dd+""); | ||
| } | ||
| catch(Exception e){ | ||
| event.sendResponse("hey i dont think thats an integer"); | ||
| } | ||
|
|
||
| event.sendResponse("\n \nWhich one would you like to execute? [Add/Subt/Mult/Divi/OFF] Always start with the Banana keyword"); | ||
| event.sendResponse("Form: [Add/Subt/Mult/Divi/OFF] [Number 1] [Number 2]"); | ||
|
|
||
| break; | ||
|
|
||
| case "mult": | ||
| String aaa; | ||
| int bbb=0; | ||
| String ccc; | ||
| int ddd=0; | ||
| try { | ||
| aaa = things[1]; | ||
| bbb = Integer.parseInt(aaa); | ||
| ccc = things[2]; | ||
| ddd = Integer.parseInt(ccc); | ||
| event.sendResponse(bbb*ddd+""); | ||
| } | ||
| catch(Exception e){ | ||
| event.sendResponse("hey i dont think thats an integer"); | ||
| } | ||
|
|
||
| event.sendResponse("\n \nWhich one would you like to execute? [Add/Subt/Mult/Divi/OFF] Always start with the Banana keyword"); | ||
| event.sendResponse("Form: [Add/Subt/Mult/Divi/OFF] [Number 1] [Number 2]"); | ||
|
|
||
| break; | ||
|
|
||
| case "divi": | ||
|
|
||
| String aaaa; | ||
| int bbbb=0; | ||
| String cccc; | ||
| int dddd=0; | ||
| try { | ||
| aaaa = things[1]; | ||
| bbbb = Integer.parseInt(aaaa); | ||
| cccc = things[2]; | ||
| dddd = Integer.parseInt(cccc); | ||
| event.sendResponse(bbbb/dddd+""); | ||
| } | ||
| catch(ArithmeticException ae) { | ||
| event.sendResponse("bruh"); | ||
| } | ||
| catch(Exception e){ | ||
| event.sendResponse("hey i dont think thats an integer"); | ||
| } | ||
|
|
||
| event.sendResponse("\n \nWhich one would you like to execute? [Add/Subt/Mult/Divi/OFF] Always start with the Banana keyword"); | ||
| event.sendResponse("Form: [Add/Subt/Mult/Divi/OFF] [Number 1] [Number 2]"); | ||
|
|
||
| break; | ||
| case "off": | ||
| BananaMode = false; | ||
| event.sendResponse("Got it. BananaMode is now off."); | ||
|
|
||
| break; | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
| public void startupSequence(ReceivedMessage event) { | ||
|
|
||
| event.sendResponse("Loading JavaBanana Architecture... "); | ||
|
|
||
| try { | ||
| Thread.sleep(r.nextInt(3500)+500); | ||
|
|
||
| event.sendResponse("Loading... [--- ] 20%"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this loading thing doesnt really show correctly on discord |
||
|
|
||
| Thread.sleep(r.nextInt(1500)+500); | ||
|
|
||
| event.sendResponse("Loading... [------ ] 40%"); | ||
|
|
||
| Thread.sleep(r.nextInt(300)+100); | ||
|
|
||
| event.sendResponse("Loading... [-------- ] 60%"); | ||
|
|
||
| Thread.sleep(300+r.nextInt(800)); | ||
|
|
||
| event.sendResponse("Loading... [----------- ] 80%"); | ||
|
|
||
| Thread.sleep(500+r.nextInt(3000)); | ||
|
|
||
| event.sendResponse("Loading... [--------------] 100%"); | ||
|
|
||
| Thread.sleep(500+r.nextInt(2000)); | ||
|
|
||
| event.sendResponse("-------- \n\n"); | ||
|
|
||
| Thread.sleep(200); | ||
|
|
||
| } catch (InterruptedException e) { | ||
| e.printStackTrace(); | ||
| } | ||
|
|
||
| event.sendResponse("\n" + "JAVA BANANA SOFTWARE v1.0.0"); | ||
|
|
||
| event.sendResponse("\nThe JavaBanana Calculator has many operations to help you with math homework. "); | ||
| event.sendResponse("\n \nWhich one would you like to execute? [Add/Subt/Mult/Divi/OFF] Always start with the Banana keyword"); | ||
| event.sendResponse("Form: [Add/Subt/Mult/Divi/OFF] [Number 1] [Number 2]"); | ||
| } | ||
|
|
||
| } | ||
100 changes: 100 additions & 0 deletions
100
src/main/java/org/jointheleague/features/student/first_feature/Condition.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
|
|
||
| package org.jointheleague.features.student.first_feature; | ||
|
|
||
| import java.util.LinkedHashMap; | ||
| import java.util.Map; | ||
| import javax.annotation.Generated; | ||
| import com.fasterxml.jackson.annotation.JsonAnyGetter; | ||
| import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
|
||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| @JsonPropertyOrder({ | ||
| "text", | ||
| "icon", | ||
| "code" | ||
| }) | ||
| @Generated("jsonschema2pojo") | ||
| public class Condition { | ||
|
|
||
| @JsonProperty("text") | ||
| private String text; | ||
| @JsonProperty("icon") | ||
| private String icon; | ||
| @JsonProperty("code") | ||
| private Integer code; | ||
| @JsonIgnore | ||
| private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>(); | ||
|
|
||
| @JsonProperty("text") | ||
| public String getText() { | ||
| return text; | ||
| } | ||
|
|
||
| @JsonProperty("text") | ||
| public void setText(String text) { | ||
| this.text = text; | ||
| } | ||
|
|
||
| @JsonProperty("icon") | ||
| public String getIcon() { | ||
| return icon; | ||
| } | ||
|
|
||
| @JsonProperty("icon") | ||
| public void setIcon(String icon) { | ||
| this.icon = icon; | ||
| } | ||
|
|
||
| @JsonProperty("code") | ||
| public Integer getCode() { | ||
| return code; | ||
| } | ||
|
|
||
| @JsonProperty("code") | ||
| public void setCode(Integer code) { | ||
| this.code = code; | ||
| } | ||
|
|
||
| @JsonAnyGetter | ||
| public Map<String, Object> getAdditionalProperties() { | ||
| return this.additionalProperties; | ||
| } | ||
|
|
||
| @JsonAnySetter | ||
| public void setAdditionalProperty(String name, Object value) { | ||
| this.additionalProperties.put(name, value); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| StringBuilder sb = new StringBuilder(); | ||
| sb.append(Condition.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); | ||
| sb.append("text"); | ||
| sb.append('='); | ||
| sb.append(((this.text == null)?"<null>":this.text)); | ||
| sb.append(','); | ||
| sb.append("icon"); | ||
| sb.append('='); | ||
| sb.append(((this.icon == null)?"<null>":this.icon)); | ||
| sb.append(','); | ||
| sb.append("code"); | ||
| sb.append('='); | ||
| sb.append(((this.code == null)?"<null>":this.code)); | ||
| sb.append(','); | ||
| sb.append("additionalProperties"); | ||
| sb.append('='); | ||
| sb.append(((this.additionalProperties == null)?"<null>":this.additionalProperties)); | ||
| sb.append(','); | ||
| if (sb.charAt((sb.length()- 1)) == ',') { | ||
| sb.setCharAt((sb.length()- 1), ']'); | ||
| } else { | ||
| sb.append(']'); | ||
| } | ||
| return sb.toString(); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variables could be more specific