Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class StreamBot extends Bot {
- // Variables
- Stream stream;
- ArrayList <String> commands;
- // Constructors
- StreamBot(){
- super();
- stream = new Stream();
- commands = new ArrayList <String> ();
- }
- StreamBot(String name, Streamer owner, Stream stream){
- super(name, owner);
- this.stream = stream;
- commands = new ArrayList <String> ();
- commands.add("!help");
- commands.add("!info");
- commands.add("!uptime");
- }
- StreamBot(String name, Streamer owner, Stream stream, ArrayList <String> commands){
- super(name, owner);
- this.stream = stream;
- this.commands = commands;
- }
- // METHODS
- void showStatus() {
- super.showStatus();
- System.out.println("Stream: " + stream.title + " (" + stream.gameBeenPlaying + ")");
- System.out.println();
- System.out.println("Commands of " + name + ": ");
- if(commands.size() == 0){
- System.out.println("Bot " + name + " has no commands yet.");
- }
- else{
- for(int i=0; i<commands.size(); i++){
- System.out.println("Command " + (i+1) + ": " + commands.get(i));
- }
- }
- System.out.println("*********************************");
- } // END OF FUNCTION SHOWSTATUS
- // Commands / Methods
- void help() {
- System.out.println("StreamBot's commands: ");
- for(int i=0; i<commands.size(); i++) {
- System.out.println("Command " + i + ": " + commands.get(i));
- }
- System.out.println();
- } // END OF FUNCTION HELP
- void info() {
- System.out.println(owner.name + " also known as '" + owner.nameOfChannel + "' is now livestreaming the game " + stream.gameBeenPlaying);
- System.out.println("He is " + owner.age + " years old and is " + owner.nationality);
- System.out.println("The game he usually plays are similar to the following categories: ");
- for(int i=0; i<stream.categories.size(); i++) {
- if(i != stream.categories.size() - 1) {
- System.out.print(stream.categories.get(i) + ", ");
- }
- else {
- System.out.print(stream.categories.get(i));
- }
- }
- }
- int uptime() {
- // I will return the following value
- return stream.secondsStreaming;
- // Then, in main function (class App), I will add the seconds of the running function main in this value (secondsStreaming)
- }
- // METHOD FOR SELECTING FUNCTION
- void selectMethodByCommand(String command) {
- if(command.equals(commands.get(0))) {
- help();
- }
- else if(command.equals(commands.get(1))) {
- info();
- }
- else if(command.equals(commands.get(2))) {
- uptime();
- }
- }
- } // END OF CLASS STREAMBOT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement