Stripped repo down to bare minimum

This commit is contained in:
Noah Heague
2021-09-05 13:34:56 +10:00
parent 3699856b6b
commit cc9557cf75
8 changed files with 4700 additions and 4700 deletions
+10 -10
View File
@@ -1,10 +1,10 @@
root = true
[*]
insert_final_newline = true
[*.{ts,test.ts}]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
root = true
[*]
insert_final_newline = true
[*.{ts,test.ts}]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
+43 -43
View File
@@ -1,43 +1,43 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"object-curly-spacing": [
"error",
"always"
],
"@typescript-eslint/no-unused-vars": [
"error"
]
}
}
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
],
"object-curly-spacing": [
"error",
"always"
],
"@typescript-eslint/no-unused-vars": [
"error"
]
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
node_modules
.idea
.vscode
yarn-error.log
node_modules
.idea
.vscode
yarn-error.log
+7 -7
View File
@@ -1,7 +1,7 @@
# Tachi-Bot
Integrate with Tachi Services
## Support & Maintenance
If you have any problems with the bot or have suggestions please create a Github issue.
# Tachi-Bot
Integrate with Tachi Services
## Support & Maintenance
If you have any problems with the bot or have suggestions please create a Github issue.
+29 -29
View File
@@ -1,29 +1,29 @@
{
"name": "tachi-bot",
"version": "1.0.0",
"main": "src/index.ts",
"license": "AGPL3",
"scripts": {
"start": "ts-node src/index.ts"
},
"devDependencies": {
"@babel/preset-env": "^7.15.0",
"@babel/preset-typescript": "^7.15.0",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"discord-api-types": "^0.22.0",
"eslint": "^7.32.0",
"jest": "^27.0.6",
"typescript": "^4.3.5"
},
"dependencies": {
"@discordjs/builders": "^0.5.0",
"@discordjs/rest": "^0.1.0-canary.0",
"deezer-api-ts": "^1.2.1",
"discord.js": "^13.1.0",
"songlink-api": "^1.0.0",
"ts-node": "^10.2.0",
"winston": "^3.3.3"
}
}
{
"name": "tachi-bot",
"version": "1.0.0",
"main": "src/index.ts",
"license": "AGPL3",
"scripts": {
"start": "ts-node src/index.ts"
},
"devDependencies": {
"@babel/preset-env": "^7.15.0",
"@babel/preset-typescript": "^7.15.0",
"@types/jest": "^27.0.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"discord-api-types": "^0.22.0",
"eslint": "^7.32.0",
"jest": "^27.0.6",
"typescript": "^4.3.5"
},
"dependencies": {
"@discordjs/builders": "^0.5.0",
"@discordjs/rest": "^0.1.0-canary.0",
"deezer-api-ts": "^1.2.1",
"discord.js": "^13.1.0",
"songlink-api": "^1.0.0",
"ts-node": "^10.2.0",
"winston": "^3.3.3"
}
}
+56 -56
View File
@@ -1,56 +1,56 @@
import { Message } from "discord.js";
import { shouldReply } from "./utils";
// Mock Data
interface MockMessage {
author: {
id: string;
bot: boolean;
};
channelId: string;
content?: string;
}
const selfMessage: MockMessage = {
author: {
id: "876320894295887944",
bot: true,
},
channelId: "876321394005254214"
};
const botMessage: MockMessage = {
author: {
id: "uniqueSnowflake",
bot: true,
},
channelId: "876321394005254214"
};
const invalidChannel: MockMessage = {
author: {
id: "uniqueSnowflake",
bot: false
},
channelId: "uniqueSnowflake"
};
const validMessage: MockMessage = {
author: {
id: "uniqueSnowflake",
bot: false
},
channelId: "876321394005254214"
};
// Tests
describe("shouldReply", () => {
test("should not reply to self", () => {
expect(shouldReply(selfMessage as Message)).toEqual(false);
});
test("should not reply to a bot", () => {
expect(shouldReply(botMessage as Message)).toEqual(false);
});
test("should not reply in an invalid channel", () => {
expect(shouldReply(invalidChannel as Message)).toEqual(false);
});
test("should reply to a valid message", () => {
expect(shouldReply(validMessage as Message)).toEqual(true);
});
});
import { Message } from "discord.js";
import { shouldReply } from "./utils";
// Mock Data
interface MockMessage {
author: {
id: string;
bot: boolean;
};
channelId: string;
content?: string;
}
const selfMessage: MockMessage = {
author: {
id: "876320894295887944",
bot: true,
},
channelId: "876321394005254214"
};
const botMessage: MockMessage = {
author: {
id: "uniqueSnowflake",
bot: true,
},
channelId: "876321394005254214"
};
const invalidChannel: MockMessage = {
author: {
id: "uniqueSnowflake",
bot: false
},
channelId: "uniqueSnowflake"
};
const validMessage: MockMessage = {
author: {
id: "uniqueSnowflake",
bot: false
},
channelId: "876321394005254214"
};
// Tests
describe("shouldReply", () => {
test("should not reply to self", () => {
expect(shouldReply(selfMessage as Message)).toEqual(false);
});
test("should not reply to a bot", () => {
expect(shouldReply(botMessage as Message)).toEqual(false);
});
test("should not reply in an invalid channel", () => {
expect(shouldReply(invalidChannel as Message)).toEqual(false);
});
test("should reply to a valid message", () => {
expect(shouldReply(validMessage as Message)).toEqual(true);
});
});
+9 -9
View File
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"types": ["node", "jest"],
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"types": ["node", "jest"],
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}
+4542 -4542
View File
File diff suppressed because it is too large Load Diff