Skip to content

Commit 4547d97

Browse files
authored
🚀 release: v0.1.20-alpha
Merge pull request #8 from wgtechlabs/dev
2 parents 0567ee2 + f4beee1 commit 4547d97

File tree

14 files changed

+648
-127
lines changed

14 files changed

+648
-127
lines changed

.github/funding.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Support this open-source project.
2+
# Maintained by Waren Gonzaga under WG Technology Labs with contributions from the community.
3+
# GitHub Sponsors: https://github.com/sponsors/wgtechlabs
4+
# Buy Me a Coffee: https://buymeacoffee.com/wgtechlabs
5+
6+
github: [wgtechlabs, warengonzaga]
7+
buy_me_a_coffee: [wgtechlabs, warengonzaga]
8+
9+
# Your support directly funds continued development, maintenance, and new features.
10+
# Every contribution helps ensure this project remains free, up-to-date, and accessible to all.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Unthread Discord Bot 🤖
22

3-
[![made by](https://img.shields.io/badge/made%20by-WG%20Technology%20Labs-0060a0.svg?logo=github&longCache=true&labelColor=181717&style=flat-square)](https://github.com/wgtechlabs) [![sponsors](https://img.shields.io/badge/sponsor-%E2%9D%A4-%23db61a2.svg?&logo=github&logoColor=white&labelColor=181717&style=flat-square)](https://github.com/sponsors/warengonzaga)
3+
[![made by](https://img.shields.io/badge/made%20by-WG%20Technology%20Labs-0060a0.svg?logo=github&longCache=true&labelColor=181717&style=flat-square)](https://github.com/wgtechlabs) [![sponsors](https://img.shields.io/badge/sponsor-%E2%9D%A4-%23db61a2.svg?&logo=github&logoColor=white&labelColor=181717&style=flat-square)](https://github.com/sponsors/wgtechlabs)
44

55
<!-- [![release](https://img.shields.io/github/release/wgtechlabs/unthread-discord-bot.svg?logo=github&labelColor=181717&color=green&style=flat-square)](https://github.com/wgtechlabs/unthread-discord-bot/releases) [![star](https://img.shields.io/github/stars/wgtechlabs/unthread-discord-bot.svg?&logo=github&labelColor=181717&color=yellow&style=flat-square)](https://github.com/wgtechlabs/unthread-discord-bot/stargazers) [![license](https://img.shields.io/github/license/wgtechlabs/unthread-discord-bot.svg?&logo=github&labelColor=181717&style=flat-square)](https://github.com/wgtechlabs/unthread-discord-bot/blob/main/license) -->
66

code_of_conduct.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
sudo@wgtechlabs.com.
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

contributing.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 🎯 Contribute to Open Source
2+
3+
Any contributions are welcome, encouraged, and valued. See the following information below for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for me as maintainer and smooth out the experience for all involved. The community looks forward to your contributions. 🎉✌✨
4+
5+
## 📋 Code of Conduct
6+
7+
This project and everyone participating in it is governed by the project's [Code of Conduct](./code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to <sudo@wgtechlabs.com>.
8+
9+
## 💖 How to Contribute
10+
11+
There are many ways to contribute to this open source project. Any contributions are welcome and appreciated. Be sure to read the details of each section for you to start contributing.
12+
13+
### 🧬 Development
14+
15+
If you can write code then create a pull request to this repo and I will review your code. Please consider submitting your pull request to the `dev` branch. I will auto reject if you submit your pull request to the `main` branch.
16+
17+
#### 🔧 Setup
18+
19+
To get started with development:
20+
21+
1. **Fork and clone the repository**
22+
```bash
23+
git clone https://github.com/your-username/unthread-discord-bot.git
24+
cd unthread-discord-bot
25+
```
26+
27+
2. **Install dependencies**
28+
```bash
29+
yarn install
30+
# or
31+
npm install
32+
```
33+
34+
3. **Set up environment variables**
35+
- Copy `.env.example` to `.env`
36+
- Fill in the required information as described in the README
37+
38+
4. **Start the bot in development mode**
39+
```bash
40+
yarn dev
41+
# or
42+
npm run dev
43+
```
44+
45+
5. **Deploy commands when needed**
46+
```bash
47+
yarn deploycommand
48+
# or
49+
npm run deploycommand
50+
```
51+
52+
Please refer to the [README](./README.md) for more detailed setup instructions, including Discord application setup and webhook configuration.
53+
54+
### 📖 Documentation
55+
56+
Improvements to documentation are always welcome! This includes:
57+
- README updates
58+
- Code comments
59+
- Examples and usage guides
60+
- Fixing typos or clarifying existing documentation
61+
62+
### 🐞 Reporting Bugs
63+
64+
For any security bugs or issues, please read the [security policy](./security.md).
65+
For other bugs, please create an issue using the bug report template.
66+
67+
---
68+
69+
💻 with ❤️ by [Waren Gonzaga](https://warengonzaga.com), [WG Technology Labs](https://wgtechlabs.com), and [Him](https://www.youtube.com/watch?v=HHrxS4diLew&t=44s) 🙏

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "unthread-discord-bot",
33
"description": "A simple discord bot integration for unthread.io",
4-
"version": "0.1.8",
4+
"version": "0.1.20-alpha",
55
"private": true,
66
"main": "index.js",
77
"scripts": {

security.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Security
2+
3+
If you identify any security vulnerabilities or concerns within this repository, please report them promptly by emailing us at [security@wgtechlabs.com](mailto:security@wgtechlabs.com).
4+
5+
Your efforts to help us maintain the safety and integrity of our open-source projects are greatly appreciated. Thank you for contributing to a more secure community!
6+
7+
---
8+
9+
🔐 with ❤️ by [Waren Gonzaga](https://warengonzaga.com), [WG Technology Labs](https://wgtechlabs.com) and [Him](https://www.youtube.com/watch?v=HHrxS4diLew&t=44s) 🙏

src/commands/utilities/ping.js

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,54 @@
1-
const { SlashCommandBuilder } = require('discord.js');
1+
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
22

3+
/**
4+
* Ping Command
5+
*
6+
* Provides diagnostic information about the bot's connection to Discord.
7+
* Displays two metrics:
8+
* - API Latency: Measures the time taken for a round-trip interaction with Discord.
9+
* - WebSocket Heartbeat: Indicates the current ping to Discord's gateway.
10+
*
11+
* @module commands/utilities/ping
12+
*/
313
module.exports = {
4-
data: new SlashCommandBuilder()
5-
.setName('ping')
6-
.setDescription('Replies with Pong!'),
7-
async execute(interaction) {
8-
await interaction.reply('Pong!');
9-
},
14+
data: new SlashCommandBuilder()
15+
.setName('ping')
16+
.setDescription('Shows bot latency and API ping metrics.'),
17+
18+
/**
19+
* Executes the ping command.
20+
*
21+
* @async
22+
* @param {Interaction} interaction - The interaction object from Discord.js.
23+
* @returns {Promise<void>}
24+
*
25+
* Implementation Details:
26+
* - Uses `deferReply` to measure API latency accurately.
27+
* - Calculates round-trip latency and retrieves WebSocket heartbeat.
28+
* - Sends results in an embedded message for better readability.
29+
*/
30+
async execute(interaction) {
31+
// Defer the reply to calculate API latency accurately.
32+
const sent = await interaction.deferReply({ fetchReply: true });
33+
34+
// Calculate the API latency (round-trip time).
35+
const apiLatency = sent.createdTimestamp - interaction.createdTimestamp;
36+
37+
// Retrieve the WebSocket heartbeat from the client.
38+
const wsHeartbeat = interaction.client.ws.ping;
39+
40+
// Create an embed to display the latency metrics.
41+
const embed = new EmbedBuilder()
42+
.setColor(0xEB1A1A) // Red color for emphasis. #EB1A1A
43+
.setTitle('🏓 Pong!')
44+
.addFields(
45+
{ name: 'API Latency', value: `${apiLatency}ms`, inline: true },
46+
{ name: 'WebSocket Heartbeat', value: `${wsHeartbeat}ms`, inline: true }
47+
)
48+
.setFooter({ text: 'Discord Bot Latency Metrics' })
49+
.setTimestamp();
50+
51+
// Edit the deferred reply to include the embed with metrics.
52+
await interaction.editReply({ embeds: [embed] });
53+
},
1054
};

src/commands/utilities/server.js

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,44 @@
1-
const { SlashCommandBuilder } = require('discord.js');
1+
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
22

3+
/**
4+
* Server Command
5+
*
6+
* Provides detailed information about the current Discord server.
7+
* Displays key server metrics including server name, member count, and creation date.
8+
*
9+
* @module commands/utilities/server
10+
*/
311
module.exports = {
412
data: new SlashCommandBuilder()
513
.setName('server')
614
.setDescription('Provides information about the server.'),
15+
16+
/**
17+
* Executes the server command.
18+
*
19+
* @async
20+
* @param {Interaction} interaction - The interaction object from Discord.js.
21+
* @returns {Promise<void>}
22+
*
23+
* Implementation Details:
24+
* - Retrieves server information from the interaction's guild object
25+
* - Formats the server creation timestamp as a Discord timestamp
26+
* - Creates an embedded message with relevant server information
27+
* - Replies to the interaction with the formatted embed
28+
*/
729
async execute(interaction) {
8-
// interaction.guild is the object representing the Guild in which the command was run
9-
await interaction.reply(`This server is ${interaction.guild.name} and has ${interaction.guild.memberCount} members.`);
30+
const embed = new EmbedBuilder()
31+
.setColor(0xEB1A1A)
32+
.setTitle('Server Information')
33+
.addFields(
34+
{ name: 'Server Name', value: interaction.guild.name, inline: true },
35+
{ name: 'Total Members', value: `${interaction.guild.memberCount}`, inline: true },
36+
{ name: 'Created At', value: `<t:${Math.floor(interaction.guild.createdTimestamp / 1000)}:F>`, inline: false }
37+
)
38+
.setThumbnail(interaction.guild.iconURL({ dynamic: true }))
39+
.setFooter({ text: `Server ID: ${interaction.guild.id}` })
40+
.setTimestamp();
41+
42+
await interaction.reply({ embeds: [embed] });
1043
},
1144
};

src/commands/utilities/user.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
1-
const { SlashCommandBuilder } = require('discord.js');
1+
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
22

3+
/**
4+
* User Command
5+
*
6+
* Provides detailed information about the Discord user who triggered the command.
7+
* Displays key user information including username, server join date, and account creation date.
8+
*
9+
* @module commands/utilities/user
10+
*/
311
module.exports = {
412
data: new SlashCommandBuilder()
513
.setName('user')
614
.setDescription('Provides information about the user.'),
15+
16+
/**
17+
* Executes the user command.
18+
*
19+
* @async
20+
* @param {Interaction} interaction - The interaction object from Discord.js.
21+
* @returns {Promise<void>}
22+
*
23+
* Implementation Details:
24+
* - Retrieves user information from the interaction object
25+
* - Formats timestamps using Discord's timestamp formatting
26+
* - Creates an embedded message with relevant user information
27+
* - Replies to the interaction with the formatted embed
28+
*/
729
async execute(interaction) {
8-
// interaction.user is the object representing the User who ran the command
9-
// interaction.member is the GuildMember object, which represents the user in the specific guild
10-
await interaction.reply(`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`);
30+
const embed = new EmbedBuilder()
31+
.setColor(0xEB1A1A)
32+
.setTitle('User Information')
33+
.addFields(
34+
{ name: 'Username', value: interaction.user.username, inline: true },
35+
{ name: 'Joined Server', value: `<t:${Math.floor(interaction.member.joinedTimestamp / 1000)}:F>`, inline: true },
36+
{ name: 'Account Created', value: `<t:${Math.floor(interaction.user.createdTimestamp / 1000)}:F>`, inline: false }
37+
)
38+
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
39+
.setFooter({ text: `User ID: ${interaction.user.id}` })
40+
.setTimestamp();
41+
42+
await interaction.reply({ embeds: [embed] });
1143
},
1244
};

0 commit comments

Comments
 (0)