Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
software-project-WS25
Discord Team
Commits
69c9fb00
Commit
69c9fb00
authored
Nov 25, 2025
by
Dennis
Browse files
delete unused file
parent
6102c6ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
bot.py
deleted
100644 → 0
View file @
6102c6ca
import
discord
import
os
from
dotenv
import
load_dotenv
import
re
intents
=
discord
.
Intents
.
default
()
intents
.
message_content
=
True
intents
.
guilds
=
True
intents
.
messages
=
True
intents
.
reactions
=
True
client
=
discord
.
Client
(
intents
=
intents
)
load_dotenv
()
TOKEN
=
os
.
getenv
(
'DISCORD_TOKEN'
)
URL_REGEX
=
r
'(https?://\S+)'
# URL regex
@
client
.
event
async
def
on_ready
():
print
(
f
'Bot successfully logged on as
{
client
.
user
}
(ID:
{
client
.
user
.
id
}
)'
)
#maybe DB init here
@
client
.
event
async
def
on_message
(
message
):
if
message
.
author
==
client
.
user
:
return
message_data
=
{
"content"
:
message
.
content
,
"author_name"
:
str
(
message
.
author
),
"author_id"
:
message
.
author
.
id
,
"channel_id"
:
message
.
channel
.
id
,
"server_id"
:
message
.
guild
.
id
if
message
.
guild
else
"DM"
,
"timestamp"
:
message
.
created_at
.
isoformat
()
}
print
(
f
'
{
message
.
author
}
said:
{
message_data
[
"content"
]
}
'
)
found_links
=
re
.
findall
(
URL_REGEX
,
message
.
content
)
if
found_links
:
print
(
f
'LINKS FOUND:
{
message
.
author
}
posted
{
len
(
found_links
)
}
link(s):
{
", "
.
join
(
found_links
)
}
'
)
if
message
.
attachments
:
for
attachment
in
message
.
attachments
:
log_entry
=
{
"filename"
:
attachment
.
filename
,
"url"
:
attachment
.
url
,
"content_type"
:
attachment
.
content_type
,
"size_bytes"
:
attachment
.
size
}
print
(
f
'ATTACHMENT:
{
message
.
author
}
attached "
{
log_entry
[
"filename"
]
}
" (Type:
{
log_entry
[
"content_type"
]
}
) at URL:
{
log_entry
[
"url"
]
}
'
)
if
log_entry
[
"content_type"
]
and
log_entry
[
"content_type"
].
startswith
(
'image/'
):
print
(
" -> Type: Image."
)
elif
log_entry
[
"content_type"
]
and
log_entry
[
"content_type"
].
startswith
(
'video/'
):
print
(
" -> Type: Video."
)
if
message
.
embeds
:
for
embed
in
message
.
embeds
:
url
=
embed
.
url
if
embed
.
url
else
"N/A"
title
=
embed
.
title
if
embed
.
title
else
"N/A"
print
(
f
'EMBED:
{
message
.
author
}
triggered an embed.'
)
print
(
f
' -> Title: "
{
title
}
", URL:
{
url
}
'
)
# Wenn das Embed ein Bild oder Video enthält, findest du die Daten hier:
if
embed
.
image
and
embed
.
image
.
url
:
print
(
f
' -> Embedded Image URL:
{
embed
.
image
.
url
}
'
)
if
embed
.
video
and
embed
.
video
.
url
:
print
(
f
' -> Embedded Video URL:
{
embed
.
video
.
url
}
'
)
@
client
.
event
async
def
on_reaction_add
(
reaction
,
user
):
if
user
==
client
.
user
:
return
log_reaction_change
(
message_id
=
reaction
.
message
.
id
,
emoji
=
str
(
reaction
.
emoji
),
user_id
=
user
.
id
,
action
=
"ADDED"
)
@
client
.
event
async
def
on_reaction_remove
(
reaction
,
user
):
print
(
f
'
{
user
}
said:
{
reaction
}
'
)
if
user
==
client
.
user
:
return
log_reaction_change
(
message_id
=
reaction
.
message
.
id
,
emoji
=
str
(
reaction
.
emoji
),
user_id
=
user
.
id
,
action
=
"REMOVED"
)
def
log_reaction_change
(
message_id
,
emoji
,
user_id
,
action
):
print
(
f
'Logging
{
action
}
on
{
message_id
}
with emoji
{
emoji
}
'
)
client
.
run
(
TOKEN
)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment