-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ""working"" it runs. that's all. nothing fancy. ill work on thi…
…s later when i can... hopefully.
- Loading branch information
Showing
17 changed files
with
207 additions
and
75 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import ks from "eslint-config-ks"; | ||
|
||
export default ks( | ||
{ | ||
prettier: true, | ||
json: true, | ||
typescript: true, | ||
project: ["tsconfig.json"], | ||
}, | ||
[ | ||
{ | ||
ignores: ["src/utils/dbSchemaParser.ts"], | ||
files: ["src/**/*.ts"], | ||
rules: { | ||
"prettier/prettier": "warn", | ||
"security/detect-object-injection": "off", | ||
"import/no-named-as-default-member": "off", | ||
"max-depth": ["error", 6], | ||
"unicorn/prefer-ternary": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
args: "all", | ||
argsIgnorePattern: "^_", | ||
caughtErrors: "all", | ||
caughtErrorsIgnorePattern: "^_", | ||
destructuredArrayIgnorePattern: "^_", | ||
varsIgnorePattern: "^_", | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
"@typescript-eslint/no-unnecessary-condition": "warn", | ||
"unicorn/no-await-expression-member": "warn", | ||
"unicorn/no-null": "off", | ||
"@typescript-eslint/naming-convention": [ | ||
"warn", | ||
{ | ||
format: ["PascalCase"], | ||
trailingUnderscore: "allow", | ||
selector: "typeLike", | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Octokit } from "@octokit/rest"; | ||
import { ChannelType, ForumChannel, Guild } from "discord.js"; | ||
import { hibikiUserAgent } from "utils/constants.js"; | ||
|
||
import { HibikiClient } from "./Client.js"; | ||
|
||
export class GithubManager { | ||
private bot: HibikiClient; | ||
|
||
private octokit: Octokit; | ||
|
||
repoOwner: string; | ||
repo: string; | ||
|
||
forumChannel?: ForumChannel; | ||
guild?: Guild; | ||
|
||
/** | ||
* | ||
* @param bot Hibiki client | ||
* @param repo Repository path, example: Blahblah/my-repo | ||
*/ | ||
constructor(bot: HibikiClient, repo: string) { | ||
this.bot = bot; | ||
|
||
this.repoOwner = repo.split("/")[0]; | ||
this.repo = repo.split("/")[1]; | ||
|
||
this.octokit = new Octokit({ | ||
userAgent: hibikiUserAgent, | ||
}); | ||
} | ||
|
||
public init(config: { guildId: string; forumId: string }) { | ||
// Resolve the guild! | ||
const guild = this.bot.guilds.resolve(config.guildId); | ||
if (!guild) throw new Error("Failed to resolve guild " + config.guildId + "!"); | ||
|
||
const forum = guild.channels.resolve(config.forumId); | ||
|
||
if (!forum) throw new Error("Failed to resolve forum channel " + config.forumId + "!"); | ||
if (forum.type !== ChannelType.GuildForum) throw new Error("The channel " + forum.name + "is NOT a forum channel!"); | ||
|
||
this.guild = guild; | ||
this.forumChannel = forum; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.