Skip to content

Commit

Permalink
Merge pull request #69 from berkingurcan/fix-anon
Browse files Browse the repository at this point in the history
Fix anon
  • Loading branch information
berkingurcan authored Jun 21, 2024
2 parents f1d48e7 + 33c196b commit 6d6d3fd
Show file tree
Hide file tree
Showing 7 changed files with 556 additions and 302 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
name: Build and Publish Docker Image
runs-on: minafoundation-default-runners
steps:

- name: 📥 Checkout
uses: actions/checkout@v4

Expand Down
140 changes: 80 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,95 +42,115 @@ Here is the section for the scripts in the README file:

The project includes several scripts to facilitate development and operations. Here is a brief explanation of each:

#### **test**
Runs the tests.
#### **test**

```shell
npm run test
```
Runs the tests.

#### **bot**
Starts the main bot script.
```shell
npm run test
```

#### **bot**

```shell
npm run bot
```
Starts the main bot script.

#### **dev**
Starts the main bot script in development mode using Nodemon to automatically restart the bot when changes are detected.
```shell
npm run bot
```

```shell
npm run dev
```
#### **dev**

Starts the main bot script in development mode using Nodemon to automatically restart the bot when changes are detected.

```shell
npm run dev
```

#### **summarizer**
Starts the GPT summarization script.
#### **summarizer**

```shell
npm run summarizer
```
Starts the GPT summarization script.

```shell
npm run summarizer
```

#### **prettier**

Formats the codebase using Prettier.

```shell
npm run prettier
```

#### **prettier**
Formats the codebase using Prettier.
#### **reset**

```shell
npm run prettier
```
Resets the Redis database.

#### **reset**
Resets the Redis database.
```shell
npm run reset
```
```shell
npm run reset
```

## Commands

### /gptsurvey create
Use it to create single question surveys.

- **SURVEY TITLE:** _Max 45 Char_, _cannot include "-"_
- **SURVEY DESCRIPTION**:
- **QUESTION:** _Max 45 Char_
- **SURVEY EXPIRE TIME:** Must be `YYYY-MM-DD-HH-MM` format or can be `inf`
- **SURVEY POSTING TO FORUM CONDITION:** `true`or `false`
Use it to create single question surveys.

- **SURVEY TITLE:** _Max 45 Char_, _cannot include "-"_
- **SURVEY DESCRIPTION**:
- **QUESTION:** _Max 45 Char_
- **SURVEY EXPIRE TIME:** Must be `YYYY-MM-DD-HH-MM` format or can be `inf`
- **SURVEY POSTING TO FORUM CONDITION:** `true`or `false`

### /gptsurvey create-multi-response
Use it to create multiple question surveys.
- **SURVEY TITLE:** _Max 45 Char_, _cannot include "-"_
- **SURVEY DESCRIPTION**:
- **QUESTIONS:** Each line separated "\n" or `enter` is one question. Each question must be maximum 45 Char for each line. Maximum question number is `maxResponsesForMultiResponsePerUser` in constants.ts. _**However it is strongly recommended to set is maximum 5 to prevent Modal UI based problems.**_
- **SURVEY EXPIRE TIME:** Must be `YYYY-MM-DD-HH-MM` format or can be `inf`
- **SURVEY POSTING TO FORUM CONDITION:** `true`or `false`
### /gptsurvey respond
You can use this if you want to post an active survey in another channel (bot must have access to post anything on that channel).

Use it to create multiple question surveys.

- **SURVEY TITLE:** _Max 45 Char_, _cannot include "-"_
- **SURVEY DESCRIPTION**:
- **QUESTIONS:** Each line separated "\n" or `enter` is one question. Each question must be maximum 45 Char for each line. Maximum question number is `maxResponsesForMultiResponsePerUser` in constants.ts. _**However it is strongly recommended to set is maximum 5 to prevent Modal UI based problems.**_
- **SURVEY EXPIRE TIME:** Must be `YYYY-MM-DD-HH-MM` format or can be `inf`
- **SURVEY POSTING TO FORUM CONDITION:** `true`or `false`

### /gptsurvey respond

You can use this if you want to post an active survey in another channel (bot must have access to post anything on that channel).

### /gptsurvey view
To view the responses with raw data txt file.

To view the responses with raw data txt file.

### /gptsurvey summary
You can use this command to show people summaries of surveys. You can select summary type optionally: If "Yes", it will show high level summary of the survey. If "No", it will show general summary.

You can use this command to show people summaries of surveys. You can select summary type optionally: If "Yes", it will show high level summary of the survey. If "No", it will show general summary.

### /gptsurvey edit
Edit survey name or questions, delete questions or add questions. Once submitted, if the survey was answered, the responses will be deleted. You can also set/edit a survey start and end date, or leave it infinite. Also, you can post the survey to forum channel making ``true` the last section.

Same restrictions in `/create` command.
Edit survey name or questions, delete questions or add questions. Once submitted, if the survey was answered, the responses will be deleted. You can also set/edit a survey start and end date, or leave it infinite. Also, you can post the survey to forum channel making ``true` the last section.

And if your survey in the forum channel. Do not change the title more than 2 times in 10 Minutes because of rate limit.
Same restrictions in `/create` command.

### /gptsurvey set-status
To activate or deactivate a survey.
And if your survey in the forum channel. Do not change the title more than 2 times in 10 Minutes because of rate limit.

### /gptsurvey delete
To delete the survey.
### /gptsurvey set-status

To activate or deactivate a survey.

### /gptsurvey delete

To delete the survey.

### /gptsurvey info
To check the version.

To check the version.

### /gptsurvey start-auto-post
To start auto-posting the responses view. It is working which channel that you used. For example, if you use it in forum channel, it will be activated in that channel.

### /gptsurvey stop-auto-post
To stop auto-posting the responses view. For example, if you use it in forum channel, it will be activated in that channel.
To start auto-posting the responses view. It is working which channel that you used. For example, if you use it in forum channel, it will be activated in that channel.

### /gptsurvey stop-auto-post

To stop auto-posting the responses view. For example, if you use it in forum channel, it will be activated in that channel.

## Docker Image

Expand Down Expand Up @@ -196,7 +216,6 @@ TODO
1. Go to [Redis](https://redis.io/) and create an account.
2. Create a DB and click `connect`. Copy and paste your password, socket, and port into the `.env.local` file.


### Finding the Client ID

1. Navigate to the [Discord Developer Portal](https://discord.com/developers/applications/).
Expand Down Expand Up @@ -252,8 +271,9 @@ To get the Guild ID, you must ensure that "Developer Mode" is enabled in your Di
---

## Project Structure
- ```commands``` folder for command related codes. can be used by importing ```@command/index```
- ```lib``` folder for other functional codes.

- `commands` folder for command related codes. can be used by importing `@command/index`
- `lib` folder for other functional codes.

```
└── 📁gptSurveySummarizer
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "discord-bot",
"type": "module",
"version": "0.3.1",
"version": "0.3.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 1 addition & 3 deletions src/commands/handleDeleteButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export const handleDeleteButton = async (interaction: any, surveyName: any) => {
.setCustomId(`confirmDelete-${surveyName}`)
.setLabel("Please rewrite the surveyName to delete.")
.setStyle(TextInputStyle.Paragraph)
.setValue(
`Survey ${surveyName} will be deleted.`,
);
.setValue(`Survey ${surveyName} will be deleted.`);
modal.addComponents(new ActionRowBuilder().addComponents(yesInput));

await interaction.showModal(modal);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/makeSurveyPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const makeSurveyPost = async (
if (!(await redisClient.sIsMember("surveys", surveyName))) {
return [{ content: "There is no survey with that name", ephemeral: true }];
} else {
const [msg, files] = await surveyToText(redisClient, surveyName);
const [msg, files] = await surveyToText(redisClient, surveyName, isSummaryCommand);

const lines = msg.split("\n");
const chunks = [];
Expand Down
Loading

0 comments on commit 6d6d3fd

Please sign in to comment.