mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
change default browser to ff
This commit is contained in:
parent
aa086e307b
commit
40561afb82
22 changed files with 3 additions and 3514 deletions
|
@ -376,7 +376,7 @@ class OtherCog(commands.Cog):
|
||||||
self,
|
self,
|
||||||
ctx: discord.ApplicationContext,
|
ctx: discord.ApplicationContext,
|
||||||
url: str,
|
url: str,
|
||||||
browser: discord.Option(str, description="Browser to use", choices=["chrome", "firefox"], default="chrome"),
|
browser: discord.Option(str, description="Browser to use", choices=["chrome", "firefox"], default="firefox"),
|
||||||
render_timeout: int = 5,
|
render_timeout: int = 5,
|
||||||
):
|
):
|
||||||
"""Takes a screenshot of a URL"""
|
"""Takes a screenshot of a URL"""
|
||||||
|
@ -452,7 +452,7 @@ class OtherCog(commands.Cog):
|
||||||
screenshot = await self.screenshot_website(ctx, url.geturl(), browser, render_timeout)
|
screenshot = await self.screenshot_website(ctx, url.geturl(), browser, render_timeout)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
console.print_exception()
|
console.print_exception()
|
||||||
return await ctx.edit(content=f"Error: {e}")
|
return await ctx.edit(content=f"Error: {e}", delete_after=30)
|
||||||
else:
|
else:
|
||||||
await ctx.edit(content=f"Screenshotting {friendly_url}... (99%)")
|
await ctx.edit(content=f"Screenshotting {friendly_url}... (99%)")
|
||||||
await asyncio.sleep(0.5)
|
await asyncio.sleep(0.5)
|
||||||
|
|
|
@ -28013,3 +28013,4 @@ zzztube.com
|
||||||
kekma.net
|
kekma.net
|
||||||
dogehls.xyz
|
dogehls.xyz
|
||||||
nhentai.com
|
nhentai.com
|
||||||
|
fast.com
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
NEXTAUTH_URL=https://lcc.nexy7574.cyou
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "next/core-web-vitals"
|
|
||||||
}
|
|
36
website/.gitignore
vendored
36
website/.gitignore
vendored
|
@ -1,36 +0,0 @@
|
||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# next.js
|
|
||||||
/.next/
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
*.pem
|
|
||||||
|
|
||||||
# debug
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
.pnpm-debug.log*
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env*.local
|
|
||||||
|
|
||||||
# vercel
|
|
||||||
.vercel
|
|
||||||
|
|
||||||
# typescript
|
|
||||||
*.tsbuildinfo
|
|
||||||
next-env.d.ts
|
|
5
website/.idea/.gitignore
vendored
5
website/.idea/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
|
@ -1,6 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/website.iml" filepath="$PROJECT_DIR$/.idea/website.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,34 +0,0 @@
|
||||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
First, run the development server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run dev
|
|
||||||
# or
|
|
||||||
yarn dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
||||||
|
|
||||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
|
||||||
|
|
||||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
|
||||||
|
|
||||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
To learn more about Next.js, take a look at the following resources:
|
|
||||||
|
|
||||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
||||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
||||||
|
|
||||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
||||||
|
|
||||||
## Deploy on Vercel
|
|
||||||
|
|
||||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
||||||
|
|
||||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
|
@ -1,6 +0,0 @@
|
||||||
/** @type {import('next').NextConfig} */
|
|
||||||
const nextConfig = {
|
|
||||||
reactStrictMode: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = nextConfig
|
|
3129
website/package-lock.json
generated
3129
website/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
"name": "website",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"dev": "next dev",
|
|
||||||
"build": "next build",
|
|
||||||
"start": "next start",
|
|
||||||
"lint": "next lint"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"eslint": "8.28.0",
|
|
||||||
"eslint-config-next": "13.0.4",
|
|
||||||
"next": "13.0.4",
|
|
||||||
"next-auth": "^4.17.0",
|
|
||||||
"react": "18.2.0",
|
|
||||||
"react-dom": "18.2.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
import '../styles/globals.css';
|
|
||||||
import { SessionProvider } from 'next-auth/react'
|
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }) {
|
|
||||||
return (
|
|
||||||
<SessionProvider session={pageProps.session}>
|
|
||||||
<Component {...pageProps} />
|
|
||||||
</SessionProvider>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default MyApp
|
|
|
@ -1,18 +0,0 @@
|
||||||
import NextAuth from "next-auth"
|
|
||||||
import DiscordProvider from "next-auth/providers/discord"
|
|
||||||
|
|
||||||
// noinspection JSUnresolvedVariable
|
|
||||||
export const authOptions = {
|
|
||||||
// Configure one or more authentication providers
|
|
||||||
providers: [
|
|
||||||
DiscordProvider(
|
|
||||||
{
|
|
||||||
clientId: '1019217990111199243',
|
|
||||||
clientSecret: 'JIgEecH6RyG9TJLZjga0EoMzafqwRIEb'
|
|
||||||
}
|
|
||||||
),
|
|
||||||
// ...add more providers here
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
export default NextAuth(authOptions);
|
|
|
@ -1,5 +0,0 @@
|
||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
|
||||||
|
|
||||||
export default function handler(req, res) {
|
|
||||||
res.status(200).json({ name: 'John Doe' })
|
|
||||||
}
|
|
|
@ -1,151 +0,0 @@
|
||||||
import timetable from '../../utils/timetable.json';
|
|
||||||
import { useSession, signIn } from "next-auth/react"
|
|
||||||
import style from '../styles/Home.module.css';
|
|
||||||
import {useState} from "react";
|
|
||||||
|
|
||||||
|
|
||||||
const days = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
||||||
|
|
||||||
|
|
||||||
function currentTimeTable(_day_diff = null) {
|
|
||||||
let now = new Date();
|
|
||||||
if(_day_diff) {
|
|
||||||
now = new Date(now.valueOf() + (86400 * _day_diff))
|
|
||||||
}
|
|
||||||
let day = days[now.getDay()];
|
|
||||||
const today_timetable = timetable[day];
|
|
||||||
return today_timetable || []
|
|
||||||
}
|
|
||||||
|
|
||||||
function is_old(lesson, now) {
|
|
||||||
let lesson_start = new Date();
|
|
||||||
lesson_start.setHours(lesson.start[0], lesson.start[1], 0)
|
|
||||||
let lesson_end = new Date();
|
|
||||||
lesson_end.setHours(lesson.end[0], lesson.end[1], 0);
|
|
||||||
if(lesson_end > now) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function currentLesson() {
|
|
||||||
const now = new Date();
|
|
||||||
const date = now.toLocaleDateString("en-GB");
|
|
||||||
const time = now.toLocaleTimeString("en-GB");
|
|
||||||
const hour = parseInt(time.split(":")[0]);
|
|
||||||
const minute = parseInt(time.split(":")[1]);
|
|
||||||
const day = days[now.getDay()];
|
|
||||||
const today_timetable = currentTimeTable();
|
|
||||||
console.debug(
|
|
||||||
now,
|
|
||||||
date,
|
|
||||||
time,
|
|
||||||
hour,
|
|
||||||
minute,
|
|
||||||
day,
|
|
||||||
today_timetable
|
|
||||||
)
|
|
||||||
|
|
||||||
for(let lesson of today_timetable) {
|
|
||||||
let lesson_start = new Date();
|
|
||||||
lesson_start.setHours(lesson.start[0], lesson.start[1], 0)
|
|
||||||
let lesson_end = new Date();
|
|
||||||
lesson_end.setHours(lesson.end[0], lesson.end[1], 0);
|
|
||||||
if(lesson_end > now) {
|
|
||||||
if(lesson_start <= now) {
|
|
||||||
console.debug("Returning", lesson)
|
|
||||||
lesson.start_timestamp = lesson_start.valueOf()
|
|
||||||
lesson.end_timestamp = lesson_end.valueOf()
|
|
||||||
return lesson
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
"name": "No Current Lesson",
|
|
||||||
"start": [0, 0],
|
|
||||||
"end": [0, 0],
|
|
||||||
"tutor": "",
|
|
||||||
"room": "",
|
|
||||||
"start_timestamp": (new Date()).setHours(0, 0, 0),
|
|
||||||
"end_timestamp": (new Date()).setHours(23, 59, 59)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function normaliseTime(t) {
|
|
||||||
return `${t[0].toString().padStart(2, "0")}:${t[1].toString().padStart(2, "0")}`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function TimeTableBlock(props) {
|
|
||||||
const lesson = props.lesson;
|
|
||||||
let [open, setOpen] = useState(false);
|
|
||||||
const _onClick = () => {setOpen(!open)};
|
|
||||||
return (
|
|
||||||
<div className={style.timetableListContainer} onClick={_onClick}>
|
|
||||||
<h3>{lesson.name || 'error'}</h3>
|
|
||||||
<span hidden={open}><i>Click/tap to expand</i></span>
|
|
||||||
<ul className={style.timetableList} hidden={!open}>
|
|
||||||
<li>Start: {normaliseTime(lesson.start || [0, 0])}</li>
|
|
||||||
<li>End: {normaliseTime(lesson.end || [23, 59])}</li>
|
|
||||||
<li>Room: {lesson.room}</li>
|
|
||||||
<li>Tutor: {lesson.tutor}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default function Home() {
|
|
||||||
let [dayOfTheWeek, setDay] = useState((new Date()).getDay());
|
|
||||||
const incrementDay = (by) => {
|
|
||||||
let new_DOTW = dayOfTheWeek + by;
|
|
||||||
if(new_DOTW>6) {
|
|
||||||
new_DOTW = 0
|
|
||||||
}
|
|
||||||
else if (new_DOTW < 0) {
|
|
||||||
new_DOTW = 6
|
|
||||||
}
|
|
||||||
setDay(new_DOTW);
|
|
||||||
}
|
|
||||||
const { data: session } = useSession();
|
|
||||||
if(!session) {
|
|
||||||
return (
|
|
||||||
<div style={{textAlign: "center"}}>
|
|
||||||
<button onClick={() => signIn()}>Sign In (with Discord)</button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
let current_lesson = currentLesson();
|
|
||||||
// let current_timetable = currentTimeTable(dayOfTheWeek);
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<h1 style={{textAlign: "center", marginBottom: "4rem"}}>Hello, {session.user.name}.</h1>
|
|
||||||
<div style={{textAlign: "center"}}>
|
|
||||||
<h1>Current lesson:</h1>
|
|
||||||
<p>{current_lesson.name}</p>
|
|
||||||
<progress value={current_lesson.start_timestamp} max={current_lesson.end_timestamp}></progress>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<hr style={{width: "75%"}}/>
|
|
||||||
<br/>
|
|
||||||
<h2 style={{textAlign: "center"}}>Full timetable:</h2>
|
|
||||||
<div className={style.todaysTimeTable}>
|
|
||||||
<div>
|
|
||||||
<h3 style={{textAlign: "center"}}>{days[dayOfTheWeek]}</h3>
|
|
||||||
</div>
|
|
||||||
<div style={{display: "flex", justifyContent: "space-between"}}>
|
|
||||||
<button onClick={() => {incrementDay(-1)}}>Previous day</button>
|
|
||||||
<button onClick={() => {incrementDay(1)}}>Next day</button>
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
currentTimeTable(dayOfTheWeek).map(
|
|
||||||
(lesson) => {
|
|
||||||
return <TimeTableBlock key={lesson.name} lesson={lesson}/>
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
|
@ -1,4 +0,0 @@
|
||||||
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
|
|
||||||
xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,31 +0,0 @@
|
||||||
ul.timetableList {
|
|
||||||
background-color: #2F3136;
|
|
||||||
padding: 2rem;
|
|
||||||
border-radius: 10%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.timetableListContainer {
|
|
||||||
background-color: #202225;
|
|
||||||
border-radius: 10%;
|
|
||||||
padding: 2rem;
|
|
||||||
margin: 2rem;
|
|
||||||
max-width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.timetableList_Old {
|
|
||||||
opacity: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.todaysTimeTable {
|
|
||||||
display: grid;
|
|
||||||
/*flex-direction: column;*/
|
|
||||||
/*align-items: center;*/
|
|
||||||
/*justify-content: space-evenly;*/
|
|
||||||
justify-content: center;
|
|
||||||
background-color: #2A2E32;
|
|
||||||
margin-left: 10%;
|
|
||||||
margin-right: 10%;
|
|
||||||
box-shadow: 5px 5px 5px 0 rgba(0, 0, 0, 0.3);
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
border: 1px black
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
html,
|
|
||||||
body {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
|
|
||||||
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
html {
|
|
||||||
color-scheme: dark;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
color: white;
|
|
||||||
background: #36393F;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue