Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fernuni-bot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dnns01
fernuni-bot
Commits
39fc3879
Unverified
Commit
39fc3879
authored
7 months ago
by
dnns01
Committed by
GitHub
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Update links.py
parent
82e1186a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extensions/links.py
+15
-15
15 additions, 15 deletions
extensions/links.py
with
15 additions
and
15 deletions
extensions/links.py
+
15
−
15
View file @
39fc3879
...
...
@@ -72,42 +72,42 @@ class Links(commands.GroupCog, name="links", description="Linkverwaltung für Ka
models
.
LinkCategory
.
name
==
category
):
await
interaction
.
response
.
send_modal
(
LinkCategoryModal
(
db_category
=
db_category
))
else
:
await
interaction
.
response
.
send_message
(
content
=
'
Ich konnte d
as Thema
leider nicht finden.
'
,
ephemeral
=
True
)
await
interaction
.
response
.
send_message
(
content
=
'
Ich konnte d
ie Kategorie
leider nicht finden.
'
,
ephemeral
=
True
)
@app_commands.command
(
name
=
"
remove-link
"
,
description
=
"
Einen Link entfernen.
"
)
@app_commands.describe
(
topic
=
"
Them
e zu de
m
der zu entfernende Link gehört.
"
,
@app_commands.describe
(
category
=
"
Kategori
e zu de
r
der zu entfernende Link gehört.
"
,
title
=
"
Titel des zu entfernenden Links.
"
)
async
def
cmd_remove_link
(
self
,
interaction
:
Interaction
,
topic
:
str
,
title
:
str
):
async
def
cmd_remove_link
(
self
,
interaction
:
Interaction
,
category
:
str
,
title
:
str
):
await
interaction
.
response
.
defer
(
ephemeral
=
True
)
if
not
models
.
LinkCategory
.
has_links
(
interaction
.
channel_id
):
await
interaction
.
edit_original_response
(
content
=
"
Für diesen Channel sind noch keine Links hinterlegt.
"
)
return
if
topic
_entity
:
=
models
.
LinkCategory
.
get_or_none
(
models
.
LinkCategory
.
channel
==
interaction
.
channel_id
,
models
.
LinkCategory
.
name
==
topic
):
if
link
:
=
models
.
Link
.
get_or_none
(
models
.
Link
.
title
==
title
,
models
.
Link
.
topic
==
topic
_entity
.
id
):
if
category
_entity
:
=
models
.
LinkCategory
.
get_or_none
(
models
.
LinkCategory
.
channel
==
interaction
.
channel_id
,
models
.
LinkCategory
.
name
==
category
):
if
link
:
=
models
.
Link
.
get_or_none
(
models
.
Link
.
title
==
title
,
models
.
Link
.
category
==
category
_entity
.
id
):
link
.
delete_instance
(
recursive
=
True
)
await
interaction
.
edit_original_response
(
content
=
f
'
Link
{
title
}
entfernt
'
)
else
:
await
interaction
.
edit_original_response
(
content
=
'
Ich konnte den Link leider nicht finden.
'
)
else
:
await
interaction
.
edit_original_response
(
content
=
'
Ich konnte d
as Thema
leider nicht finden.
'
)
await
interaction
.
edit_original_response
(
content
=
'
Ich konnte d
ie Kategorie
leider nicht finden.
'
)
return
@app_commands.command
(
name
=
"
remove-
topic
"
,
description
=
"
Ein
Thema
mit allen zugehörigen Links entfernen.
"
)
@app_commands.describe
(
topic
=
"
Zu entfernende
s Thema
.
"
)
async
def
cmd_remove_
topic
(
self
,
interaction
:
Interaction
,
topic
:
str
):
@app_commands.command
(
name
=
"
remove-
category
"
,
description
=
"
Ein
e Kategorie
mit allen zugehörigen Links entfernen.
"
)
@app_commands.describe
(
category
=
"
Zu entfernende
Kategorie
.
"
)
async
def
cmd_remove_
category
(
self
,
interaction
:
Interaction
,
category
:
str
):
await
interaction
.
response
.
defer
(
ephemeral
=
True
)
if
not
models
.
LinkCategory
.
has_links
(
interaction
.
channel_id
):
await
interaction
.
edit_original_response
(
content
=
"
Für diesen Channel sind noch keine Links hinterlegt.
"
)
return
if
topic
_entity
:
=
models
.
LinkCategory
.
get_or_none
(
models
.
LinkCategory
.
channel
==
interaction
.
channel_id
,
models
.
LinkCategory
.
name
==
topic
):
topic
_entity
.
delete_instance
(
recursive
=
True
)
await
interaction
.
edit_original_response
(
content
=
f
'
Thema
{
topic
}
mit allen zugehörigen Links entfernt
'
)
if
category
_entity
:
=
models
.
LinkCategory
.
get_or_none
(
models
.
LinkCategory
.
channel
==
interaction
.
channel_id
,
models
.
LinkCategory
.
name
==
category
):
category
_entity
.
delete_instance
(
recursive
=
True
)
await
interaction
.
edit_original_response
(
content
=
f
'
Kategorie
{
category
}
mit allen zugehörigen Links entfernt
'
)
else
:
await
interaction
.
edit_original_response
(
content
=
'
Ich konnte d
as Thema
leider nicht finden.
'
)
await
interaction
.
edit_original_response
(
content
=
'
Ich konnte d
ie Kategory
leider nicht finden.
'
)
return
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment