Skip to content
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

Make bot suitable for multiple servers #67

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

Make bot suitable for multiple servers #67

wants to merge 44 commits into from

Conversation

TrojanerHD
Copy link
Owner

@TrojanerHD TrojanerHD commented Jan 14, 2023

  • Change to database for storing guild-related settings
  • Make bot settings customizable via commands
  • Fix new bugs due to implemented features
    • Wrong behavior / missing functionality when joining a new server
  • Make sure the command permissions can be updated (send authorize URL to executor of /permit command if required)
  • Test if everything works as intended

@TrojanerHD
Copy link
Owner Author

TrojanerHD commented Mar 5, 2023

Currently known bug: The bot has to be fully restarted in order to use the live and roles channel in a server it has been added during runtime

src/ReactionHandler.ts Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/twitch/LiveChannel.ts Outdated Show resolved Hide resolved
@TrojanerHD TrojanerHD marked this pull request as ready for review March 12, 2023 22:10
@TrojanerHD TrojanerHD mentioned this pull request Mar 18, 2023
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/ReactionHandler.ts Show resolved Hide resolved
src/messages/MessageHandler.ts Outdated Show resolved Hide resolved
src/messages/permissions/Authentication.ts Show resolved Hide resolved
src/messages/permissions/Authentication.ts Outdated Show resolved Hide resolved
src/messages/permissions/Authentication.ts Outdated Show resolved Hide resolved
src/messages/permissions/CommandPermissions.ts Outdated Show resolved Hide resolved
src/messages/permissions/CommandPermissions.ts Outdated Show resolved Hide resolved
src/messages/permissions/CommandPermissions.ts Outdated Show resolved Hide resolved
Comment on lines 15 to 16
## Deployment and contribution
### Requirements
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add docker deployment explanation

@TrojanerHD
Copy link
Owner Author

Edge case: If a user types /permit add <user>, then ignores the info message that authentication is needed and then /permit add <user> is executed again (either by the user themselves or by another user), the commands do not get reloaded (as in: the changes are not applied immediately)

@TrojanerHD
Copy link
Owner Author

Refresh tokens sometimes do not get stored and the whole permission system doesn't seem to work as the restricted commands don't get any custom roles that are permitted to execute them

streamers: [],
refreshToken: '',
}).catch(console.error);
} else this.warning(`Limited features due to problems ${guildInfo}`);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove a guild from the safe guilds if there was a problem to make this function safe when re-executing

);
} finally {
if (!error) {
DiscordClient._safeGuilds.push(guild);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if safe guilds doesn't already have this guild to make this function safe when re-executing

* @param data The data to insert or update
*/
protected async upsert(tableName: string, data: T): Promise<void> {
const id = data.id;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const id = data.id;
const { id } = data;

Comment on lines +97 to +101
if (i !== -1) {
this.#cache[i].info = data;
} else {
this.#cache.push({ id, info: data });
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (i !== -1) {
this.#cache[i].info = data;
} else {
this.#cache.push({ id, info: data });
}
if (i !== -1)
this.#cache[i].info = data;
else
this.#cache.push({ id, info: data });

@@ -1,5 +1,16 @@
# Trojaner Bot
This is a [Discord](https://discord.com) bot currently only running on my [Discord server](https://discord.gg/NdsmmwV). There is no official way of adding this bot to your own Discord server.
This is a [Discord](https://discord.com) bot currently only running on my [Discord server](https://discord.gg/NdsmmwV). To add this bot on your server, use the following link:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This is a [Discord](https://discord.com) bot currently only running on my [Discord server](https://discord.gg/NdsmmwV). To add this bot on your server, use the following link:
This is a [Discord](https://discord.com) bot currently only running on my [Discord server](https://discord.gg/NdsmmwV). To add this bot on your server, follow these steps:

## Adding the bot to your server
1. Click the following link: https://discord.com/api/oauth2/authorize?client_id=632637013475983360&permissions=8&scope=bot%20applications.commands
- Note that the bot is added with admin privileges. You may alter the permissions value but keep in mind that some features might not work or lead to unexpected behavior
2. (Optional, can be done later) Set up the following text-channels
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. (Optional, can be done later) Set up the following text-channels
2. (Optional, can be done later) Set up the following text-channels:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
1 participant