Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
dc97564
Add a command to change timezone
MathieuSchl Oct 1, 2023
a80102b
Change RSA communication
MathieuSchl Oct 3, 2023
3ce8b69
Add AES encryption
MathieuSchl Oct 5, 2023
9149ad4
Remove word 'failed' in test name
MathieuSchl Oct 5, 2023
d3f93e7
Remove date in AES object
MathieuSchl Oct 6, 2023
a765d7b
Add publish test
MathieuSchl Oct 7, 2023
871cea9
Add publish test
MathieuSchl Oct 7, 2023
f8e60a9
Add publish test
MathieuSchl Oct 7, 2023
8f7fb0c
Add publish test
MathieuSchl Oct 7, 2023
98244f5
Add publish test
MathieuSchl Oct 7, 2023
7878a10
Add publish test
MathieuSchl Oct 7, 2023
a7f0aeb
Add publish test
MathieuSchl Oct 7, 2023
1006531
Add publish test
MathieuSchl Oct 7, 2023
997414a
Add publish test
MathieuSchl Oct 7, 2023
1ebc65d
Add publish test
MathieuSchl Oct 7, 2023
42b283b
Add publish test
MathieuSchl Oct 7, 2023
aa7ab37
Add report for test
MathieuSchl Oct 7, 2023
17478d3
Add report for test
MathieuSchl Oct 7, 2023
efea340
Add report for test
MathieuSchl Oct 7, 2023
2f79697
Add report for test
MathieuSchl Oct 7, 2023
d2a5eea
Add report for test
MathieuSchl Oct 7, 2023
a0d2c74
Add report for test
MathieuSchl Oct 7, 2023
403721b
Add report for test
MathieuSchl Oct 7, 2023
9bc822a
Add report for test
MathieuSchl Oct 7, 2023
f269d58
Add report for test
MathieuSchl Oct 7, 2023
c6c648e
Add report for test
MathieuSchl Oct 7, 2023
124943e
Add report for test
MathieuSchl Oct 7, 2023
a07d829
Add report for test
MathieuSchl Oct 7, 2023
8b56560
Add report for test
MathieuSchl Oct 7, 2023
2cf0e4b
Add report for test
MathieuSchl Oct 7, 2023
dd788b8
Add report for test
MathieuSchl Oct 7, 2023
a59b45b
Add report for test
MathieuSchl Oct 7, 2023
e866e27
Add condition for run job
MathieuSchl Oct 8, 2023
f93db8a
Update client_discord-dockerPush.yml
MathieuSchl Oct 8, 2023
8b36be9
Encryption is now easier to use
MathieuSchl Oct 10, 2023
6561068
Merge branch 'developClientDiscord' of github.com:MathieuSchl/KarAssi…
MathieuSchl Oct 10, 2023
8198a13
Add special characters
MathieuSchl Oct 15, 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
26 changes: 26 additions & 0 deletions .gitguardian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Example here : https://github.com/GitGuardian/ggshield/blob/main/.gitguardian.example.yml
# Required, otherwise ggshield considers the file to use the deprecated v1 format
version: 2
#
# Set to true if the desired exit code for the CLI is always 0, otherwise the
# exit code will be 1 if incidents are found.
# The environment variable GITGUARDIAN_EXIT_ZERO=true can also be used toggle this behavior.
exit-zero: false # default: false
#
verbose: false # default: false
#
# The dashboard URL of the instance
instance: https://dashboard.gitguardian.com # default: https://dashboard.gitguardian.com
#
# Maximum commits to scan in a hook.
max-commits-for-hook: 50 # default: 50
#
# Accept self-signed certificates for the API.
allow-self-signed: false # default: false
#
secret:
# Exclude files and paths by globbing
ignored-paths:
- "**/README.md"
- "back_node/tests/**"
- "clientDiscord/tests/**"
43 changes: 28 additions & 15 deletions .github/workflows/client_discord-dockerPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ run-name: "[CLIENT_DISCORD] DockerPush : ${{ github.actor }} push '${{ github.ev
on:
push:
paths:
- clientDiscord/**
- clientDiscord/**
pull_request:
paths:
- clientDiscord/**
permissions:
checks: write
pull-requests: write
jobs:
Check:
runs-on: ubuntu-latest
outputs:
RUN_BUILD: ${{ steps.define_docker_data.outputs.run_build }}
VERSION: ${{ steps.define_docker_data.outputs.version }}
if: github.event_name == 'push'
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand Down Expand Up @@ -51,6 +58,12 @@ jobs:
working-directory: ./clientDiscord
run: |
export NODE_OPTIONS=--no-experimental-fetch && npm test 2>> /tmp/results.txt >> /tmp/coverage0.txt
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
clientDiscord/reports/report.xml
- name: Prepare data
id: data
run: |
Expand All @@ -68,28 +81,28 @@ jobs:
- name: Echo errors
if: steps.tests.outcome == 'failure'
run: |
sed '$ d' /tmp/coverage1.txt > $GITHUB_STEP_SUMMARY
echo -e "\n" >> $GITHUB_STEP_SUMMARY
cat /tmp/results.txt >> $GITHUB_STEP_SUMMARY
echo -e "\n" >> $GITHUB_STEP_SUMMARY
echo "❌ Errors with the test" >> $GITHUB_STEP_SUMMARY
# sed '$ d' /tmp/coverage1.txt > $GITHUB_STEP_SUMMARY
# echo -e "\n" >> $GITHUB_STEP_SUMMARY
# cat /tmp/results.txt >> $GITHUB_STEP_SUMMARY
# echo -e "\n" >> $GITHUB_STEP_SUMMARY
# echo "❌ Errors with the test" >> $GITHUB_STEP_SUMMARY
exit 1
- name: Echo success
if: steps.tests.outcome == 'success'
run: |
echo -e "\n" >> $GITHUB_STEP_SUMMARY
sed '$ d' /tmp/coverage1.txt > $GITHUB_STEP_SUMMARY
cat /tmp/results.txt >> $GITHUB_STEP_SUMMARY
echo -e "\n" >> $GITHUB_STEP_SUMMARY
echo "✅ All test are checked" >> $GITHUB_STEP_SUMMARY
# - name: Echo success
# if: steps.tests.outcome == 'success'
# run: |
# echo -e "\n" >> $GITHUB_STEP_SUMMARY
# sed '$ d' /tmp/coverage1.txt > $GITHUB_STEP_SUMMARY
# cat /tmp/results.txt >> $GITHUB_STEP_SUMMARY
# echo -e "\n" >> $GITHUB_STEP_SUMMARY
# echo "✅ All test are checked" >> $GITHUB_STEP_SUMMARY

Build_Push:
runs-on: ubuntu-latest
permissions: write-all
needs:
- Check
- Tests
if: ${{ needs.Check.outputs.RUN_BUILD == 'yes' && needs.Tests.result == 'success' }}
if: ${{ github.event_name == 'push' && needs.Check.outputs.RUN_BUILD == 'yes' && needs.Tests.result == 'success' }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion clientDiscord/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ node_modules/
data/
logs/
coverage/
.env
reports/
.env
.vscode/
2 changes: 1 addition & 1 deletion clientDiscord/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
services:
karassistant-client-discord:
#build: .
image: codyisthesenate/karassistant-client-discord:1.1.1
image: codyisthesenate/karassistant-client-discord:1.3.1
restart: always
container_name: karassistant-client-discord
volumes:
Expand Down
14 changes: 14 additions & 0 deletions clientDiscord/events/interactionCreate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { Events } = require("discord.js");
const listCommands = require("../utils/loadCommands").listCommands;

module.exports.run = async (client) => {
client.on(Events.InteractionCreate, (interaction) => {
if (interaction.isChatInputCommand()) {
try {
listCommands[interaction.commandName](interaction);
} catch (error) {
interaction.reply("There is an error with the command");
}
}
});
};
4 changes: 3 additions & 1 deletion clientDiscord/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ async function start() {
});
});

client.login(TOKEN).then(() => {});
client.login(TOKEN).then(() => {
require("./utils/loadCommands").run(client);
});
}

start();
62 changes: 62 additions & 0 deletions clientDiscord/interactions/commands/setTimeZone.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const { ApplicationCommandOptionType } = require("discord.js");
const updateUser = require("../../utils/updateUser").updateUser;

const listOfTimezones = [
"Pacific/Kiritimati",
"Pacific/Tongatapu",
"Pacific/Apia",
"Asia/Anadyr",
"Asia/Kamchatka",
"Asia/Tokyo",
"Asia/Hong_Kong",
"Asia/Kolkata",
"Asia/Dubai",
"Europe/Moscow",
"Europe/Paris",
"Europe/London",
"Africa/Cairo",
"Africa/Nairobi",
"Asia/Kuwait",
"Europe/Athens",
"Asia/Baghdad",
"Europe/Istanbul",
"Asia/Tehran",
"Asia/Kabul",
"Asia/Baku",
"Asia/Ashgabat",
"Asia/Muscat",
"Asia/Tashkent",
"Asia/Almaty",
];

const choices = [];
for (const timezone of listOfTimezones) {
choices.push({ name: timezone, value: timezone });
}

module.exports = {
data: {
name: "settimezone",
description: "Set the time zone, to get the time right",
options: [
{
type: ApplicationCommandOptionType.String,
name: "timezone",
description: "Value for the new time zone",
required: true,
choices,
},
],
},
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const timeZone = interaction.options.get("timezone").value;
const userName = interaction.user.userName;
const userId = interaction.user.id;

const result = await updateUser({ userName: userName, userId: userId, data: { timeZone } });
return interaction.followUp(
result ? "Time zone has been updated" : "ERROR: Could not update time zone. Try again later."
);
},
};
2 changes: 1 addition & 1 deletion clientDiscord/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports = {
// projects: undefined,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
reporters: ["default", ["jest-junit", { outputDirectory: "reports", outputName: "report.xml" }]],

// Automatically reset mock state before every test
// resetMocks: false,
Expand Down
54 changes: 50 additions & 4 deletions clientDiscord/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion clientDiscord/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clientdiscord",
"version": "1.1.1",
"version": "1.3.1",
"description": "A discord bot for KarAssistant",
"main": "index.js",
"scripts": {
Expand All @@ -24,6 +24,8 @@
"axios": "^1.5.0",
"discord.js": "^14.13.0",
"dotenv": "^16.3.1",
"jest-junit": "^16.0.0",
"node-forge": "^1.3.1",
"node-rsa": "^1.1.1",
"qs": "^6.11.2"
},
Expand Down
Loading