Skip to content

Commit

Permalink
clean up work
Browse files Browse the repository at this point in the history
  • Loading branch information
johnuberbacher committed Jul 28, 2023
1 parent c8dcd01 commit 577a9ea
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ bower_components

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
release/

# Dependency directories
node_modules/
Expand Down Expand Up @@ -90,6 +91,7 @@ out
# Nuxt.js build / generate output
.nuxt
dist
dist-electron

# Gatsby files
.cache/
Expand Down
5 changes: 1 addition & 4 deletions electron-builder.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/**
* @see https://www.electron.build/configuration/configuration
*/
{
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
"appId": "YourAppID",
"appId": "com.johnuberbacher.discordbotmessenger",
"asar": true,
"directories": {
"output": "release/${version}"
Expand Down
2 changes: 1 addition & 1 deletion electron/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function createWindow() {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
devTools: true,
devTools: false,
},
});

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"scripts": {
"dev": "vite",
"build": "vite build && electron-builder",
"preview": "vite serve"
"preview": "vite serve",
"app:dir": "electron-builder --dir",
"app:dist": "electron-builder",
"postinstall": "electron-builder install-app-deps"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.1.0",
Expand Down
14 changes: 10 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ const connectToDiscordBot = async () => {
name: guild.name,
}));
channels.value = client.channels.cache.map((channel) => ({
id: channel.id,
name: channel.name,
}));
// Modify the channels.value array to exclude channels whose names end in " Channels"
channels.value = client.channels.cache
.filter((channel) => !channel.name.endsWith(" Channels"))
.map((channel) => ({
id: channel.id,
name: channel.name,
}));
console.log(channels.value);
connectedToBot.value = true;
});
Expand All @@ -109,6 +114,7 @@ const connectToDiscordBot = async () => {
}
};
// Define a reactive variable to track whether the bot is connected or not
const isBotConnected = ref(false);
Expand Down
12 changes: 4 additions & 8 deletions src/components/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ const saveConfig = async () => {
return;
}
// Add a one-second delay here
await new Promise((resolve) => setTimeout(resolve, 1000));
// Save the bot token to the store
await store.set("discordBotTokenStorage", discordBotTokenStorage.value);
Expand All @@ -109,6 +106,9 @@ const saveConfig = async () => {
// Emit the "connectToDiscordBot" event to notify the parent component
await emit("connectToDiscordBot");
// Add a one-second delay here
await new Promise((resolve) => setTimeout(resolve, 1000));
// Check bot connection validation and proceed accordingly
if (validateBotConnection()) {
error.value = "";
Expand All @@ -119,17 +119,13 @@ const saveConfig = async () => {
// Function to dismiss the configuration without saving
const dismissConfig = () => {
if (!discordBotTokenStorage.value) {
if (!store.get("discordBotTokenStorage")) {
error.value = "Please enter a bot token";
shake();
isLoading.value = false;
return;
}
if (!validateBotConnection()) {
return;
}
error.value = "";
emit("toggleConfig");
};
Expand Down
8 changes: 6 additions & 2 deletions src/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
:root {
--base-primary: rgb(88, 101, 242);
--base-success: rgb(35, 165, 90);
--base-button-background: rgb(88, 101, 242);
--base-button-background-hover: rgb(80, 91, 219);
--base-button-background-active: rgb(74, 85, 203);
// --base-success: rgb(38, 126, 70);
--base-success: rgb(35 165 90);
--base-danger: rgb(214, 59, 64);
--base-100: #383a40;
--base-200: #313338;
Expand Down Expand Up @@ -279,7 +283,7 @@ body {
text-decoration: underline;
}

.label {
label {
@include no-select;
text-transform: uppercase;
display: block;
Expand Down

0 comments on commit 577a9ea

Please sign in to comment.