Skip to content

Fix/develop deploy #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 0 additions & 121 deletions data/lunch_buddy_locations.js

This file was deleted.

119 changes: 119 additions & 0 deletions data/lunch_buddy_locations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
[
{
"value": "Upper Campus Food Court",
"sub": [
{
"name": "Tropical Green Pho"
},
{
"name": "Pho House"
},
{
"name": "Classic Kebab"
},
{
"name": "Chinese Takeaway"
},
{
"name": "Tori Sushi"
},
{
"name": "Gradu-eat"
},
{
"name": "The Little Marionette Cafe"
},
{
"name": "Lhaksa Delight"
},
{
"name": "Bioscience building Cafe (XS Espresso)"
}
]
},
{
"value": "Subway Zone",
"sub": [
{
"name": "Subway"
},
{
"name": "Boost"
},
{
"name": "Southern Wok"
},
{
"name": "Cafe Brioso"
},
{
"name": "Penny Lane"
}
]
},
{
"value": "Quadrangle Food Court",
"sub": [
{
"name": "Soul Origin"
},
{
"name": "PappaRich"
},
{
"name": "Nene Chicken"
},
{
"name": "Plume Cafe"
}
]
},
{
"value": "Lower Campus",
"sub": [
{
"name": "Stellinis Pasta Bar"
},
{
"name": "Guzman Y Gomez"
},
{
"name": "Mamak Village"
},
{
"name": "Yallah Eats Kebab and Shawarma"
},
{
"name": "Sharetea"
},
{
"name": "Maze Coffee & Food"
},
{
"name": "Campus Village Cafe"
},
{
"name": "Home Ground Kiosk"
}
]
},
{
"value": "J17 Ainsworth",
"sub": [
{
"name": "Coffee on Campus Cafe"
}
]
},
{
"value": "Other Options",
"sub": [
{
"name": "Sport"
},
{
"name": "On Campus Study"
}
]
}
]
12 changes: 6 additions & 6 deletions events/lunch_buddy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { EmbedBuilder, ButtonBuilder, ActionRowBuilder } = require("discord.js");
const cron = require("node-cron");
const lunchBuddyLocations = require("../data/lunch_buddy_locations.js");
const lunchBuddyLocations = require("../data/lunch_buddy_locations.json");
const config = require("../config/lunch_buddy.json");

const maxRowButtons = 4;
Expand All @@ -18,7 +18,7 @@ const generalLocationInfo =
"This lunch buddy vote commenced at 10am, you must vote for the location by 12pm, when one will be chosen.";

const getLocations = (area) => {
for (const object of lunchBuddyLocations.locations) {
for (const object of lunchBuddyLocations) {
if (object.value === area) {
return object;
}
Expand All @@ -27,7 +27,7 @@ const getLocations = (area) => {
};

const generateAreasEmbed = (areaVotes) => {
const areas = lunchBuddyLocations.locations.map(
const areas = lunchBuddyLocations.map(
(element) => `${element.value}: ${areaVotes ? areaVotes[element.value].length : 0}`,
);
areas.push(`Any: ${areaVotes ? areaVotes["Any"].length : 0}`);
Expand Down Expand Up @@ -69,9 +69,9 @@ const generateLocationsEmbed = (area, votes) => {
);
};

const areasList = lunchBuddyLocations.locations.map((element) => element.value);
const areasList = lunchBuddyLocations.map((element) => element.value);
areasList.push("Any");
const areasButtons = lunchBuddyLocations.locations.map(
const areasButtons = lunchBuddyLocations.map(
(element) =>
new ButtonBuilder({
style: "PRIMARY",
Expand All @@ -93,7 +93,7 @@ areasButtons.push(
customId: `Remove${areaButtonCustomId}`,
}),
);
const areasButtonsIds = lunchBuddyLocations.locations.map(
const areasButtonsIds = lunchBuddyLocations.map(
(element) => `${element.value}${areaButtonCustomId}`,
);
areasButtonsIds.push(`Any${areaButtonCustomId}`);
Expand Down
Loading