Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
strolchibot
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
strolchibot
Commits
1adfb83c
Commit
1adfb83c
authored
2 years ago
by
dnns01
Browse files
Options
Downloads
Patches
Plain Diff
Added Einkaufsliste
parent
e00e33d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
twitchbot/einkaufsliste.py
+43
-0
43 additions, 0 deletions
twitchbot/einkaufsliste.py
twitchbot/strolchibot.py
+2
-1
2 additions, 1 deletion
twitchbot/strolchibot.py
with
45 additions
and
1 deletion
twitchbot/einkaufsliste.py
0 → 100644
+
43
−
0
View file @
1adfb83c
import
json
from
twitchio.ext
import
commands
class
Einkaufsliste
(
commands
.
Cog
):
def
__init__
(
self
,
bot
):
self
.
bot
=
bot
self
.
items
=
[]
self
.
load
()
def
load
(
self
):
try
:
file
=
open
(
"
einkaufsliste.json
"
,
mode
=
"
r
"
)
self
.
items
=
json
.
load
(
file
)
except
:
self
.
items
=
[]
self
.
save
()
def
save
(
self
):
file
=
open
(
"
einkaufsliste.json
"
,
mode
=
"
w
"
)
json
.
dump
(
self
.
items
,
file
)
@commands.command
(
name
=
"
einkaufsliste
"
)
async
def
cmd_giveaway
(
self
,
ctx
,
add
=
None
,
*
item
):
"""
take part at the giveaway
"""
if
add
==
"
add
"
:
item
=
"
"
.
join
(
item
)
self
.
items
.
append
(
item
)
else
:
if
len
(
self
.
items
)
>
0
:
msg
=
"
Auf Marcus Einkaufsliste stehen folgende Dinge:
"
for
item
in
self
.
items
:
if
len
(
msg
)
+
len
(
item
)
>=
500
:
await
ctx
.
send
(
msg
[:
-
2
])
msg
=
""
msg
+=
item
+
"
,
"
await
ctx
.
send
(
msg
[:
-
2
])
else
:
await
ctx
.
send
(
f
"
Auf Marcus Einkaufsliste steht noch nix!
"
)
This diff is collapsed.
Click to expand it.
twitchbot/strolchibot.py
+
2
−
1
View file @
1adfb83c
...
...
@@ -9,7 +9,7 @@ from twitchio import Channel, Message
from
twitchio.ext
import
commands
from
twitchio.ext.commands
import
Context
import
chat_commands
,
giveaway
,
klassenbuch
,
link_protection
,
spotify_cog
,
vote_cog
,
countdown
import
chat_commands
,
giveaway
,
klassenbuch
,
link_protection
,
spotify_cog
,
vote_cog
,
countdown
,
einkaufsliste
load_dotenv
()
...
...
@@ -35,6 +35,7 @@ class StrolchiBot(commands.Bot, ABC):
self
.
add_cog
(
giveaway
.
Giveaway
(
self
))
self
.
add_cog
(
chat_commands
.
Commands
(
self
))
self
.
add_cog
(
countdown
.
Countdown
(
self
))
self
.
add_cog
(
einkaufsliste
.
Einkaufsliste
(
self
))
@staticmethod
async
def
send_me
(
ctx
,
content
):
...
...
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