diff --git a/kdb-bot/src/bot/bot.json b/kdb-bot/src/bot/bot.json index d7d6a2d7..66f56772 100644 --- a/kdb-bot/src/bot/bot.json +++ b/kdb-bot/src/bot/bot.json @@ -32,7 +32,8 @@ "cpl-discord==2022.12.2" ], "DevDependencies": [ - "cpl-cli==2022.12.1.post3" + "cpl-cli==2022.12.1.post3", + "pygount==1.5.1" ], "PythonVersion": ">=3.10.4", "PythonPath": {}, diff --git a/kdb-bot/src/bot/config b/kdb-bot/src/bot/config index e3019156..79861447 160000 --- a/kdb-bot/src/bot/config +++ b/kdb-bot/src/bot/config @@ -1 +1 @@ -Subproject commit e3019156c058a93c092932dad75db39576bc55a7 +Subproject commit 7986144705052ff38472a5d3f0776cb6c1752a55 diff --git a/kdb-bot/src/bot_api/config b/kdb-bot/src/bot_api/config index 81021418..c712f856 160000 --- a/kdb-bot/src/bot_api/config +++ b/kdb-bot/src/bot_api/config @@ -1 +1 @@ -Subproject commit 81021418c21d45cee54478ab5fd69f9ce7261644 +Subproject commit c712f856ebe30c71ac0b144045599ed2f91a1cba diff --git a/kdb-bot/src/bot_graphql/query.py b/kdb-bot/src/bot_graphql/query.py index f8e7853a..8133e4dc 100644 --- a/kdb-bot/src/bot_graphql/query.py +++ b/kdb-bot/src/bot_graphql/query.py @@ -63,7 +63,7 @@ class Query(QueryABC): self.set_field("guilds", self._resolve_guilds) def _resolve_guilds(self, *_, filter=None): - if filter is None and "id" not in filter: + if filter is None or "id" not in filter: return self._bot.guilds return self._bot.guilds.where(lambda g: g.id == int(filter["id"])) diff --git a/kdb-web/src/app/models/graphql/mutations.model.ts b/kdb-web/src/app/models/graphql/mutations.model.ts index f7be1c11..db06c8f8 100644 --- a/kdb-web/src/app/models/graphql/mutations.model.ts +++ b/kdb-web/src/app/models/graphql/mutations.model.ts @@ -14,4 +14,30 @@ export class Mutations { } } `; + + static createAutoRole = ` + mutation updateAutoRole($serverId: ID, $channelId: String, $messageId: String) { + autoRole { + createAutoRole(input: { serverId: $serverId, channelId: $channelId, messageId: $messageId }) { + id + channelId + channelName + messageId + } + } + } + `; + + static deleteAutoRole = ` + mutation updateAutoRole($id: ID) { + autoRole { + deleteAutoRole(id: $id) { + id + channelId + channelName + messageId + } + } + } + `; } diff --git a/kdb-web/src/app/models/graphql/queries.model.ts b/kdb-web/src/app/models/graphql/queries.model.ts index bd93162b..c71733eb 100644 --- a/kdb-web/src/app/models/graphql/queries.model.ts +++ b/kdb-web/src/app/models/graphql/queries.model.ts @@ -166,6 +166,10 @@ export class Queries { messageId autoRoleRuleCount + server { + id + } + createdAt modifiedAt } diff --git a/kdb-web/src/app/models/graphql/query.model.ts b/kdb-web/src/app/models/graphql/query.model.ts index 904cbf41..a6c1090f 100644 --- a/kdb-web/src/app/models/graphql/query.model.ts +++ b/kdb-web/src/app/models/graphql/query.model.ts @@ -2,6 +2,7 @@ import { Server } from "../data/server.model"; import { User } from "../data/user.model"; import { AutoRole } from "../data/auto_role.model"; import { Guild } from "../data/discord.model"; +import { Level } from "../data/level.model"; export interface Query { serverCount: number; @@ -19,7 +20,7 @@ export interface UserListQuery { export interface LevelListQuery { levelCount: number; - levels: User[]; + levels: Level[]; } export interface AutoRoleQuery { diff --git a/kdb-web/src/app/models/graphql/result.model.ts b/kdb-web/src/app/models/graphql/result.model.ts index bc28521d..8198fda2 100644 --- a/kdb-web/src/app/models/graphql/result.model.ts +++ b/kdb-web/src/app/models/graphql/result.model.ts @@ -1,4 +1,10 @@ import { User } from "../data/user.model"; +import { AutoRole } from "../data/auto_role.model"; + +export interface GraphQLResult { + data: any; + errors?: []; +} export interface QueryResult { data: any; @@ -9,3 +15,10 @@ export interface UpdateUserMutationResult { updateUser: User }; } +export interface AutoRoleMutationResult { + autoRole: { + createAutoRole?: AutoRole + updateAutoRole?: AutoRole + deleteAutoRole?: AutoRole + }; +} diff --git a/kdb-web/src/app/modules/shared/shared.module.ts b/kdb-web/src/app/modules/shared/shared.module.ts index bf719ea6..1402c6ef 100644 --- a/kdb-web/src/app/modules/shared/shared.module.ts +++ b/kdb-web/src/app/modules/shared/shared.module.ts @@ -20,6 +20,7 @@ import { IpAddressPipe } from './pipes/ip-address.pipe'; import { BoolPipe } from './pipes/bool.pipe'; import { PanelMenuModule } from 'primeng/panelmenu'; import { PanelModule } from "primeng/panel"; +import { InputNumberModule } from 'primeng/inputnumber'; @@ -49,6 +50,7 @@ import { PanelModule } from "primeng/panel"; DynamicDialogModule, PanelMenuModule, PanelModule, + InputNumberModule, ], exports: [ ButtonModule, @@ -72,6 +74,7 @@ import { PanelModule } from "primeng/panel"; AuthRolePipe, IpAddressPipe, BoolPipe, + InputNumberModule, ] }) export class SharedModule { } diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts index 2440f09d..538afde3 100644 --- a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts +++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles-rules/auto-roles-rules.component.ts @@ -1,10 +1,22 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from "@angular/core"; +import { DataService } from "../../../../../../services/data/data.service"; +import { ActivatedRoute } from "@angular/router"; @Component({ - selector: 'app-auto-roles-rules', - templateUrl: './auto-roles-rules.component.html', - styleUrls: ['./auto-roles-rules.component.scss'] + selector: "app-auto-roles-rules", + templateUrl: "./auto-roles-rules.component.html", + styleUrls: ["./auto-roles-rules.component.scss"] }) -export class AutoRolesRulesComponent { +export class AutoRolesRulesComponent implements OnInit { + + constructor( + private data: DataService, + private route: ActivatedRoute, + ) { + } + + ngOnInit(): void { + this.data.getServerFromRoute(this.route); + } } diff --git a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html index dc5bd7a8..16cb0710 100644 --- a/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html +++ b/kdb-web/src/app/modules/view/server/auto-role/components/auto-roles/auto-roles.component.html @@ -18,7 +18,7 @@