import Head from 'next/head' import styles from '../styles/Index.module.css' import Header from '../components/indexheader'; import Footer from '../components/footer'; import Socials from '../components/socials'; import TwitchPopup from '../components/twitchpopup'; import Pages from '../components/pages'; import Button from '../components/button'; import { faTwitch } from '@fortawesome/free-brands-svg-icons' import { TwitchEmbed } from 'react-twitch-embed'; const client_id = "edpx4oisrkpnrlx47b7a2p3govy6qm"; const client_secret = "dqr2glvdhr7uyn3bf3biu48977rfwo"; const d = new Date(); let day = d.getDate() + " " + d.getMonth(); export default function Index({ motto, twitch_online, about }) { return (
Trick - Homepage {/*
*/}
{day == "06 11" &&

HAPPY BIRTHDAY TRICK!

}

📃 "{motto}"

updateMeowCount()} id="clickMeow" />

Hi, I'm Trick! 👋

{about} 🦊


Become a Patron today and get cool things like:

  • Free monthly Icon commission
  • Free monthly Full Body commission
  • Free monthly Sketch commission
  • Access to exclusive Discord
  • First look at artworks 24 hours before anywhere else
  • 20% discount on all art commissions
  • Custom Discord role

🌟 Some of my artworks

Website made by DubbelNull

#️⃣ My Socials #️⃣

) } async function getAboutText() { const req = await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Locale", { method: "GET", headers: { 'Content-Type': 'application/json', "Authorization": "Bearer " + process.env.AIRTABLE, } }); const data = await req.json(); for(const key in data['records']) { if(data['records'][key]['fields']['field'] == "about") { return data['records'][key]['fields']['value']; } }; return ""; } async function getMottos() { const req = await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Mottos", { method: "GET", headers: { 'Content-Type': 'application/json', "Authorization": "Bearer " + process.env.AIRTABLE, } }); const data = await req.json(); let mottoArray = []; for(const key in data['records']) { mottoArray.push(data['records'][key]['fields']['motto']); } return mottoArray; } async function getAccessToken() { const req = await fetch("https://id.twitch.tv/oauth2/token?client_id=" + client_id + "&client_secret=" + client_secret + "&grant_type=client_credentials", { method: "POST", headers: { 'Content-Type': 'application/json' } }) const data = await req.json(); return data['access_token']; } async function getIsUserLive() { const access_token = await getAccessToken(); let userId = 268280947; // trick_the_fox; const req = await fetch("https://api.twitch.tv/helix/streams?user_id=" + userId, { method: "GET", headers: { 'Content-Type': 'application/json', "Authorization": "Bearer " + access_token, "Client-ID": client_id, } }); const data = await req.json(); if(data['data'].length > 0) { return true; } return false; } async function RandomMotto() { const Mottos = await getMottos(); const randomNumber = Math.floor(Math.random() * Mottos.length); return Mottos[randomNumber]; } export async function getServerSideProps() { return { props: { motto: await RandomMotto(), twitch_online: await getIsUserLive(), about: await getAboutText() } }; } async function updateMeowCount() { const getMeow = await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Meows", { method: "GET", headers: { 'Content-Type': 'application/json', "Authorization": "Bearer " + process.env.AIRTABLE, } }); let meowCount = await getMeow.json(); meowCount = parseInt(meowCount['records'][0]['fields']['count']); meowCount++; const updateMeow = { "records": [ { "id": "recR9RbScmJUPGQem", "fields": { "count": meowCount + "" } } ] }; await fetch("https://api.airtable.com/v0/appQnOyKBnBVQXLUM/Meows", { method: "PATCH", headers: { 'Content-Type': 'application/json', "Authorization": "Bearer " + process.env.AIRTABLE, "accept": "application/json", }, body: JSON.stringify(updateMeow) }); }