2017-12-22 19:20:26 +01:00
|
|
|
package net.Broken.webView;
|
|
|
|
|
2018-05-14 11:57:05 +02:00
|
|
|
import net.Broken.MainBot;
|
|
|
|
import net.dv8tion.jda.core.entities.Guild;
|
2017-12-22 19:20:26 +01:00
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.ui.Model;
|
2018-05-14 11:57:05 +02:00
|
|
|
import org.springframework.web.bind.annotation.CookieValue;
|
2017-12-22 19:20:26 +01:00
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
2018-02-28 17:59:09 +01:00
|
|
|
/**
|
|
|
|
* Web page controller for /music page
|
|
|
|
*/
|
2017-12-22 19:20:26 +01:00
|
|
|
@Controller
|
|
|
|
public class MusicWebView {
|
|
|
|
@RequestMapping("/music")
|
2018-05-14 11:57:05 +02:00
|
|
|
public String music(Model model, @CookieValue(value = "guild", defaultValue = "1") String guildId){
|
|
|
|
Guild guild = MainBot.jda.getGuildById(guildId);
|
|
|
|
if(guild != null)
|
|
|
|
model.addAttribute("guild_name", guild.getName());
|
|
|
|
else
|
|
|
|
model.addAttribute("guild_name", "");
|
2018-09-10 14:53:56 +02:00
|
|
|
model.addAttribute("redirect_url", System.getenv("OAUTH_URL"));
|
|
|
|
|
2018-05-14 11:57:05 +02:00
|
|
|
|
2018-03-06 16:26:40 +01:00
|
|
|
return CheckPage.getPageIfReady("music");
|
2017-12-22 19:20:26 +01:00
|
|
|
}
|
|
|
|
}
|