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

merge main into develop #67

Merged
merged 52 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
c3a45a8
Merge pull request #39 from everettsouthwick/develop
everettsouthwick Aug 26, 2023
88c2975
hotfix: fix keep/delete
everettsouthwick Aug 26, 2023
3f2624b
hotfix: check for embeds
everettsouthwick Aug 27, 2023
39afcd0
Bump mongodb from 5.7.0 to 5.8.0
dependabot[bot] Aug 30, 2023
461b0a6
Merge pull request #40 from everettsouthwick/dependabot/npm_and_yarn/…
everettsouthwick Sep 5, 2023
16fb0fc
fix: suppress embeds
everettsouthwick Sep 25, 2023
a930709
chore(deps): update docker/build-push-action digest to 4c1b68d
renovate[bot] Oct 1, 2023
bf999f7
Merge pull request #41 from everettsouthwick/renovate/docker-build-pu…
everettsouthwick Oct 1, 2023
b67df9b
chore(deps): update docker/login-action digest to b4bedf8
renovate[bot] Oct 1, 2023
6605b59
chore(deps): update docker/metadata-action digest to 879dcbb
renovate[bot] Oct 1, 2023
3362809
chore(deps): update dependency open-graph-scraper to v6.2.2
renovate[bot] Oct 1, 2023
50ec7d8
Merge pull request #42 from everettsouthwick/renovate/docker-login-ac…
everettsouthwick Oct 1, 2023
4162283
Merge pull request #43 from everettsouthwick/renovate/docker-metadata…
everettsouthwick Oct 1, 2023
ba3c217
Merge pull request #44 from everettsouthwick/renovate/open-graph-scra…
everettsouthwick Oct 1, 2023
4d3805e
chore(deps): update dependency eslint to v8.50.0
renovate[bot] Oct 1, 2023
4630845
chore(deps): update actions/checkout action to v4
renovate[bot] Oct 1, 2023
3740f5c
chore(deps): update dependency mongodb to v6
renovate[bot] Oct 2, 2023
78acdc6
chore(deps): update node docker tag to v20
renovate[bot] Oct 2, 2023
6457218
Merge pull request #50 from everettsouthwick/renovate/node-20.x
everettsouthwick Oct 2, 2023
bf1d7a3
chore(deps): update dependency discord.js to v14.13.0
renovate[bot] Oct 2, 2023
2af14de
Merge pull request #46 from everettsouthwick/renovate/eslint-8.x-lock…
everettsouthwick Oct 2, 2023
237e13c
Merge pull request #48 from everettsouthwick/renovate/actions-checkou…
everettsouthwick Oct 2, 2023
9b4e94a
Merge pull request #49 from everettsouthwick/renovate/mongodb-6.x
everettsouthwick Oct 2, 2023
eb35065
Merge branch 'main' into renovate/discord.js-14.x-lockfile
everettsouthwick Oct 2, 2023
984ed34
Merge pull request #45 from everettsouthwick/renovate/discord.js-14.x…
everettsouthwick Oct 2, 2023
8d5e3f6
chore(deps): update dependency open-graph-scraper to v6.3.0
renovate[bot] Oct 5, 2023
e0cf176
Merge pull request #51 from everettsouthwick/renovate/open-graph-scra…
everettsouthwick Oct 5, 2023
276913a
chore(deps): update dependency eslint to v8.51.0
renovate[bot] Oct 6, 2023
cf89b04
Merge pull request #52 from everettsouthwick/renovate/eslint-8.x-lock…
everettsouthwick Oct 9, 2023
57d47a2
Update docker-develop-publish.yml
everettsouthwick Oct 9, 2023
65eb963
chore(deps): update docker/build-push-action action to v5
renovate[bot] Oct 9, 2023
ff258ff
Update docker-latest-publish.yml
everettsouthwick Oct 9, 2023
f254787
chore(deps): update docker/login-action action to v3
renovate[bot] Oct 9, 2023
2dbfc23
Merge pull request #54 from everettsouthwick/renovate/docker-build-pu…
everettsouthwick Oct 9, 2023
11d8775
Merge pull request #55 from everettsouthwick/renovate/docker-login-ac…
everettsouthwick Oct 9, 2023
5c6d9b0
chore(deps): update docker/login-action action to v3
renovate[bot] Oct 9, 2023
ac1fed6
Merge pull request #57 from everettsouthwick/renovate/docker-login-ac…
everettsouthwick Oct 10, 2023
fe58f1d
chore(deps): update docker/build-push-action action to v5
renovate[bot] Oct 10, 2023
5f8cb98
Merge pull request #56 from everettsouthwick/renovate/docker-build-pu…
everettsouthwick Oct 10, 2023
159b5f8
chore(deps): update docker/metadata-action action to v5
renovate[bot] Oct 10, 2023
e23da91
Merge pull request #58 from everettsouthwick/renovate/docker-metadata…
everettsouthwick Oct 10, 2023
6e1f4c2
chore(deps): update dependency mongodb to v6.2.0
renovate[bot] Oct 20, 2023
a13dc5f
chore(deps): update dependency eslint to v8.52.0
renovate[bot] Oct 20, 2023
4d6bcf7
Merge pull request #61 from everettsouthwick/renovate/eslint-8.x-lock…
everettsouthwick Oct 21, 2023
7f9c2bc
Merge pull request #60 from everettsouthwick/renovate/mongodb-6.x-loc…
everettsouthwick Oct 21, 2023
fd620b8
chore: add policies
everettsouthwick Oct 24, 2023
6069026
feat: add help command
everettsouthwick Oct 24, 2023
410a1cb
chore: update privacy policy
everettsouthwick Oct 24, 2023
7720986
Add renovate.json
renovate[bot] Oct 26, 2023
10bce3e
Update renovate.json
everettsouthwick Oct 26, 2023
9f78101
Merge pull request #63 from everettsouthwick/renovate/configure
everettsouthwick Oct 26, 2023
bb367a4
Merge branch 'develop' into main
everettsouthwick Oct 26, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/docker-develop-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
images: ecsouthwick/embetter

- name: Build and push Docker image
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ecsouthwick/embetter
8 changes: 4 additions & 4 deletions .github/workflows/docker-latest-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
uses: docker/metadata-action@v5
with:
images: ecsouthwick/embetter

- name: Build and push Docker image
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM node:18-alpine
FROM node:20-alpine
ENV NODE_ENV=production

WORKDIR /app
Expand Down
27 changes: 27 additions & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Embetter Discord Bot - Privacy Policy

## Introduction
Welcome to the Privacy Policy for the Embetter Discord Bot. We are committed to protecting your privacy and ensuring you have a secure experience while using our bot. This policy explains what data we collect, how we use it, and what controls you have over your data.

## Data We Collect
The only data we collect is the identification information for your Discord server, commonly known as the guild ID. This guild ID is essential for customizing and operating Embetter within your specific Discord server.

## No Message Storage
Rest assured, we do not store any of your messages. Our bot is designed to interact with you in real-time and does not maintain any historical records of your text or voice conversations.

## How We Use Data
The guild ID we collect is used exclusively for configuring Embetter to function as designed within your Discord server. This includes custom settings, features, and functionalities that you may enable or disable.

## Data Sharing
We do not share your guild ID or any other data with third parties. The only exceptions would be in compliance with legal requirements or if you explicitly authorize us to do so.

## Security
While it is true that no method of data storage is completely secure, we take robust security measures to protect the data we do collect. This includes encryption and secure access controls.

## Data Deletion
To get your data deleted, you can either remove the bot from your server, or contact us directly. Upon receiving your request, we will promptly delete the guild ID and any associated settings from our database.

## Contact Information
For any questions or concerns about this Privacy Policy, please contact us through our Discord server [here](https://discord.gg/2mhXfRNHak) or via email at [email protected].

Last Updated: 2023-10-24
30 changes: 30 additions & 0 deletions TERMS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Embetter Discord Bot - Terms of Service

## Introduction
Welcome to Embetter, a Discord bot designed to enhance your Discord experience. By using Embetter, you agree to comply with and be bound by the following Terms of Service. Please read them carefully.

## User Responsibilities
As a user of Embetter, you agree not to:
- Abuse or exploit any bugs, glitches, or errors in the bot.
- Use the bot for any illegal or unauthorized purposes.
- Spam commands or messages.

## Data Usage
We may collect data to improve the bot and enhance user experience. This data will not be shared with third parties for commercial purposes.

## Disclaimer
Embetter is provided "as is" without any warranties of any kind, either express or implied.

## Limitations of Liability
We will not be liable for any damages or losses incurred from the use or misuse of Embetter.

## Termination of Service
We reserve the right to terminate or suspend access to our bot without prior notice for conduct that we believe violates these Terms of Service or is harmful to other users of Embetter, us, or third parties, or for any other reason.

## Miscellaneous
These Terms of Service shall be governed by and construed in accordance with the laws of the jurisdiction in which you reside. Any disputes will be handled in the jurisdiction in which you reside.

## Contact Information
For any questions about these Terms of Service, please contact us at [email protected].

Last Updated: 2023-10-24
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "GPL-3.0",
"dependencies": {
"discord.js": "^14.11.0",
"mongodb": "^5.7.0",
"mongodb": "^6.0.0",
"open-graph-scraper": "^6.2.1"
},
"devDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":automergeStableNonMajor",
"schedule:nonOfficeHours"
],
"baseBranches": [
"develop"
]
}
35 changes: 35 additions & 0 deletions src/commands/slash/utility/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// path/to/your/command/files/help.js

const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('help')
.setDescription('Displays the help page.')
.setDefaultMemberPermissions(PermissionFlagsBits.ViewChannel)
.setDMPermission(true),
async execute(interaction) {
const privacyPolicyLink = 'https://github.com/everettsouthwick/embetter/blob/main/PRIVACY.md';

const helpMessage = `
**Embetter help information**

1. **/archive**: Attempts to embed and archive the provided link(s).
- Option: \`link\` (required) - Space separated list of link(s) to embed.

2. **/embed**: Attempts to embed the provided link(s).
- Option: \`link\` (required) - Space separated list of link(s) to embed.

3. **/mode**: Configure the embed mode.
- Subcommand: \`set\` - Sets the mode for embeds. Options: Replace, Reply, Ask, Manual.

4. **/platform**: Configure the platforms.
- Subcommand: \`set\` - Sets the platform for embeds. Choices: Instagram, Threads, TikTok, etc.
- Subcommand: \`list\` - Lists the platforms and their status.

View our [privacy policy](<${privacyPolicyLink}>) for data retention and privacy information.
`;

await interaction.reply({ content: helpMessage, ephemeral: true });
},
};
31 changes: 23 additions & 8 deletions src/utils/handleLinkResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,26 @@ async function sendReplyModeMessage(messageOrInteraction, links, embeds) {
new ButtonBuilder().setCustomId('keep').setLabel('Keep').setStyle(ButtonStyle.Primary),
new ButtonBuilder().setCustomId('delete').setLabel('Delete').setStyle(ButtonStyle.Danger),
)];
const options = { content: links.join('\n'), embeds: embeds.length ? embeds : undefined, components };
const options = { content: links.join('\n'), embeds: embeds.length ? embeds : undefined, components: embeds.length ? components : undefined };
const response = await messageOrInteraction.reply(options);

if (!isInteraction && !(await checkForEmbed(response, embeds))) return await response.delete();
if (!isInteraction) await response.edit({ components });
if (!isInteraction) {
try {
await checkForEmbed(response);
await response.edit({ components: components });
}
catch (e) {
await response.delete();
}
}

const collector = response.createMessageComponentCollector({ componentType: ComponentType.Button, time: 180000 });
collector.on('collect', async (i) => {
if (i.customId === 'keep') return collector.stop() && await response.edit({ components: [] });
if (isInteraction && i.customId === 'keep') return await collector.stop() && await response.edit({ components: [] });
if (i.customId === 'keep') return messageOrInteraction.suppressEmbeds(true) && await collector.stop() && await response.edit({ components: [] });
if (i.user.id !== userId && !i.member.permissions.has(PermissionsBitField.Flags.ManageMessages)) return await i.reply({ content: 'You are not authorized to delete this message.', ephemeral: true });
await await response.delete() && collector.stop();
await collector.stop();
await response.delete();
});
collector.on('end', async () => await response.edit({ components: [] }).catch(() => {}));
}
Expand All @@ -49,10 +58,16 @@ async function sendAskModeMessage(message, links, embeds) {
async function checkForEmbed(message) {
if (message.content.includes('https://web.archive.org/')) return Promise.resolve(true);
const startTime = Date.now();
return new Promise((resolve) => {
return new Promise((resolve, reject) => {
const check = setInterval(() => {
if (message.embeds.length) return clearInterval(check) && resolve(true);
if (Date.now() - startTime > 10000) return clearInterval(check) && resolve(false);
if (message.embeds.length) {
clearInterval(check);
resolve(true);
}
if (Date.now() - startTime > 10000) {
clearInterval(check);
reject(false);
}
}, 200);
});
}
Expand Down
Loading
Loading