const botgram = require("botgram");
const { json } = require("req");
const bot = botgram(process.argv[2]);
const rants = require("./rants.json");
const feature = "This feature is either under construction or i'm too retarded to implement it";

bot.text(function (msg, reply, next) {
    const text = msg.text.toLowerCase();
    if(text.includes("linux") && !text.includes("gnu"))
		    reply.reply(msg).text(rants.linux[Math.floor(Math.random()*rants.linux.length)]);
    if(text.includes("raphy") && !text.includes("faggot"))
		    reply.reply(msg).text(rants.raphy[Math.floor(Math.random()*rants.raphy.length)]);
    if(text.includes("fighting games"))
        reply.reply(msg).text("fuck off with your gay fighting games nigger");
    if(text.includes("😂"))
        reply.reply(msg).text("fuck off faggot");
});

bot.command("start", function (msg, reply, next) {
    reply.text("fuck off");
});

bot.command("price", function (msg, reply, next) {
    const coin = msg.args();
    let crap;
    json("https://api.coinmarketcap.com/v1/ticker/")
        .then(data => crap = data)
        .then(()=> {
            let balls = crap.find(obj => obj.symbol === coin.toUpperCase());
            if(balls == undefined)
                reply.text("give me a valid symbol retard");
            reply.text(balls.name + ": " + balls.price_usd + "$");
        });
});

bot.command("weather", function (msg, reply, next) {
    const K = 273.15;
    const city = msg.args();
    let link = `http://api.openweathermap.org/data/2.5/weather?q=${city}&APPID=1566ed87c9944f0df94332da29ee817c`;
    let ass;
    let icon;
    json(link)
        .then(data => {
            switch(data.weather[0].icon) {
            case "01d":
                icon = "☀";
                break;
            case "01n":
                icon = "🌕";
                break;
            case"02d" || "02n":
                icon = "🌤";
                break;
            case"03d" || "03n":
                icon = "⛅";
                break;
            case"04d" || "04n":
                icon = "☁";
                break;
            case"09d" || "09n":
                icon = "🌧";
                break;
            case"10d" || "10n":
                icon = "🌦";
                break;
            case"11d" || "11n":
                icon = "🌩";
                break;
            case"13d" || "13n":
                icon = "🌨";
                break;
            case"50d" || "50n":
                icon = "🌫";
                break;
            }
            reply.text(`Weather in ${data.name}, ${data.sys.country}: ${Math.floor(data.main.temp - K)}°C, ${data.weather[0].description} ` + icon + `
 Humidity: ${Math.floor(data.main.humidity)}%
 Air pressure: ${Math.floor(data.main.pressure)} hPa
`);
});
});

bot.command("skelet", function (msg, reply, next) {
    let skelets = "";
    for (let i = 0; i < Math.floor((Math.random() * 20) + 1 ); i++)
        skelets += Math.random() < 0.5 ? '💀' : '☠';
    reply.text(skelets);
});

@@ -1850,16 +1850,32 @@
 case
+ 
 %2202d%22
- %7C%7C
+:%0A            case
  %2202
@@ -1949,16 +1949,32 @@
 case
+ 
 %2203d%22
- %7C%7C
+:%0A            case
  %2203
@@ -2048,16 +2048,32 @@
 case
+ 
 %2204d%22
- %7C%7C
+:%0A            case
  %2204
@@ -2147,16 +2147,32 @@
 case
+ 
 %2209d%22
- %7C%7C
+:%0A            case
  %2209
@@ -2246,16 +2246,32 @@
 case
+ 
 %2210d%22
- %7C%7C
+:%0A            case
  %2210
@@ -2345,16 +2345,32 @@
 case
+ 
 %2211d%22
- %7C%7C
+:%0A            case
  %2211
@@ -2444,16 +2444,32 @@
 case
+ 
 %2213d%22
- %7C%7C
+:%0A            case
  %2213
@@ -2543,16 +2543,32 @@
 case
-%2250d%22 %7C%7C
+ %2250d%22:%0A            case
  %2250

fix night weather icons