Skip to content

Instantly share code, notes, and snippets.

/**
*
* @throws Exception
*
* It tests finding a product
*/
@Test
@Order(11)
public void findProductById() throws Exception {
/**
@GetMapping("/{id}")
public ResponseEntity<Product> getProduct(@PathVariable Long id, @RequestParam(required = false) String category) {
ResponseEntity<Product> productResponseEntity;
Optional<Product> byId = repository.findById(id);
if (byId.isPresent()) {
productResponseEntity = new ResponseEntity<>(byId.get(), HttpStatus.OK);
} else {
productResponseEntity = new ResponseEntity<>(new Product(), HttpStatus.NOT_FOUND);
package com.hackerrank.eshopping.product.dashboard.controller;
import com.hackerrank.test.utility.Order;
import com.hackerrank.test.utility.OrderedTestRunner;
import com.hackerrank.test.utility.ResultMatcher;
import static org.junit.Assert.assertTrue;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
package com.hackerrank.eshopping.product.dashboard.controller;
import com.hackerrank.eshopping.product.dashboard.model.Product;
import com.hackerrank.eshopping.product.dashboard.repository.ProductRepository;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.ResponseEntity;
import java.util.ArrayList;
import java.util.List;
@MaxGrosshandler
MaxGrosshandler / gist:d272ac868bb1a6f6d4057fd0db6d73b7
Last active January 22, 2018 22:12
How to create your very first Discord bot using Javascript and Eris!

Welcome!

So you want to make a Discord bot, huh? Well, you've come to the right place. Even if you haven't touched a line of code before, that doesn't mean you can't learn how to code. Let's start off from a broad perspective: all Discord bots are made out of computer code, primarily using two things: a coding language, and a Discord API library associated with that language.

Languages, explained

A coding language is nothing more than a set of instructions that you can give to a computer to have it do something. Every time you click your mouse or press a key, you are sending information to the computer's inner workings that then have it click the mouse, for example. There are a bunch of different languages that you can code Discord bots in, from Python to Ruby to Java to Javascript. For this tutorial, we will be using Javascript (no relation to Java, ironically), which is primarily a web-based scripting language. In a nutshell, Javascript helps make web pages do interesting things like make images chan

{
"&--giveTemp": "{role:Temporary Bot Commander}",
"&--selfclear {params}": "{tclear:{params}}",
"&--spook {params}": "{rawid}{pm:{params}}You have been spooked!",
"&a": "{req:Temporary Bot Commander}{take:Temporary Bot Commander}"
}
{
"&--giveTemp": "{role:Temporary Bot Commander}",
"&--selfclear {params}": "{tclear:{params}}",
"&--spook {params}": "{rawid}{pm:{params}}You have been spooked!",
"&a": "{req:Temporary Bot Commander}{take:Temporary Bot Commander}"
//Can you read this?
}
{
"\u0026--giveTemp": "{role:Temporary Bot Commander}",
"\u0026--selfclear {params}": "{tclear:{params}}",
"\u0026--spook {params}": "{rawid}{pm:{params}}You have been spooked!",
"\u0026a": "{req:Temporary Bot Commander}{take:Temporary Bot Commander}",
"test": "\u003enote add 5 Hello"
}
Yes