Skip to content

Commit

Permalink
Added temp desks and chairs enum class and updated docker compose exa…
Browse files Browse the repository at this point in the history
…mple
  • Loading branch information
SandwichBtw committed Nov 29, 2023
1 parent c0b22eb commit 6abba87
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
8 changes: 7 additions & 1 deletion docker-compose-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ services:
- TOKEN=YOURTOKENHERE
- PREFIX=.
- ADMINS=1234
- SHARDS=1
- SHARDS=1
- CHANNEL_ID=YOURCHANNELIDHERE
- POSTGRES_HOST=127.0.0.1
- POSTGRES_USERNAME=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=crystalbot
43 changes: 43 additions & 0 deletions src/constants/desksAndChairsFacts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export enum desksAndChairsFacts {
n1 = "The average person uses a desk at least once in their life",
n2 = "I saw a desk at IKEA once",
n3 = "The average desk is not a sentient being (or is it?)",
n4 = "Some desks are really cool",
n5 = "Desks are real",
n6 = "desk",
n7 = "There is usually at least one desk in a school",
n8 = "There is probably a desk in your house",
n9 = "desks aren't typically edible",
n10 = "You can put things on a desk",
n11 = "Some desks are green",
n12 = "My desk isn't green",
n13 = '"Desk" is a word in english',
n14 = "Some desks are made of wood",
n15 = "Some desks are made of metal",
n16 = "SOME DESKS ARE MADE OF DESK!!",
n17 = `The word "desk" doesn't sound like a word to me anymore because i've said it so many times in my head`,
n18 = "Desks are quite similar to dogs, as they both often have four legs",
n19 = `I own a desk and i'm going to name it "desk"`,
n20 = "Desks > tables",

n21 = "I wrote all these facts while sitting in a chair!",
n22 = "The chair has many different forms",
n23 = "Some chairs are kinda mean tbh (though some are nice)",
n24 = "I don't know who invented the chair",
n25 = "The haters told me I couldn't own a pet chair. I proved them WRONG!",
n26 = "The gaming chair was a revolutionary creation which is currently used by gamers all over the world",
n27 = "Wulfie owns a chair from IKEA",
n28 = '"Crystal" and "chair" both start with the letter "C"',
n29 = "Most people know what a chair is (I think I know what a chair is)",
n30 = "respect the chairs",
n31 = "There is always a possibility that chairs could one day become sentient and try to take over the world!",
n32 = "i really want a flying chair :(",
n33 = "i saw a blue chair at school",
n34 = "I, The LEGENDARY Crystal Bot, dream of one day owning 4529 chairs ",
n35 = "I will 100% support the chairs when they take over the world",
n36 = "people genuinely need to stop using chairs as shopping carts",
n37 = "If you own a chair, you probably breath air",
n38 = `Most people don't know this, but the word "chair" starts with the letter C`,
n39 = "Some chairs could technically be used as a form of transport",
n40 = "this fact about chairs probably made you think about chairs"
}
19 changes: 13 additions & 6 deletions src/modules/utils/messageScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,38 @@ import type CrystalClient from "../../types/CrystalClient"
import { type TextChannel } from "discord.js"
import { getConfig } from "../config"
import { microwaveThings } from "../../constants/microwaveThings"
import { desksAndChairsFacts } from "../../constants/desksAndChairsFacts"

const config = getConfig()

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export async function loadSchedules(client: CrystalClient): Promise<void> {
// schedule.scheduleJob('26 8 * * 5', microwave)
schedule.scheduleJob('30 18 * * 2', microwave)
schedule.scheduleJob('26 8 * * 5', microwave)
schedule.scheduleJob('34 13 * * 1,4,6', desksAndChairs)
schedule.scheduleJob('12 5 * * 1,4,6', desksAndChairs)
schedule.scheduleJob('56 16 * * 1,4,6', desksAndChairs)
schedule.scheduleJob('0 12 */8 * *', polls)

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
async function microwave() {
const channel = await client.channels.fetch(config.channelId) as TextChannel
const values = Object.values(microwaveThings);
function enumRandomIndex(enumName: any) {
const values = Object.values(enumName);
const randomIndex = Math.floor(Math.random() * values.length);
const randomItem = values[randomIndex];
return values[randomIndex] as string
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
async function microwave() {
const randomItem = enumRandomIndex(microwaveThings)
const channel = await client.channels.fetch(config.channelId) as TextChannel
await channel.send(`Gosh darn it! I forgot my ${randomItem} in the microwave again!`)
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
async function desksAndChairs() {

const Fact = enumRandomIndex(desksAndChairsFacts)
const channel = await client.channels.fetch(config.channelId) as TextChannel
await channel.send(Fact)
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
Expand Down

0 comments on commit 6abba87

Please sign in to comment.