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

feat: message sending feature and event listening with standalone server setup #1

Merged
merged 31 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9fb8dbf
chore: WIP
sarthakjdev May 16, 2024
d936fde
fix: make requester and manager package internal
sarthakjdev May 16, 2024
5d8afd8
chore: move example-chat-bot in the root
sarthakjdev May 16, 2024
8e615e9
feat: add .github dir
sarthakjdev May 16, 2024
8a91d40
Merge branch 'master' of github.com:sarthakjdev/wapi.go into feat/v1
sarthakjdev May 16, 2024
c559e6b
feat: request client works fine and Message manager works fine too.
sarthakjdev May 22, 2024
98997dc
chore: fmt
sarthakjdev May 22, 2024
938d89c
chore: text message works fine
sarthakjdev May 22, 2024
9b269d3
feat: add contact message
sarthakjdev May 22, 2024
d2e2916
feat: add location message
sarthakjdev May 23, 2024
915b09f
chore: wapi.js -> wapi.go
sarthakjdev May 23, 2024
8172cef
docs: add readme
sarthakjdev May 23, 2024
0c55131
feat: add media messages
sarthakjdev May 23, 2024
fc82396
feat: add reaction message
sarthakjdev May 23, 2024
8f1d539
feat: list interative message
sarthakjdev May 23, 2024
db83552
fix: syntax error
sarthakjdev May 23, 2024
7c2b493
docs: add docs for list interactive message
sarthakjdev May 23, 2024
764a68f
fix: audio message
sarthakjdev May 23, 2024
12dd5fe
fix: format
sarthakjdev May 23, 2024
570a1ab
feat: add quick reply button component
sarthakjdev May 23, 2024
b34d46e
feat: add event emit and listen arch, user end is still left
sarthakjdev May 28, 2024
a00b445
feat: add reply and react functions
sarthakjdev May 28, 2024
841b7b8
chore: Wip
sarthakjdev May 28, 2024
2ae7b38
chore: Wip
sarthakjdev May 28, 2024
2536efe
feat: event listening works now
sarthakjdev May 31, 2024
af9bf60
fix: formatting
sarthakjdev May 31, 2024
82a3fda
feat: add all event structures
sarthakjdev Jun 1, 2024
22873f5
chore: WIP
sarthakjdev Jun 1, 2024
0cdfca4
chore: remove release workflow
sarthakjdev Jun 1, 2024
1e8f98b
test: hooks
sarthakjdev Jun 1, 2024
064b39f
feat: add husky
sarthakjdev Jun 1, 2024
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
98 changes: 98 additions & 0 deletions .github/COMMIT_CONVENTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 📘 Commit and Branch Conventions

At `wapi.go`, we follow a strict set of conventions for commit messages and branch names to ensure that our repository stays organized, and our commit history remains crystal clear. Here's a guide on our conventions:

---

## 🚀 Conventional Commits

Conventional commits ensure our commit messages are clear and useful.

📋 **Benefits**:

- 📜 Automatic changelog generation
- 🔢 Simplified versioning
- 🧐 Improved readability of commit messages

### 📄 Commit Message Format

Each commit message should follow this format:

```
<type>(<scope>): <short summary>
<BLANK LINE>
<optional body>
<BLANK LINE>
<optional footer>
```

- **`<type>`**: Describes the purpose of the commit:
- 🆕 `feat`: Introduces a new feature
- 🐞 `fix`: Addresses a bug
- 📚 `docs`: Updates documentation
- 🎨 `style`: Code that relates to styling, not affecting logic
- 🔧 `refactor`: Refactoring existing code
- 🚀 `perf`: Improving performance
- 🧪 `test`: All about tests
- 🧽 `chore`: Maintenance tasks
- **`<scope>`**: (Optional) Specifies which part of the codebase is affected.

- **`<short summary>`**: A concise summary of the changes made.

### 📝 Examples:

1. Introducing a new feature:

```
feat(auth): implement social login
```

2. Addressing a bug:

```
fix(button): resolve alignment issue
```

---

## 🌲 Conventional Branching

A standardized naming system for branches helps everyone quickly understand a branch's purpose.

### 📄 Branch Naming Format

Branch names should adhere to:

```
<type>/<short-description>
```

- **`<type>`**: Purpose of the branch, common ones being:

- 🆕 `feature`: Developing a new feature.
- 🐞 `fix`: Addressing a bug.
- 🧽 `chore`: Regular maintenance tasks.
- 🔥 `hotfix`: Immediate fixes, often tied to production issues.
- 📚 `docs`: Documentation enhancements.

- **`<short-description>`**: A brief, kebab-cased (words separated by hyphens) description of the branch's objective.

### 📝 Examples:

1. Developing a new user dashboard:

```
feature/user-dashboard
```

2. Resolving a login issue:

```
fix/login-issue
```

---

🙌 Thanks for contributing to `wapi.go`! By adhering to these conventions, we're making our repository a better place. If you're new, welcome aboard, and if you've been here, thanks for sticking around!

---
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord server
url: https://discord.gg/PytnZqWpeQ
about: Please visit our Discord server for questions and support requests.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ""
labels: ""
assignees: ""
---
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Please describe the changes this PR makes and why it should be merged:**

**Status and versioning classification:**
18 changes: 18 additions & 0 deletions .github/workflows/auto-comment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Auto Comment on New Issue Label
# This workflow is triggered when a label is added to an issue.
on:
issues:
types: [labeled]

jobs:
processLabelAction:
name: Process Label Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Process Label Action
uses: hramos/respond-to-issue-based-on-label@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: ".github/label-actions.yml"
16 changes: 16 additions & 0 deletions .github/workflows/formatTag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Format Tag'
description: 'Formats a git tag to remove potentially prefixes'
inputs:
tag:
description: 'The input tag'
required: true
outputs:
subpackage:
description: 'Whether this tag is a subpackage tag'
package:
description: 'The package string that was extracted from this tag'
semver:
description: 'The semver string that was extracted from this tag'
runs:
using: node20
main: ./index.js
22 changes: 22 additions & 0 deletions .github/workflows/formatTag/formatTag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export function formatTag(tag) {
const parsed = /(?:^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(
tag
);
const parsedPackage = /(?<package>.*)@v?-?.*/.exec(tag);

if (parsed?.groups) {
const isSubPackage = typeof parsed.groups.package === "string";
const pkg = isSubPackage
? parsed.groups.package
: parsedPackage?.groups?.package ?? "wapi.go";
const semver = parsed.groups.semver;

return {
isSubpackage: isSubPackage,
package: pkg,
semver,
};
}

return null;
}
11 changes: 11 additions & 0 deletions .github/workflows/formatTag/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getInput, setOutput } from "@actions/core";
import { formatTag } from "./formatTag.js";

const tag = getInput("tag", { required: true });
const parsed = formatTag(tag);

if (parsed) {
setOutput("subpackage", parsed.isSubpackage);
setOutput("package", parsed.package);
setOutput("semver", parsed.semver);
}
30 changes: 30 additions & 0 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check PR title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
- review_requested
- auto_merge_enabled

concurrency:
group: check-pr-title-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
validate-pr-title:
name: Validate PR title
runs-on: ubuntu-latest
permissions:
statuses: write
timeout-minutes: 10
steps:
- uses: aslafy-z/conventional-pr-title-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
success-state: "PR Title follows the Conventional Commits spec"
failure-state: "PR Title does not follow the Conventional Commits spec"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
node_modules
.vscode/
config.toml
node_modules
dist/*
22 changes: 22 additions & 0 deletions .husky/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# # Check for conventional commit format
# commit_msg=$(cat "$1")
# # Modified regex to allow for more valid formats
# conventional_commit_regex='^(feat|fix|chore|docs|test|style|refactor|perf|build|ci|revert)(\(.+\))?(!)?(:)(\s.*)?$'

# echo "$conventional_commit_regex"

# if ! [[ "$commit_msg" =~ $conventional_commit_regex ]]; then
# echo "ERROR: Commit message does not adhere to Conventional Commits format:"
# echo "$commit_msg"
# echo "$($commit_msg =~ $conventional_commit_regex )"
# exit 1
# fi

# If not a merge commit, require commit to be signed off
if [ ! -e .git/MERGE_MSG ] && ! grep -q "^Signed-off-by: " "$1"; then
echo >&2 "Commit message must be signed off with your user name and email."
echo >&2 "To sign off your commit, add the -s flag to the git commit command."
exit 1
fi
10 changes: 10 additions & 0 deletions .husky/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

branch=$(git symbolic-ref HEAD)

if [ "$branch" = "refs/heads/master" ]; then
echo "\\033[31mDirect commit to master is not allowed.\\033[0m"
exit 1
fi

go fmt ./...
8 changes: 8 additions & 0 deletions .husky/hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env sh

branch=$(git symbolic-ref HEAD)

if [ "$branch" = "refs/heads/master" ]; then
echo "\\033[31mDirect push to master is not allowed.\\033[0m"
exit 1
fi
Loading