Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Signalbot
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frederic Aust
Signalbot
Commits
e818527d
Commit
e818527d
authored
Nov 28, 2023
by
Frederic Aust
Browse files
Options
Downloads
Patches
Plain Diff
Spotify config key fixed
parent
bfcf293f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
signalbot.py
+28
-13
28 additions, 13 deletions
signalbot.py
with
28 additions
and
13 deletions
signalbot.py
+
28
−
13
View file @
e818527d
...
...
@@ -66,7 +66,7 @@ def load_config(filename):
try
:
CONFIG
=
{}
with
open
(
filename
,
'
r
'
)
as
file
:
with
open
(
filename
,
"
r
"
)
as
file
:
CONFIG
=
json
.
load
(
file
)
except
FileNotFoundError
:
...
...
@@ -325,7 +325,9 @@ def roll(msgDict):
def
request
(
msgDict
):
answer
=
""
request_group
=
next
((
group
for
group
in
GROUPS
if
group
[
"
NAME
"
]
==
"
Requests
"
),
None
)
request_group
=
next
(
(
group
for
group
in
GROUPS
if
group
[
"
NAME
"
]
==
"
Requests
"
),
None
)
if
not
msgDict
[
"
content
"
]:
answer
=
"
Was soll denn hinzugefügt werden?
"
...
...
@@ -336,8 +338,7 @@ def request(msgDict):
send
(
answer
,
msgDict
[
"
receiver
"
])
send
(
msgDict
[
"
content
"
],
request_group
[
"
ID
"
])
else
:
send
(
'
Der Befehl Requests funktioniert gerade nicht :(
'
,
msgDict
[
"
receiver
"
])
send
(
"
Der Befehl Requests funktioniert gerade nicht :(
"
,
msgDict
[
"
receiver
"
])
def
get_random_challenge
(
msgDict
):
...
...
@@ -429,9 +430,9 @@ def add_song_to_playlist(msgDict):
spotify_config
=
CONFIG
.
get
(
"
Spotify
"
,
{})
if
(
ModuleSpotify
is
None
or
spotify_config
.
get
(
'
spotify_client_id
'
,
None
)
is
None
or
spotify_config
.
get
(
'
spotify_client_secret
'
,
None
)
is
None
or
spotify_config
.
get
(
'
redirect_uri
'
,
None
)
is
None
or
spotify_config
.
get
(
"
spotify_client_id
"
,
None
)
is
None
or
spotify_config
.
get
(
"
spotify_client_secret
"
,
None
)
is
None
or
spotify_config
.
get
(
"
redirect_uri
"
,
None
)
is
None
):
# TODO bereits in der INit berücksichtigen, wenn die Secrets nicht am start sind
send
(
"
There is no Spotify!
"
,
msgDict
[
"
receiver
"
])
return
...
...
@@ -466,8 +467,14 @@ def mqtt_client():
client2
=
mqtt
.
Client
()
client2
.
on_message
=
on_mqtt_message
client2
.
username_pw_set
(
mqtt_local
.
get
(
"
MQTT_USER
"
,
""
),
mqtt_local
.
get
(
"
MQTT_PWD
"
,
''
))
client2
.
connect
(
mqtt_local
.
get
(
"
MQTT_IP
"
,
''
),
mqtt_local
.
get
(
"
MQTT_PORT
"
,
None
),
mqtt_local
.
get
(
"
MQTT_TIMEOUT
"
,
None
))
client2
.
username_pw_set
(
mqtt_local
.
get
(
"
MQTT_USER
"
,
""
),
mqtt_local
.
get
(
"
MQTT_PWD
"
,
""
)
)
client2
.
connect
(
mqtt_local
.
get
(
"
MQTT_IP
"
,
""
),
mqtt_local
.
get
(
"
MQTT_PORT
"
,
None
),
mqtt_local
.
get
(
"
MQTT_TIMEOUT
"
,
None
),
)
# TODO Topics und receiver in config auslagern, um dynamischer zu subscriben
client2
.
subscribe
(
"
Sensoren/Arbeitszimmer/temperature
"
)
client2
.
loop_forever
()
...
...
@@ -502,11 +509,13 @@ def remind_pflanzen():
send
(
f
"
Bitte gebt den armen Pflanzen etwas Lebenselixier!
"
,
tierwg
[
"
ID
"
])
def
gg_remind_schichten
():
gg_group
=
next
((
group
for
group
in
GROUPS
if
group
[
"
NAME
"
]
==
"
GGOffiziell
"
),
None
)
if
gg_group
is
not
None
:
send
(
f
'
Bitte tragt euch in die Planung ein:
\n
{
gg_group
[
"
LINKS
"
][
"
Planung
"
]
}
'
,
gg_group
[
"
ID
"
])
send
(
f
'
Bitte tragt euch in die Planung ein:
\n
{
gg_group
[
"
LINKS
"
][
"
Planung
"
]
}
'
,
gg_group
[
"
ID
"
],
)
def
gg_remind_stundenzettel
():
...
...
@@ -573,10 +582,16 @@ if __name__ == "__main__":
challenges
=
ModuleChallenge
(
"
/home/pi/signalbot/challenge.json
"
,
log
)
birthday_reminder
=
ModuleBirthdayReminder
(
GROUPS
,
send
,
log
)
tex
=
ModuleTex
(
log
)
commands
=
ModuleCommands
(
"
/home/pi/signalbot/commands.json
"
,
CONFIG
.
get
(
"
FUN_DICT
"
,
{}),
log
)
commands
=
ModuleCommands
(
"
/home/pi/signalbot/commands.json
"
,
CONFIG
.
get
(
"
FUN_DICT
"
,
{}),
log
)
event_reminder
=
ModuleEventReminder
(
GROUPS
,
send
,
log
)
spotify
=
ModuleSpotify
(
send
,
spotify_config
.
get
(
'
spotify_client_id
'
,
''
),
spotify_config
.
get
(
'
spotify_client_secret
'
,
''
),
spotify_config
.
get
(
'
redirect_uri
'
,
''
),
log
send
,
spotify_config
.
get
(
"
client_id
"
,
""
),
spotify_config
.
get
(
"
client_secret
"
,
""
),
spotify_config
.
get
(
"
redirect_uri
"
,
""
),
log
,
)
today
=
ModuleToday
(
log
)
loop
=
GLib
.
MainLoop
()
...
...
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