Showing preview only (496K chars total). Download the full file or copy to clipboard to get everything.
Repository: jh0ker/mau_mau_bot
Branch: master
Commit: 33e195a0963e
Files: 70
Total size: 445.8 KB
Directory structure:
gitextract_qwkuwrf5/
├── .github/
│ └── workflows/
│ └── docker-publish.yml
├── .gitignore
├── AUTHORS.md
├── Dockerfile
├── LICENSE
├── Pipfile
├── README.md
├── TRANSLATORS.md
├── actions.py
├── bot.py
├── card.py
├── chart/
│ ├── .helmignore
│ ├── Chart.yaml
│ ├── templates/
│ │ └── common.yaml
│ └── values.yaml
├── commandlist.txt
├── config.json.example
├── config.py
├── database.py
├── deck.py
├── docker-compose.yml
├── errors.py
├── game.py
├── game_manager.py
├── genpot.sh
├── images/
│ ├── api_auth.json.sample
│ ├── build_classic_colorblind_deck.py
│ ├── classic/
│ │ └── source.txt
│ ├── colorblind_overlay/
│ │ └── colorblind_overlay.ai
│ ├── options/
│ │ └── xcf/
│ │ ├── bluff.xcf
│ │ ├── draw.xcf
│ │ ├── info.xcf
│ │ └── pass.xcf
│ ├── sticker_config.json.sample
│ └── sticker_uploader.py
├── internationalization.py
├── locales/
│ ├── __init__.py
│ ├── available.py
│ ├── ca_CA/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── compile.sh
│ ├── de_DE/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── es_ES/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── hn_IN/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── id_ID/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── it_IT/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── ml_IN/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── pt_BR/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── ru_RU/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── tr_TR/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── unobot.pot
│ ├── uz_UZ/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── vi_VN/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── zh_CN/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ ├── zh_HK/
│ │ └── LC_MESSAGES/
│ │ └── unobot.po
│ └── zh_TW/
│ └── LC_MESSAGES/
│ └── unobot.po
├── mwt.py
├── player.py
├── promotions.py
├── renovate.json
├── requirements.txt
├── results.py
├── settings.py
├── shared_vars.py
├── simple_commands.py
├── start_bot.py
├── test/
│ ├── __init__.py
│ ├── test_game_manager.py
│ └── test_player.py
├── user_setting.py
└── utils.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/docker-publish.yml
================================================
name: Docker build
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
name: "Build and push the container"
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
uses: JuniorJPDJ/containers/.github/workflows/docker-parallel-multiarch-build.yml@master
with:
title: mau_mau_bot
platforms: 'linux/amd64,linux/386,linux/arm/v7,linux/arm64'
buildkit-mount-caches: '{"home-cache": "/root/.cache", "home-cargo": "/root/.cargo"}'
buildkit-mount-cache-ids-append-platform: true
registry: ghcr.io
registry-username: ${{ github.actor }}
image-name: ${{ github.repository }}
secrets:
registry-password: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .gitignore
================================================
# Config file
config.json
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
venv/
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
# *.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
#Ipython Notebook
.ipynb_checkpoints
# PyCharm
.idea
# Helm resources
chart/charts
# Database file
uno.sqlite3
data/
images/api_auth.json
images/sticker_config.json
images/sticker_uploader.session
================================================
FILE: AUTHORS.md
================================================
# Credits
`mau_mau_bot` is written and maintained by [Jannes Höke](https://github.com/jh0ker)
## Contributors
The following wonderful people contributed directly or indirectly to this project:
- [divadsn](https://github.com/divadsn)
- [imlonghao](https://github.com/imlonghao)
- [Iuri Guilherme](https://github.com/iuriguilherme)
- [JuniorJPDJ](https://github.com/JuniorJPDJ)
- [pan93412](https://github.com/pan93412)
- [qubitnerd](https://github.com/qubitnerd)
- [SYHGroup](https://github.com/SYHGroup)
Please add yourself here alphabetically when you submit your first pull request.
================================================
FILE: Dockerfile
================================================
FROM python:3.11.13-alpine@sha256:8068890a42d68ece5b62455ef327253249b5f094dcdee57f492635a40217f6a3
# renovate: datasource=repology depName=alpine_3_22/gettext versioning=loose
ARG GETTEXT_VERSION="0.24.1-r0"
WORKDIR /app
ADD requirements.txt .
RUN --mount=type=cache,sharing=locked,target=/root/.cache,id=home-cache-$TARGETPLATFORM \
apk add --no-cache \
gettext=${GETTEXT_VERSION} \
&& \
pip install -r requirements.txt && \
chown -R nobody:nogroup /app
COPY --chown=nobody:nogroup . .
USER nobody
RUN cd locales && \
find . -maxdepth 2 -type d -name 'LC_MESSAGES' -exec ash -c 'msgfmt {}/unobot.po -o {}/unobot.mo' \;
VOLUME /app/data
ENV UNO_DB=/app/data/uno.sqlite3
ENTRYPOINT [ "python", "bot.py" ]
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
================================================
FILE: Pipfile
================================================
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
telethon = "*"
[packages]
python-telegram-bot = "==13.15"
pony = "*"
[requires]
python_version = "3.11"
================================================
FILE: README.md
================================================
# UNO Bot
[](./LICENSE)
Telegram Bot that allows you to play the popular card game UNO via inline queries. The bot currently runs as [@unobot](http://telegram.me/unobot).
To run the bot yourself, you will need:
- Python (tested with 3.4+)
- The [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) module
- [Pony ORM](https://ponyorm.com/)
## Setup
- Get a bot token from [@BotFather](http://telegram.me/BotFather) and change configurations in `config.json`.
- Convert all language files from `.po` files to `.mo` by executing the bash script `compile.sh` located in the `locales` folder.
Another option is: `find . -maxdepth 2 -type d -name 'LC_MESSAGES' -exec bash -c 'msgfmt {}/unobot.po -o {}/unobot.mo' \;`.
- Use `/setinline` and `/setinlinefeedback` with BotFather for your bot.
- Use `/setcommands` and submit the list of commands in commandlist.txt
- Install requirements (using a `virtualenv` is recommended): `pip install -r requirements.txt`
You can change some gameplay parameters like turn times, minimum amount of players and default gamemode in `config.json`.
Current gamemodes available: classic, fast and wild. Check the details with the `/modes` command.
Then run the bot with `python3 bot.py`.
Code documentation is minimal but there.
================================================
FILE: TRANSLATORS.md
================================================
# Translators
The following awesome people contributed to this project by translating it:
| Locale | Translators |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ca_CA | [retiolus](https://github.com/retiolus) |
| de_DE | [Jannes Höke](https://github.com/jh0ker) |
| es_ES | [José.A Rojo](https://github.com/J4RV), [Ricardo Valverde Hernández](https://telegram.me/rivh1), Victor, Yuga |
| id_ID | [Erwin Guo](https://www.facebook.com/erwinfransiscus) |
| it_IT | Carola Mariano, ɳick |
| ml_IN | [Adhith T](https://github.com/adhitht123) |
| pt_BR | [Iuri Guilherme](https://github.com/iuriguilherme), [João Rodrigo Couto de Oliveira](http://twitter.com/JoaoRodrigoJR) |
| uz_UZ | [Shohrux V](https://www.instagram.com/shohrux.v/) |
| vi_VN | [Lê Minh Sơn](https://github.com/leminhson06) |
| zh_CN | [imlonghao](https://github.com/imlonghao), [XhyEax](https://github.com/XhyEax) |
| zh_HK | [Jed Cheng](https://www.facebook.com/profile.php?id=100002258388821) |
| zh_TW | [Eugene Lam](https://www.facebook.com/eugenelam1118), [jimchen5209](https://www.youtube.com/user/jimchen5209), [pan93412](https://www.github.com/pan93412) |
Please add yourself here alphabetically when you submit your first translation.
================================================
FILE: actions.py
================================================
import random
import logging
import card as c
from datetime import datetime
from telegram import Message, Chat
from telegram.ext import CallbackContext
from apscheduler.jobstores.base import JobLookupError
from config import TIME_REMOVAL_AFTER_SKIP, MIN_FAST_TURN_TIME
from errors import DeckEmptyError, NotEnoughPlayersError
from internationalization import __, _
from shared_vars import gm
from user_setting import UserSetting
from utils import send_async, display_name, game_is_running
logger = logging.getLogger(__name__)
class Countdown(object):
player = None
job_queue = None
def __init__(self, player, job_queue):
self.player = player
self.job_queue = job_queue
# TODO do_skip() could get executed in another thread (it can be a job), so it looks like it can't use game.translate?
def do_skip(bot, player, job_queue=None):
game = player.game
chat = game.chat
skipped_player = game.current_player
next_player = game.current_player.next
if skipped_player.waiting_time > 0:
skipped_player.anti_cheat += 1
skipped_player.waiting_time -= TIME_REMOVAL_AFTER_SKIP
if (skipped_player.waiting_time < 0):
skipped_player.waiting_time = 0
try:
skipped_player.draw()
except DeckEmptyError:
pass
n = skipped_player.waiting_time
send_async(bot, chat.id,
text=__("Waiting time to skip this player has "
"been reduced to {time} seconds.\n"
"Next player: {name}", multi=game.translate)
.format(time=n,
name=display_name(next_player.user))
)
logger.info("{player} was skipped! "
.format(player=display_name(player.user)))
game.turn()
if job_queue:
start_player_countdown(bot, game, job_queue)
else:
try:
gm.leave_game(skipped_player.user, chat)
send_async(bot, chat.id,
text=__("{name1} ran out of time "
"and has been removed from the game!\n"
"Next player: {name2}", multi=game.translate)
.format(name1=display_name(skipped_player.user),
name2=display_name(next_player.user)))
logger.info("{player} was skipped! "
.format(player=display_name(player.user)))
if job_queue:
start_player_countdown(bot, game, job_queue)
except NotEnoughPlayersError:
send_async(bot, chat.id,
text=__("{name} ran out of time "
"and has been removed from the game!\n"
"The game ended.", multi=game.translate)
.format(name=display_name(skipped_player.user)))
gm.end_game(chat, skipped_player.user)
def do_play_card(bot, player, result_id):
"""Plays the selected card and sends an update to the group if needed"""
card = c.from_str(result_id)
player.play(card)
game = player.game
chat = game.chat
user = player.user
us = UserSetting.get(id=user.id)
if not us:
us = UserSetting(id=user.id)
if us.stats:
us.cards_played += 1
if game.choosing_color:
send_async(bot, chat.id, text=__("Please choose a color", multi=game.translate))
if len(player.cards) == 1:
send_async(bot, chat.id, text="UNO!")
if len(player.cards) == 0:
send_async(bot, chat.id,
text=__("{name} won!", multi=game.translate)
.format(name=user.first_name))
if us.stats:
us.games_played += 1
if game.players_won == 0:
us.first_places += 1
game.players_won += 1
try:
gm.leave_game(user, chat)
except NotEnoughPlayersError:
send_async(bot, chat.id,
text=__("Game ended!", multi=game.translate))
us2 = UserSetting.get(id=game.current_player.user.id)
if us2 and us2.stats:
us2.games_played += 1
gm.end_game(chat, user)
def do_draw(bot, player):
"""Does the drawing"""
game = player.game
draw_counter_before = game.draw_counter
try:
player.draw()
except DeckEmptyError:
send_async(bot, player.game.chat.id,
text=__("There are no more cards in the deck.",
multi=game.translate))
if (game.last_card.value == c.DRAW_TWO or
game.last_card.special == c.DRAW_FOUR) and \
draw_counter_before > 0:
game.turn()
def do_call_bluff(bot, player):
"""Handles the bluff calling"""
game = player.game
chat = game.chat
if player.prev.bluffing:
send_async(bot, chat.id,
text=__("Bluff called! Giving 4 cards to {name}",
multi=game.translate)
.format(name=player.prev.user.first_name))
try:
player.prev.draw()
except DeckEmptyError:
send_async(bot, player.game.chat.id,
text=__("There are no more cards in the deck.",
multi=game.translate))
else:
game.draw_counter += 2
send_async(bot, chat.id,
text=__("{name1} didn't bluff! Giving 6 cards to {name2}",
multi=game.translate)
.format(name1=player.prev.user.first_name,
name2=player.user.first_name))
try:
player.draw()
except DeckEmptyError:
send_async(bot, player.game.chat.id,
text=__("There are no more cards in the deck.",
multi=game.translate))
game.turn()
def start_player_countdown(bot, game, job_queue):
player = game.current_player
time = player.waiting_time
if time < MIN_FAST_TURN_TIME:
time = MIN_FAST_TURN_TIME
if game.mode == 'fast':
if game.job:
try:
game.job.schedule_removal()
except JobLookupError:
pass
job = job_queue.run_once(
#lambda x,y: do_skip(bot, player),
skip_job,
time,
context=Countdown(player, job_queue)
)
logger.info("Started countdown for player: {player}. {time} seconds."
.format(player=display_name(player.user), time=time))
player.game.job = job
def skip_job(context: CallbackContext):
player = context.job.context.player
game = player.game
if game_is_running(game):
job_queue = context.job.context.job_queue
do_skip(context.bot, player, job_queue)
================================================
FILE: bot.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from datetime import datetime
from telegram import ParseMode, InlineKeyboardMarkup, \
InlineKeyboardButton, Update
from telegram.ext import InlineQueryHandler, ChosenInlineResultHandler, \
CommandHandler, MessageHandler, Filters, CallbackQueryHandler, CallbackContext
from telegram.ext.dispatcher import run_async
import card as c
import settings
import simple_commands
from actions import do_skip, do_play_card, do_draw, do_call_bluff, start_player_countdown
from config import WAITING_TIME, DEFAULT_GAMEMODE, MIN_PLAYERS
from errors import (NoGameInChatError, LobbyClosedError, AlreadyJoinedError,
NotEnoughPlayersError, DeckEmptyError)
from internationalization import _, __, user_locale, game_locales
from results import (add_call_bluff, add_choose_color, add_draw, add_gameinfo,
add_no_game, add_not_started, add_other_cards, add_pass,
add_card, add_mode_classic, add_mode_fast, add_mode_wild, add_mode_text)
from shared_vars import gm, updater, dispatcher
from simple_commands import help_handler
from start_bot import start_bot
from utils import display_name
from utils import send_async, answer_async, error, TIMEOUT, user_is_creator_or_admin, user_is_creator, game_is_running
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
logger = logging.getLogger(__name__)
logging.getLogger('apscheduler').setLevel(logging.WARNING)
@user_locale
def notify_me(update: Update, context: CallbackContext):
"""Handler for /notify_me command, pm people for next game"""
chat_id = update.message.chat_id
if update.message.chat.type == 'private':
send_async(bot,
chat_id,
text=_("Send this command in a group to be notified "
"when a new game is started there."))
else:
try:
gm.remind_dict[chat_id].add(update.message.from_user.id)
except KeyError:
gm.remind_dict[chat_id] = {update.message.from_user.id}
@user_locale
def new_game(update: Update, context: CallbackContext):
"""Handler for the /new command"""
chat_id = update.message.chat_id
if update.message.chat.type == 'private':
help_handler(update, context)
else:
if update.message.chat_id in gm.remind_dict:
for user in gm.remind_dict[update.message.chat_id]:
send_async(context.bot,
user,
text=_("A new game has been started in {title}").format(
title=update.message.chat.title))
del gm.remind_dict[update.message.chat_id]
game = gm.new_game(update.message.chat)
game.starter = update.message.from_user
game.owner.append(update.message.from_user.id)
game.mode = DEFAULT_GAMEMODE
send_async(context.bot, chat_id,
text=_("Created a new game! Join the game with /join "
"and start the game with /start"))
@user_locale
def kill_game(update: Update, context: CallbackContext):
"""Handler for the /kill command"""
chat = update.message.chat
user = update.message.from_user
games = gm.chatid_games.get(chat.id)
if update.message.chat.type == 'private':
help_handler(update, context)
return
if not games:
send_async(context.bot, chat.id,
text=_("There is no running game in this chat."))
return
game = games[-1]
if user_is_creator_or_admin(user, game, context.bot, chat):
try:
gm.end_game(chat, user)
send_async(context.bot, chat.id, text=__("Game ended!", multi=game.translate))
except NoGameInChatError:
send_async(context.bot, chat.id,
text=_("The game is not started yet. "
"Join the game with /join and start the game with /start"),
reply_to_message_id=update.message.message_id)
else:
send_async(context.bot, chat.id,
text=_("Only the game creator ({name}) and admin can do that.")
.format(name=game.starter.first_name),
reply_to_message_id=update.message.message_id)
@user_locale
def join_game(update: Update, context: CallbackContext):
"""Handler for the /join command"""
chat = update.message.chat
if update.message.chat.type == 'private':
help_handler(update, context)
return
try:
gm.join_game(update.message.from_user, chat)
except LobbyClosedError:
send_async(context.bot, chat.id, text=_("The lobby is closed"))
except NoGameInChatError:
send_async(context.bot, chat.id,
text=_("No game is running at the moment. "
"Create a new game with /new"),
reply_to_message_id=update.message.message_id)
except AlreadyJoinedError:
send_async(context.bot, chat.id,
text=_("You already joined the game. Start the game "
"with /start"),
reply_to_message_id=update.message.message_id)
except DeckEmptyError:
send_async(context.bot, chat.id,
text=_("There are not enough cards left in the deck for "
"new players to join."),
reply_to_message_id=update.message.message_id)
else:
send_async(context.bot, chat.id,
text=_("Joined the game"),
reply_to_message_id=update.message.message_id)
@user_locale
def leave_game(update: Update, context: CallbackContext):
"""Handler for the /leave command"""
chat = update.message.chat
user = update.message.from_user
player = gm.player_for_user_in_chat(user, chat)
if player is None:
send_async(context.bot, chat.id, text=_("You are not playing in a game in "
"this group."),
reply_to_message_id=update.message.message_id)
return
game = player.game
user = update.message.from_user
try:
gm.leave_game(user, chat)
except NoGameInChatError:
send_async(context.bot, chat.id, text=_("You are not playing in a game in "
"this group."),
reply_to_message_id=update.message.message_id)
except NotEnoughPlayersError:
gm.end_game(chat, user)
send_async(context.bot, chat.id, text=__("Game ended!", multi=game.translate))
else:
if game.started:
send_async(context.bot, chat.id,
text=__("Okay. Next Player: {name}",
multi=game.translate).format(
name=display_name(game.current_player.user)),
reply_to_message_id=update.message.message_id)
else:
send_async(context.bot, chat.id,
text=__("{name} left the game before it started.",
multi=game.translate).format(
name=display_name(user)),
reply_to_message_id=update.message.message_id)
@user_locale
def kick_player(update: Update, context: CallbackContext):
"""Handler for the /kick command"""
if update.message.chat.type == 'private':
help_handler(update, context)
return
chat = update.message.chat
user = update.message.from_user
try:
game = gm.chatid_games[chat.id][-1]
except (KeyError, IndexError):
send_async(context.bot, chat.id,
text=_("No game is running at the moment. "
"Create a new game with /new"),
reply_to_message_id=update.message.message_id)
return
if not game.started:
send_async(context.bot, chat.id,
text=_("The game is not started yet. "
"Join the game with /join and start the game with /start"),
reply_to_message_id=update.message.message_id)
return
if user_is_creator_or_admin(user, game, context.bot, chat):
if update.message.reply_to_message:
kicked = update.message.reply_to_message.from_user
try:
gm.leave_game(kicked, chat)
except NoGameInChatError:
send_async(context.bot, chat.id, text=_("Player {name} is not found in the current game.".format(name=display_name(kicked))),
reply_to_message_id=update.message.message_id)
return
except NotEnoughPlayersError:
gm.end_game(chat, user)
send_async(context.bot, chat.id,
text=_("{0} was kicked by {1}".format(display_name(kicked), display_name(user))))
send_async(context.bot, chat.id, text=__("Game ended!", multi=game.translate))
return
send_async(context.bot, chat.id,
text=_("{0} was kicked by {1}".format(display_name(kicked), display_name(user))))
else:
send_async(context.bot, chat.id,
text=_("Please reply to the person you want to kick and type /kick again."),
reply_to_message_id=update.message.message_id)
return
send_async(context.bot, chat.id,
text=__("Okay. Next Player: {name}",
multi=game.translate).format(
name=display_name(game.current_player.user)),
reply_to_message_id=update.message.message_id)
else:
send_async(context.bot, chat.id,
text=_("Only the game creator ({name}) and admin can do that.")
.format(name=game.starter.first_name),
reply_to_message_id=update.message.message_id)
def select_game(update: Update, context: CallbackContext):
"""Handler for callback queries to select the current game"""
chat_id = int(update.callback_query.data)
user_id = update.callback_query.from_user.id
players = gm.userid_players[user_id]
for player in players:
if player.game.chat.id == chat_id:
gm.userid_current[user_id] = player
break
else:
send_async(bot,
update.callback_query.message.chat_id,
text=_("Game not found."))
return
def selected():
back = [[InlineKeyboardButton(text=_("Back to last group"),
switch_inline_query='')]]
context.bot.answerCallbackQuery(update.callback_query.id,
text=_("Please switch to the group you selected!"),
show_alert=False,
timeout=TIMEOUT)
context.bot.editMessageText(chat_id=update.callback_query.message.chat_id,
message_id=update.callback_query.message.message_id,
text=_("Selected group: {group}\n"
"<b>Make sure that you switch to the correct "
"group!</b>").format(
group=gm.userid_current[user_id].game.chat.title),
reply_markup=InlineKeyboardMarkup(back),
parse_mode=ParseMode.HTML,
timeout=TIMEOUT)
dispatcher.run_async(selected)
@game_locales
def status_update(update: Update, context: CallbackContext):
"""Remove player from game if user leaves the group"""
chat = update.message.chat
if update.message.left_chat_member:
user = update.message.left_chat_member
try:
gm.leave_game(user, chat)
game = gm.player_for_user_in_chat(user, chat).game
except NoGameInChatError:
pass
except NotEnoughPlayersError:
gm.end_game(chat, user)
send_async(context.bot, chat.id, text=__("Game ended!",
multi=game.translate))
else:
send_async(context.bot, chat.id, text=__("Removing {name} from the game",
multi=game.translate)
.format(name=display_name(user)))
@game_locales
@user_locale
def start_game(update: Update, context: CallbackContext):
"""Handler for the /start command"""
if update.message.chat.type != 'private':
chat = update.message.chat
try:
game = gm.chatid_games[chat.id][-1]
except (KeyError, IndexError):
send_async(context.bot, chat.id,
text=_("There is no game running in this chat. Create "
"a new one with /new"))
return
if game.started:
send_async(context.bot, chat.id, text=_("The game has already started"))
elif len(game.players) < MIN_PLAYERS:
send_async(context.bot, chat.id,
text=__("At least {minplayers} players must /join the game "
"before you can start it").format(minplayers=MIN_PLAYERS))
else:
# Starting a game
game.start()
for player in game.players:
player.draw_first_hand()
choice = [[InlineKeyboardButton(text=_("Make your choice!"), switch_inline_query_current_chat='')]]
first_message = (
__("First player: {name}\n"
"Use /close to stop people from joining the game.\n"
"Enable multi-translations with /enable_translations",
multi=game.translate)
.format(name=display_name(game.current_player.user)))
def send_first():
"""Send the first card and player"""
context.bot.sendSticker(chat.id,
sticker=c.STICKERS[str(game.last_card)],
timeout=TIMEOUT)
context.bot.sendMessage(chat.id,
text=first_message,
reply_markup=InlineKeyboardMarkup(choice),
timeout=TIMEOUT)
dispatcher.run_async(send_first)
start_player_countdown(context.bot, game, context.job_queue)
elif len(context.args) and context.args[0] == 'select':
players = gm.userid_players[update.message.from_user.id]
groups = list()
for player in players:
title = player.game.chat.title
if player == gm.userid_current[update.message.from_user.id]:
title = '- %s -' % player.game.chat.title
groups.append(
[InlineKeyboardButton(text=title,
callback_data=str(player.game.chat.id))]
)
send_async(context.bot, update.message.chat_id,
text=_('Please select the group you want to play in.'),
reply_markup=InlineKeyboardMarkup(groups))
else:
help_handler(update, context)
@user_locale
def close_game(update: Update, context: CallbackContext):
"""Handler for the /close command"""
chat = update.message.chat
user = update.message.from_user
games = gm.chatid_games.get(chat.id)
if not games:
send_async(context.bot, chat.id,
text=_("There is no running game in this chat."))
return
game = games[-1]
if user.id in game.owner:
game.open = False
send_async(context.bot, chat.id, text=_("Closed the lobby. "
"No more players can join this game."))
return
else:
send_async(context.bot, chat.id,
text=_("Only the game creator ({name}) and admin can do that.")
.format(name=game.starter.first_name),
reply_to_message_id=update.message.message_id)
return
@user_locale
def open_game(update: Update, context: CallbackContext):
"""Handler for the /open command"""
chat = update.message.chat
user = update.message.from_user
games = gm.chatid_games.get(chat.id)
if not games:
send_async(context.bot, chat.id,
text=_("There is no running game in this chat."))
return
game = games[-1]
if user.id in game.owner:
game.open = True
send_async(context.bot, chat.id, text=_("Opened the lobby. "
"New players may /join the game."))
return
else:
send_async(context.bot, chat.id,
text=_("Only the game creator ({name}) and admin can do that.")
.format(name=game.starter.first_name),
reply_to_message_id=update.message.message_id)
return
@user_locale
def enable_translations(update: Update, context: CallbackContext):
"""Handler for the /enable_translations command"""
chat = update.message.chat
user = update.message.from_user
games = gm.chatid_games.get(chat.id)
if not games:
send_async(context.bot, chat.id,
text=_("There is no running game in this chat."))
return
game = games[-1]
if user.id in game.owner:
game.translate = True
send_async(context.bot, chat.id, text=_("Enabled multi-translations. "
"Disable with /disable_translations"))
return
else:
send_async(context.bot, chat.id,
text=_("Only the game creator ({name}) and admin can do that.")
.format(name=game.starter.first_name),
reply_to_message_id=update.message.message_id)
return
@user_locale
def disable_translations(update: Update, context: CallbackContext):
"""Handler for the /disable_translations command"""
chat = update.message.chat
user = update.message.from_user
games = gm.chatid_games.get(chat.id)
if not games:
send_async(context.bot, chat.id,
text=_("There is no running game in this chat."))
return
game = games[-1]
if user.id in game.owner:
game.translate = False
send_async(context.bot, chat.id, text=_("Disabled multi-translations. "
"Enable them again with "
"/enable_translations"))
return
else:
send_async(context.bot, chat.id,
text=_("Only the game creator ({name}) and admin can do that.")
.format(name=game.starter.first_name),
reply_to_message_id=update.message.message_id)
return
@game_locales
@user_locale
def skip_player(update: Update, context: CallbackContext):
"""Handler for the /skip command"""
chat = update.message.chat
user = update.message.from_user
player = gm.player_for_user_in_chat(user, chat)
if not player:
send_async(context.bot, chat.id,
text=_("You are not playing in a game in this chat."))
return
game = player.game
skipped_player = game.current_player
started = skipped_player.turn_started
now = datetime.now()
delta = (now - started).seconds
# You can't skip if the current player still has time left
# You can skip yourself even if you have time left (you'll still draw)
if delta < skipped_player.waiting_time and player != skipped_player:
n = skipped_player.waiting_time - delta
send_async(context.bot, chat.id,
text=_("Please wait {time} second",
"Please wait {time} seconds",
n)
.format(time=n),
reply_to_message_id=update.message.message_id)
else:
do_skip(context.bot, player)
@game_locales
@user_locale
def reply_to_query(update: Update, context: CallbackContext):
"""
Handler for inline queries.
Builds the result list for inline queries and answers to the client.
"""
results = list()
switch = None
try:
user = update.inline_query.from_user
user_id = user.id
players = gm.userid_players[user_id]
player = gm.userid_current[user_id]
game = player.game
except KeyError:
add_no_game(results)
else:
# The game has not started.
# The creator may change the game mode, other users just get a "game has not started" message.
if not game.started:
if user_is_creator(user, game):
add_mode_classic(results)
add_mode_fast(results)
add_mode_wild(results)
add_mode_text(results)
else:
add_not_started(results)
elif user_id == game.current_player.user.id:
if game.choosing_color:
add_choose_color(results, game)
add_other_cards(player, results, game)
else:
if not player.drew:
add_draw(player, results)
else:
add_pass(results, game)
if game.last_card.special == c.DRAW_FOUR and game.draw_counter:
add_call_bluff(results, game)
playable = player.playable_cards()
added_ids = list() # Duplicates are not allowed
for card in sorted(player.cards):
add_card(game, card, results,
can_play=(card in playable and
str(card) not in added_ids))
added_ids.append(str(card))
add_gameinfo(game, results)
elif user_id != game.current_player.user.id or not game.started:
for card in sorted(player.cards):
add_card(game, card, results, can_play=False)
else:
add_gameinfo(game, results)
for result in results:
result.id += ':%d' % player.anti_cheat
if players and game and len(players) > 1:
switch = _('Current game: {game}').format(game=game.chat.title)
answer_async(context.bot, update.inline_query.id, results, cache_time=0,
switch_pm_text=switch, switch_pm_parameter='select')
@game_locales
@user_locale
def process_result(update: Update, context: CallbackContext):
"""
Handler for chosen inline results.
Checks the players actions and acts accordingly.
"""
try:
user = update.chosen_inline_result.from_user
player = gm.userid_current[user.id]
game = player.game
result_id = update.chosen_inline_result.result_id
chat = game.chat
except (KeyError, AttributeError):
return
logger.debug("Selected result: " + result_id)
result_id, anti_cheat = result_id.split(':')
last_anti_cheat = player.anti_cheat
player.anti_cheat += 1
if result_id in ('hand', 'gameinfo', 'nogame'):
return
elif result_id.startswith('mode_'):
# First 5 characters are 'mode_', the rest is the gamemode.
mode = result_id[5:]
game.set_mode(mode)
logger.info("Gamemode changed to {mode}".format(mode = mode))
send_async(context.bot, chat.id, text=__("Gamemode changed to {mode}".format(mode = mode)))
return
elif len(result_id) == 36: # UUID result
return
elif int(anti_cheat) != last_anti_cheat:
send_async(context.bot, chat.id,
text=__("Cheat attempt by {name}", multi=game.translate)
.format(name=display_name(player.user)))
return
elif result_id == 'call_bluff':
reset_waiting_time(context.bot, player)
do_call_bluff(context.bot, player)
elif result_id == 'draw':
reset_waiting_time(context.bot, player)
do_draw(context.bot, player)
elif result_id == 'pass':
game.turn()
elif result_id in c.COLORS:
game.choose_color(result_id)
else:
reset_waiting_time(context.bot, player)
do_play_card(context.bot, player, result_id)
if game_is_running(game):
nextplayer_message = (
__("Next player: {name}", multi=game.translate)
.format(name=display_name(game.current_player.user)))
choice = [[InlineKeyboardButton(text=_("Make your choice!"), switch_inline_query_current_chat='')]]
send_async(context.bot, chat.id,
text=nextplayer_message,
reply_markup=InlineKeyboardMarkup(choice))
start_player_countdown(context.bot, game, context.job_queue)
def reset_waiting_time(bot, player):
"""Resets waiting time for a player and sends a notice to the group"""
chat = player.game.chat
if player.waiting_time < WAITING_TIME:
player.waiting_time = WAITING_TIME
send_async(bot, chat.id,
text=__("Waiting time for {name} has been reset to {time} "
"seconds", multi=player.game.translate)
.format(name=display_name(player.user), time=WAITING_TIME))
# Add all handlers to the dispatcher and run the bot
dispatcher.add_handler(InlineQueryHandler(reply_to_query))
dispatcher.add_handler(ChosenInlineResultHandler(process_result, pass_job_queue=True))
dispatcher.add_handler(CallbackQueryHandler(select_game))
dispatcher.add_handler(CommandHandler('start', start_game, pass_args=True, pass_job_queue=True))
dispatcher.add_handler(CommandHandler('new', new_game))
dispatcher.add_handler(CommandHandler('kill', kill_game))
dispatcher.add_handler(CommandHandler('join', join_game))
dispatcher.add_handler(CommandHandler('leave', leave_game))
dispatcher.add_handler(CommandHandler('kick', kick_player))
dispatcher.add_handler(CommandHandler('open', open_game))
dispatcher.add_handler(CommandHandler('close', close_game))
dispatcher.add_handler(CommandHandler('enable_translations',
enable_translations))
dispatcher.add_handler(CommandHandler('disable_translations',
disable_translations))
dispatcher.add_handler(CommandHandler('skip', skip_player))
dispatcher.add_handler(CommandHandler('notify_me', notify_me))
simple_commands.register()
settings.register()
dispatcher.add_handler(MessageHandler(Filters.status_update, status_update))
dispatcher.add_error_handler(error)
start_bot(updater)
updater.idle()
================================================
FILE: card.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Colors
RED = 'r'
BLUE = 'b'
GREEN = 'g'
YELLOW = 'y'
BLACK = 'x'
COLORS = (RED, BLUE, GREEN, YELLOW)
COLOR_ICONS = {
RED: '❤️',
BLUE: '💙',
GREEN: '💚',
YELLOW: '💛',
BLACK: '⬛️'
}
# Values
ZERO = '0'
ONE = '1'
TWO = '2'
THREE = '3'
FOUR = '4'
FIVE = '5'
SIX = '6'
SEVEN = '7'
EIGHT = '8'
NINE = '9'
DRAW_TWO = 'draw'
REVERSE = 'reverse'
SKIP = 'skip'
VALUES = (ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, DRAW_TWO,
REVERSE, SKIP)
WILD_VALUES = (ONE, TWO, THREE, FOUR, FIVE, DRAW_TWO, REVERSE, SKIP)
# Special cards
CHOOSE = 'colorchooser'
DRAW_FOUR = 'draw_four'
SPECIALS = (CHOOSE, DRAW_FOUR)
CARDS_CLASSIC = {
"normal": {
"b_0": "BQADBAAD2QEAAl9XmQAB--inQsYcLTsC",
"b_1": "BQADBAAD2wEAAl9XmQABBzh4U-rFicEC",
"b_2": "BQADBAAD3QEAAl9XmQABo3l6TT0MzKwC",
"b_3": "BQADBAAD3wEAAl9XmQAB2y-3TSapRtIC",
"b_4": "BQADBAAD4QEAAl9XmQABT6nhOuolqKYC",
"b_5": "BQADBAAD4wEAAl9XmQABwRfmekGnpn0C",
"b_6": "BQADBAAD5QEAAl9XmQABQITgUsEsqxsC",
"b_7": "BQADBAAD5wEAAl9XmQABVhPF6EcfWjEC",
"b_8": "BQADBAAD6QEAAl9XmQABP6baig0pIvYC",
"b_9": "BQADBAAD6wEAAl9XmQAB0CQdsQs_pXIC",
"b_draw": "BQADBAAD7QEAAl9XmQAB00Wii7R3gDUC",
"b_skip": "BQADBAAD8QEAAl9XmQAB_RJHYKqlc-wC",
"b_reverse": "BQADBAAD7wEAAl9XmQABo7D0B9NUPmYC",
"g_0": "BQADBAAD9wEAAl9XmQABb8CaxxsQ-Y8C",
"g_1": "BQADBAAD-QEAAl9XmQAB9B6ti_j6UB0C",
"g_2": "BQADBAAD-wEAAl9XmQABYpLjOzbRz8EC",
"g_3": "BQADBAAD_QEAAl9XmQABKvc2ZCiY-D8C",
"g_4": "BQADBAAD_wEAAl9XmQABJB52wzPdHssC",
"g_5": "BQADBAADAQIAAl9XmQABp_Ep1I4GA2cC",
"g_6": "BQADBAADAwIAAl9XmQABaaMxxa4MihwC",
"g_7": "BQADBAADBQIAAl9XmQABv5Q264Crz8gC",
"g_8": "BQADBAADBwIAAl9XmQABjMH-X9UHh8sC",
"g_9": "BQADBAADCQIAAl9XmQAB26fZ2fW7vM0C",
"g_draw": "BQADBAADCwIAAl9XmQAB64jIZrgXrQUC",
"g_skip": "BQADBAADDwIAAl9XmQAB17yhhnh46VQC",
"g_reverse": "BQADBAADDQIAAl9XmQAB_xcaab0DkegC",
"r_0": "BQADBAADEQIAAl9XmQABiUfr1hz-zT8C",
"r_1": "BQADBAADEwIAAl9XmQAB5bWfwJGs6Q0C",
"r_2": "BQADBAADFQIAAl9XmQABHR4mg9Ifjw0C",
"r_3": "BQADBAADFwIAAl9XmQABYBx5O_PG2QIC",
"r_4": "BQADBAADGQIAAl9XmQABTQpGrlvet3cC",
"r_5": "BQADBAADGwIAAl9XmQABbdLt4gdntBQC",
"r_6": "BQADBAADHQIAAl9XmQABqEI274p3lSoC",
"r_7": "BQADBAADHwIAAl9XmQABCw8u67Q4EK4C",
"r_8": "BQADBAADIQIAAl9XmQAB8iDJmLxp8ogC",
"r_9": "BQADBAADIwIAAl9XmQAB_HCAww1kNGYC",
"r_draw": "BQADBAADJQIAAl9XmQABuz0OZ4l3k6MC",
"r_skip": "BQADBAADKQIAAl9XmQAC2AL5Ok_ULwI",
"r_reverse": "BQADBAADJwIAAl9XmQABu2tIeQTpDvUC",
"y_0": "BQADBAADKwIAAl9XmQAB_nWoNKe8DOQC",
"y_1": "BQADBAADLQIAAl9XmQABVprAGUDKgOQC",
"y_2": "BQADBAADLwIAAl9XmQABqyT4_YTm54EC",
"y_3": "BQADBAADMQIAAl9XmQABGC-Xxg_N6fIC",
"y_4": "BQADBAADMwIAAl9XmQABbc-ZGL8kApAC",
"y_5": "BQADBAADNQIAAl9XmQAB67QJZIF6XAcC",
"y_6": "BQADBAADNwIAAl9XmQABJg_7XXoITsoC",
"y_7": "BQADBAADOQIAAl9XmQABVrd7OcS2k34C",
"y_8": "BQADBAADOwIAAl9XmQABRpJSahBWk3EC",
"y_9": "BQADBAADPQIAAl9XmQAB9MwJWKLJogYC",
"y_draw": "BQADBAADPwIAAl9XmQABaPYK8oYg84cC",
"y_skip": "BQADBAADQwIAAl9XmQABO_AZKtxY6IMC",
"y_reverse": "BQADBAADQQIAAl9XmQABZdQFahGG6UQC",
"draw_four": "BQADBAAD9QEAAl9XmQABVlkSNfhn76cC",
"colorchooser": "BQADBAAD8wEAAl9XmQABl9rUOPqx4E4C",
},
"not_playable": {
"b_0": "BQADBAADRQIAAl9XmQAB1IfkQ5xAiK4C",
"b_1": "BQADBAADRwIAAl9XmQABbWvhTeKBii4C",
"b_2": "BQADBAADSQIAAl9XmQABS1djHgyQokMC",
"b_3": "BQADBAADSwIAAl9XmQABwQ6VTbgY-MIC",
"b_4": "BQADBAADTQIAAl9XmQABAlKUYha8YccC",
"b_5": "BQADBAADTwIAAl9XmQABMvx8xVDnhUEC",
"b_6": "BQADBAADUQIAAl9XmQABDEbhP1Zd31kC",
"b_7": "BQADBAADUwIAAl9XmQABXb5XQBBaAnIC",
"b_8": "BQADBAADVQIAAl9XmQABgL5HRDLvrjgC",
"b_9": "BQADBAADVwIAAl9XmQABtO3XDQWZLtYC",
"b_draw": "BQADBAADWQIAAl9XmQAB2kk__6_2IhMC",
"b_skip": "BQADBAADXQIAAl9XmQABEGJI6CaH3vcC",
"b_reverse": "BQADBAADWwIAAl9XmQAB_kZA6UdHXU8C",
"g_0": "BQADBAADYwIAAl9XmQABGD5a9oG7Yg4C",
"g_1": "BQADBAADZQIAAl9XmQABqwABZHAXZIg0Ag",
"g_2": "BQADBAADZwIAAl9XmQABTI3mrEhojRkC",
"g_3": "BQADBAADaQIAAl9XmQABVi3rUyzWS3YC",
"g_4": "BQADBAADawIAAl9XmQABZIf5ThaXnpUC",
"g_5": "BQADBAADbQIAAl9XmQABNndVJSQCenIC",
"g_6": "BQADBAADbwIAAl9XmQABpoy1c4ZkrvwC",
"g_7": "BQADBAADcQIAAl9XmQABDeaT5fzxwREC",
"g_8": "BQADBAADcwIAAl9XmQABLIQ06ZM5NnAC",
"g_9": "BQADBAADdQIAAl9XmQABel-mC7eXGsMC",
"g_draw": "BQADBAADdwIAAl9XmQABOHEpxSztCf8C",
"g_skip": "BQADBAADewIAAl9XmQABDaQdMxjjPsoC",
"g_reverse": "BQADBAADeQIAAl9XmQABek1lGz7SJNAC",
"r_0": "BQADBAADfQIAAl9XmQABWrxoiXcsg0EC",
"r_1": "BQADBAADfwIAAl9XmQABlav-bkgSgRcC",
"r_2": "BQADBAADgQIAAl9XmQABDjZkqfJ4AdAC",
"r_3": "BQADBAADgwIAAl9XmQABT7lH7VVcy3MC",
"r_4": "BQADBAADhQIAAl9XmQAB1arPC5x0LrwC",
"r_5": "BQADBAADhwIAAl9XmQABWvs7xkCDldkC",
"r_6": "BQADBAADiQIAAl9XmQABjwABH5ZonWn8Ag",
"r_7": "BQADBAADiwIAAl9XmQABjekJfm4fBDIC",
"r_8": "BQADBAADjQIAAl9XmQABqFjchpsJeEkC",
"r_9": "BQADBAADjwIAAl9XmQAB-sKdcgABdNKDAg",
"r_draw": "BQADBAADkQIAAl9XmQABtw9RPVDHZOQC",
"r_skip": "BQADBAADlQIAAl9XmQABtG2GixCxtX4C",
"r_reverse": "BQADBAADkwIAAl9XmQABz2qyEbabnVsC",
"y_0": "BQADBAADlwIAAl9XmQABAb3ZwTGS1lMC",
"y_1": "BQADBAADmQIAAl9XmQAB9v5qJk9R0x8C",
"y_2": "BQADBAADmwIAAl9XmQABCsgpRHC2g-cC",
"y_3": "BQADBAADnQIAAl9XmQAB3kLLXCv-qY0C",
"y_4": "BQADBAADnwIAAl9XmQAB7R_y-NexNLIC",
"y_5": "BQADBAADoQIAAl9XmQABl-7mwsjD-cMC",
"y_6": "BQADBAADowIAAl9XmQABwbVsyv2MfPkC",
"y_7": "BQADBAADpQIAAl9XmQABoBqC0JsemVwC",
"y_8": "BQADBAADpwIAAl9XmQABpkwAAeh9ldlHAg",
"y_9": "BQADBAADqQIAAl9XmQABpSBEUfd4IM8C",
"y_draw": "BQADBAADqwIAAl9XmQABMt-2zW0VYb4C",
"y_skip": "BQADBAADrwIAAl9XmQABIDf-_TuuxtEC",
"y_reverse": "BQADBAADrQIAAl9XmQABm9M0Zh-_UwkC",
"draw_four": "BQADBAADYQIAAl9XmQAB_HWlvZIscDEC",
"colorchooser": "BQADBAADXwIAAl9XmQABY_ksDdMex-wC",
},
}
CARDS_CLASSIC_COLORBLIND = {
"normal": {
"colorchooser": "CAADBAADrg4AAvX2mVEpx_BiDIE5nQI",
"draw_four": "CAADBAADYRAAArnkmVGmqXHhjWEBxAI",
"r_0": "CAADBAAD6A8AAn_ckVHPWHqiBR_3jAI",
"r_1": "CAADBAAD5Q0AAg-ImVEx-blQI88RrQI",
"r_2": "CAADBAAD1g0AAuMjmVEkQsVhN49DMAI",
"r_3": "CAADBAADlhAAAqy4mVHWovoaWfQG_gI",
"r_4": "CAADBAADCRoAAqf_kVFnl8ACL1rjpwI",
"r_5": "CAADBAADVw8AAjmamVEEv2TVeL9cpQI",
"r_6": "CAADBAADHQ4AAuuUkVH2I-yn6nRBVAI",
"r_7": "CAADBAADNQ8AArP1kVF5rqHtk0pQ-AI",
"r_8": "CAADBAAD1BAAAuQDkVEPiIodUi6WvwI",
"r_9": "CAADBAAD2Q4AAq1nkFHM6z5C0Kff2QI",
"r_draw": "CAADBAADvQ8AAqZukFGEmkRSoSZQEwI",
"r_reverse": "CAADBAAD5RAAAg89mVE8-EY_2DifcAI",
"r_skip": "CAADBAADRg4AAp8bmVFOC6xdEZZRwwI",
"g_0": "CAADBAADTg4AAoQxmFF07jR_vfB4xgI",
"g_1": "CAADBAADQg4AAhkgmFGlsif9nNtXwgI",
"g_2": "CAADBAAD2BUAAue_mFGENiPSjZxbiQI",
"g_3": "CAADBAADpw4AAjO9mFHAOz8KD2n7BwI",
"g_4": "CAADBAADRhAAAqF7kFEcwLalLfDfaAI",
"g_5": "CAADBAADAg8AAqXLmFHJyg2F_ybbvwI",
"g_6": "CAADBAADVhYAAtK7mVGigRq_EkCuVgI",
"g_7": "CAADBAAD2RIAArccmFEj-8LIVNAbsgI",
"g_8": "CAADBAAD6AwAAuvmmFHBRarMimOWawI",
"g_9": "CAADBAADExEAAsNkmVFr8DaHGOwsggI",
"g_draw": "CAADBAADhA8AArxYmVH9ch5Jp00AAboC",
"g_reverse": "CAADBAADMhAAAvVOmFGH284LIY7cegI",
"g_skip": "CAADBAADbBcAAqinkVEOwkJtDRfk2gI",
"b_0": "CAADBAAD-BAAAkj8kFG61GJdw29QOAI",
"b_1": "CAADBAADcRMAAu-EmFFT1i4LcqO4OQI",
"b_2": "CAADBAAD0xQAAqVhmVHyrFSAbxtfjwI",
"b_3": "CAADBAADNg0AAn-xmFHev8IdF_ie0wI",
"b_4": "CAADBAADlQ4AAjZamVFcIL_pVB5cFwI",
"b_5": "CAADBAADrgwAAuL5mVHvEBZ8CG5p5QI",
"b_6": "CAADBAADDhUAAuGRmVGQYvmEOxczBAI",
"b_7": "CAADBAADIxEAAv_dmFEuVt39kkgZgwI",
"b_8": "CAADBAAD2w0AAoE6kVHG7WscV4F2hwI",
"b_9": "CAADBAADvQ0AArRMmVErWaSRP_giKQI",
"b_draw": "CAADBAADlw4AAjF_kFHPWSoYKBwtwQI",
"b_reverse": "CAADBAADog8AAqDJmVEJQp5WocnUnQI",
"b_skip": "CAADBAAD-QwAAgbZmFGltUlnslDNUQI",
"y_0": "CAADBAADrQ4AAr5WmVHNf69eBn2YOAI",
"y_1": "CAADBAADcg8AAmqKmVHfVeUI3u_i7AI",
"y_2": "CAADBAADkA4AAuDImFEQ8qjFlcKplQI",
"y_3": "CAADBAAD-QwAAmromFGAqVn-Y8N72wI",
"y_4": "CAADBAADjQ4AAmNLmFG80k7kfgx1NAI",
"y_5": "CAADBAADqQ8AAmgYmFH1_ey_bMQNYwI",
"y_6": "CAADBAADdQ0AAuWcmFEbG_gm1wGYCQI",
"y_7": "CAADBAAD6QwAApQAAZhRI8OfRvLX3vkC",
"y_8": "CAADBAADARAAAi-2kVEifJ-O9WVilgI",
"y_9": "CAADBAADxA0AAhQ8mFHjnl9tUCHSLAI",
"y_draw": "CAADBAADzw4AAncZmVEhLhX17eqX8AI",
"y_reverse": "CAADBAADTxAAAqgFmVEJRBw4eWgnDwI",
"y_skip": "CAADBAADPhYAAiGbkFG9hptFPLgj7wI",
},
"not_playable": {
"colorchooser": "CAADBAADpQ4AAlfDmFFHGkwyGFeCFQI",
"draw_four": "CAADBAADMRMAAv7amFHvKGLoNyFbNQI",
"r_0": "CAADBAADsBMAAuGdkFHTZ-jl4eNn-gI",
"r_1": "CAADBAADVA4AAhpfkFEKt19qveGSPgI",
"r_2": "CAADBAADrw0AAoWsmVHguULNoYJwUwI",
"r_3": "CAADBAADzxMAAjvkkFFdtKJu5WGwUgI",
"r_4": "CAADBAAD1Q8AAoHZkFFvyQnFHzfwiQI",
"r_5": "CAADBAADWxEAAvkHkFGUo86qxKV0kwI",
"r_6": "CAADBAAD_hIAAjx0mVGmlm-b_FHQBAI",
"r_7": "CAADBAADmhEAAslomFHOv7bqcDJkDAI",
"r_8": "CAADBAADtw0AAgqVmVG2HdSbcJYxZgI",
"r_9": "CAADBAADNxEAAuF6mVE3WzTMJkSVAgI",
"r_draw": "CAADBAADVxAAAiNukFE1K2xORNnfMwI",
"r_reverse": "CAADBAADQxMAAvH0mVHKznpt-uu9ngI",
"r_skip": "CAADBAADZA4AApbPkFFB9E2Px-HFpgI",
"g_0": "CAADBAAD8w4AAjDEmFG7DwKggUEj9QI",
"g_1": "CAADBAAD2g0AAo_DmVHIPG84WdIo1wI",
"g_2": "CAADBAADEhEAAoRXmVGIG2nuN45P6AI",
"g_3": "CAADBAADug8AAsSRmFFzk0TcRuG8VAI",
"g_4": "CAADBAADrQ8AAvgmkFESfo9BjF7-3gI",
"g_5": "CAADBAADVhAAAnPqkFFtxtFX9HlT-AI",
"g_6": "CAADBAADMg8AAiSBmFHIQw1jFjv6UwI",
"g_7": "CAADBAADvREAAv0BkVGDq3H1DCq_DQI",
"g_8": "CAADBAADWQ4AAhOEkVG96JDgCtFrEwI",
"g_9": "CAADBAAD2xYAAruDmFFAUMFryEwjoAI",
"g_draw": "CAADBAADLA4AAu9tkVGTzBbeeYydIQI",
"g_reverse": "CAADBAADVAwAAhYYmFExJS0ozE8-rAI",
"g_skip": "CAADBAADYg4AAulsmFHxOkaz9OsTiwI",
"b_0": "CAADBAADVxUAAtnOkFEIAAGw5CZEIxgC",
"b_1": "CAADBAAD1RAAAnQqkFF9kDqD0wp3ngI",
"b_2": "CAADBAADZg4AAvcUmVHTXwldirf1hAI",
"b_3": "CAADBAADfBAAAkX1mVHw0CWX0h31iQI",
"b_4": "CAADBAADPBAAAuTCmFFDpvXzes4qjwI",
"b_5": "CAADBAADTQ4AAsWQmVHcrxDQUWOB4AI",
"b_6": "CAADBAAD_hAAAoUhmVG8kjd65J8EngI",
"b_7": "CAADBAADlRAAArtjkFGko5TuFNnncwI",
"b_8": "CAADBAADZQ8AAltEmFE_fDYIXBrV3QI",
"b_9": "CAADBAADrhAAAtM-mVGwhrWTD9IaYgI",
"b_draw": "CAADBAADtQ0AAnVbmFGC1hI60JaOQQI",
"b_reverse": "CAADBAADShEAAlcOmFHStPeFzfVIEwI",
"b_skip": "CAADBAAD_xEAAgZFmVFMRA1J8Y1gxAI",
"y_0": "CAADBAAD7xAAAqjjmFHnCu7eKJvSBgI",
"y_1": "CAADBAADJQwAAp6tmFE2zDPVMieQ2QI",
"y_2": "CAADBAADNA4AAl2mmVFpQOxJ41gk_gI",
"y_3": "CAADBAAD3A4AAsxPmFGyZFv42UlxAQI",
"y_4": "CAADBAADwg8AAm88kVEc9HZpl2gmzQI",
"y_5": "CAADBAAD5hIAAkQ6mFHS-aGVuYZAnAI",
"y_6": "CAADBAADvQ8AAs3RmVHVkVBfEF7eIwI",
"y_7": "CAADBAAD1gwAAjlbmFGGH6rBdqP8QQI",
"y_8": "CAADBAADbg8AAqvXkVH1ESeZFcGVrgI",
"y_9": "CAADBAADOQ8AAnjokVG96pmCP7aZ3AI",
"y_draw": "CAADBAAD6w4AAgsJmVETUteFwqTVJgI",
"y_reverse": "CAADBAADtg8AAqiFmFFwothyN9TrXwI",
"y_skip": "CAADBAADSxEAAhcSmFGu_F5LffmsZgI",
},
}
STICKERS_OPTIONS = {
"option_draw": "BQADBAAD-AIAAl9XmQABxEjEcFM-VHIC",
"option_pass": "BQADBAAD-gIAAl9XmQABcEkAAbaZ4SicAg",
"option_bluff": "BQADBAADygIAAl9XmQABJoLfB9ntI2UC",
"option_info": "BQADBAADxAIAAl9XmQABC5v3Z77VLfEC",
}
# TODO: Support multiple card packs
# For now, just use classic colorblind
STICKERS = {
**CARDS_CLASSIC_COLORBLIND["normal"],
**STICKERS_OPTIONS,
}
STICKERS_GREY = {
**CARDS_CLASSIC_COLORBLIND["not_playable"],
}
class Card(object):
"""This class represents an UNO card"""
def __init__(self, color, value, special=None):
self.color = color
self.value = value
self.special = special
def __str__(self):
if self.special:
return self.special
else:
return '%s_%s' % (self.color, self.value)
def __repr__(self):
if self.special:
return '%s%s%s' % (COLOR_ICONS.get(self.color, ''),
COLOR_ICONS[BLACK],
' '.join([s.capitalize()
for s in self.special.split('_')]))
else:
return '%s%s' % (COLOR_ICONS[self.color], self.value.capitalize())
def __eq__(self, other):
"""Needed for sorting the cards"""
return str(self) == str(other)
def __lt__(self, other):
"""Needed for sorting the cards"""
return str(self) < str(other)
def from_str(string):
"""Decodes a Card object from a string"""
if string not in SPECIALS:
color, value = string.split('_')
return Card(color, value)
else:
return Card(None, None, string)
================================================
FILE: chart/.helmignore
================================================
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# helm-docs templates
*.gotmpl
================================================
FILE: chart/Chart.yaml
================================================
apiVersion: v2
name: maumaubot
description: Telegram Bot that allows you to play the popular card game UNO via inline queries.
type: application
version: 0.1.0
appVersion: latest
kubeVersion: ">=1.22.0-0"
keywords:
- telegram
- uno
- telegram-bot
dependencies:
- name: common
repository: https://bjw-s-labs.github.io/helm-charts
version: 4.1.1
sources:
- https://github.com/jh0ker/mau_mau_bot
annotations:
artifacthub.io/links: |-
- name: App Source
url: https://github.com/jh0ker/mau_mau_bot
================================================
FILE: chart/templates/common.yaml
================================================
{{/* Preprocess values and prepare config file */}}
{{- define "maumaubot.preprocess" -}}
secrets:
envs:
stringData:
TOKEN: {{ required "Bot token is required. Please set config.token" .Values.config.token | quote }}
configMaps:
config:
data:
config.json: |
{{- omit .Values.config "token" | mustToPrettyJson | nindent 8 }}
{{- end -}}
{{- $_ := merge .Values (include "maumaubot.preprocess" . | fromYaml) -}}
{{/* Render the templates */}}
{{- include "bjw-s.common.loader.all" . }}
================================================
FILE: chart/values.yaml
================================================
#
# IMPORTANT NOTE
#
# This chart inherits from our common library chart. You can check the default values/options here:
# https://github.com/bjw-s/helm-charts/blob/main/charts/library/common/values.yaml
#
config:
# THIS IS NECESSARY FOR BOT TO START, FILL THIS FIELD
# token:
admin_list:
- 0
open_lobby: true
enable_translations: false
workers: 32
default_gamemode: fast
waiting_time: 120
time_removal_after_skip: 20
min_fast_turn_time: 15
min_players: 2
defaultPodOptions:
securityContext:
fsGroup: 65534
fsGroupChangePolicy: Always
configMaps:
config:
enabled: true
suffix: config
data: {}
# config.json is autogenerated from config object above
secrets:
envs:
suffix: envs
stringData: {}
# TOKEN is got from config.token value
controllers:
main:
type: statefulset
containers:
main:
image:
repository: ghcr.io/jh0ker/mau_mau_bot
pullPolicy: Always
tag: latest
envFrom:
- secret: envs
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65534
runAsGroup: 65534
persistence:
config:
type: configMap
identifier: config
globalMounts:
- path: /app/config.json
readOnly: true
subPath: config.json
data:
type: persistentVolumeClaim
suffix: data
accessMode: ReadWriteOnce
retain: true
globalMounts:
- path: /app/data/
readOnly: false
size: 100Mi
================================================
FILE: commandlist.txt
================================================
new - Start a new game
join - Join the current game
start - Start the game
leave - Leave the game you're in
close - Close the game lobby
open - Open the game lobby
kill - Terminate the game
kick - Kick players out of the game
enable_translations - Enable multi-translations
disable_translations - Disable multi-translations
skip - Skip the current player
notify_me - Get a message when there's a new game in this group
help - How to use this bot?
modes - Explanation of game modes
settings - Language and other settings
stats - Show statistics
source - See source information
news - All news about this bot
================================================
FILE: config.json.example
================================================
{
"token": "token_here",
"admin_list": [0],
"open_lobby": true,
"enable_translations": false,
"workers": 32,
"default_gamemode": "fast",
"waiting_time": 120,
"time_removal_after_skip": 20,
"min_fast_turn_time": 15,
"min_players": 2
}
================================================
FILE: config.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import json
try:
with open("config.json", "r") as f:
config = json.load(f)
except FileNotFoundError:
config = {}
TOKEN = os.getenv("TOKEN", config.get("token"))
WORKERS = int(os.getenv("WORKERS", config.get("workers", 32)))
ADMIN_LIST = os.getenv("ADMIN_LIST", config.get("admin_list", None))
if isinstance(ADMIN_LIST, str):
ADMIN_LIST = set(int(x) for x in ADMIN_LIST.split())
OPEN_LOBBY = os.getenv("OPEN_LOBBY", config.get("open_lobby", True))
ENABLE_TRANSLATIONS = os.getenv("ENABLE_TRANSLATIONS", config.get("enable_translations", False))
if isinstance(OPEN_LOBBY, str):
OPEN_LOBBY = OPEN_LOBBY.lower() in ("yes", "true", "t", "1")
if isinstance(ENABLE_TRANSLATIONS, str):
ENABLE_TRANSLATIONS = ENABLE_TRANSLATIONS.lower() in ("yes", "true", "t", "1")
DEFAULT_GAMEMODE = os.getenv("DEFAULT_GAMEMODE", config.get("default_gamemode", "fast"))
WAITING_TIME = int(os.getenv("WAITING_TIME", config.get("waiting_time", 120)))
TIME_REMOVAL_AFTER_SKIP = int(os.getenv("TIME_REMOVAL_AFTER_SKIP", config.get("time_removal_after_skip", 20)))
MIN_FAST_TURN_TIME = int(os.getenv("MIN_FAST_TURN_TIME", config.get("min_fast_turn_time", 15)))
MIN_PLAYERS = int(os.getenv("MIN_PLAYERS", config.get("min_players", 2)))
================================================
FILE: database.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from pony.orm import Database
# Database singleton
db = Database()
================================================
FILE: deck.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from random import shuffle
import logging
import card as c
from card import Card
from errors import DeckEmptyError
class Deck(object):
""" This class represents a deck of cards """
def __init__(self):
self.cards = list()
self.graveyard = list()
self.logger = logging.getLogger(__name__)
self.logger.debug(self.cards)
def shuffle(self):
"""Shuffles the deck"""
self.logger.debug("Shuffling Deck")
shuffle(self.cards)
def draw(self):
"""Draws a card from this deck"""
try:
card = self.cards.pop()
self.logger.debug("Drawing card " + str(card))
return card
except IndexError:
if len(self.graveyard):
while len(self.graveyard):
self.cards.append(self.graveyard.pop())
self.shuffle()
return self.draw()
else:
raise DeckEmptyError()
def dismiss(self, card):
"""Returns a card to the deck"""
if card.special:
card.color = None
self.graveyard.append(card)
def _fill_classic_(self):
# Fill deck with the classic card set
self.cards.clear()
for color in c.COLORS:
for value in c.VALUES:
self.cards.append(Card(color, value))
if not value == c.ZERO:
self.cards.append(Card(color, value))
for special in c.SPECIALS:
for _ in range(4):
self.cards.append(Card(None, None, special=special))
self.shuffle()
def _fill_wild_(self):
# Fill deck with a wild card set
self.cards.clear()
for color in c.COLORS:
for value in c.WILD_VALUES:
for _ in range(4):
self.cards.append(Card(color, value))
for special in c.SPECIALS:
for _ in range(6):
self.cards.append(Card(None, None, special=special))
self.shuffle()
================================================
FILE: docker-compose.yml
================================================
services:
maumaubot:
# build: .
image: ghcr.io/jh0ker/mau_mau_bot
restart: unless-stopped
volumes:
- ./data:/app/data
================================================
FILE: errors.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class NoGameInChatError(Exception):
pass
class AlreadyJoinedError(Exception):
pass
class LobbyClosedError(Exception):
pass
class NotEnoughPlayersError(Exception):
pass
class DeckEmptyError(Exception):
pass
================================================
FILE: game.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from config import ADMIN_LIST, OPEN_LOBBY, DEFAULT_GAMEMODE, ENABLE_TRANSLATIONS
from datetime import datetime
from deck import Deck
import card as c
class Game(object):
""" This class represents a game of UNO """
current_player = None
reversed = False
choosing_color = False
started = False
draw_counter = 0
players_won = 0
starter = None
mode = DEFAULT_GAMEMODE
job = None
owner = ADMIN_LIST
open = OPEN_LOBBY
translate = ENABLE_TRANSLATIONS
def __init__(self, chat):
self.chat = chat
self.last_card = None
self.deck = Deck()
self.logger = logging.getLogger(__name__)
@property
def players(self):
"""Returns a list of all players in this game"""
players = list()
if not self.current_player:
return players
current_player = self.current_player
itplayer = current_player.next
players.append(current_player)
while itplayer and itplayer != current_player:
players.append(itplayer)
itplayer = itplayer.next
return players
def start(self):
if self.mode == None or self.mode != "wild":
self.deck._fill_classic_()
else:
self.deck._fill_wild_()
self._first_card_()
self.started = True
def set_mode(self, mode):
self.mode = mode
def reverse(self):
"""Reverses the direction of game"""
self.reversed = not self.reversed
def turn(self):
"""Marks the turn as over and change the current player"""
self.logger.debug("Next Player")
self.current_player = self.current_player.next
self.current_player.drew = False
self.current_player.turn_started = datetime.now()
self.choosing_color = False
def _first_card_(self):
# In case that the player did not select a game mode
if not self.deck.cards:
self.set_mode(DEFAULT_GAMEMODE)
# The first card should not be a special card
while not self.last_card or self.last_card.special:
self.last_card = self.deck.draw()
# If the card drawn was special, return it to the deck and loop again
if self.last_card.special:
self.deck.dismiss(self.last_card)
self.play_card(self.last_card)
def play_card(self, card):
"""
Plays a card and triggers its effects.
Should be called only from Player.play or on game start to play the
first card
"""
self.deck.dismiss(self.last_card)
self.last_card = card
self.logger.info("Playing card " + repr(card))
if card.value == c.SKIP:
self.turn()
elif card.special == c.DRAW_FOUR:
self.draw_counter += 4
self.logger.debug("Draw counter increased by 4")
elif card.value == c.DRAW_TWO:
self.draw_counter += 2
self.logger.debug("Draw counter increased by 2")
elif card.value == c.REVERSE:
# Special rule for two players
if self.current_player == self.current_player.next.next:
self.turn()
else:
self.reverse()
# Don't turn if the current player has to choose a color
if card.special not in (c.CHOOSE, c.DRAW_FOUR):
self.turn()
else:
self.logger.debug("Choosing Color...")
self.choosing_color = True
def choose_color(self, color):
"""Carries out the color choosing and turns the game"""
self.last_card.color = color
self.turn()
================================================
FILE: game_manager.py
================================================
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
from game import Game
from player import Player
from errors import (AlreadyJoinedError, LobbyClosedError, NoGameInChatError,
NotEnoughPlayersError)
from promotions import send_promotion_async
class GameManager(object):
""" Manages all running games by using a confusing amount of dicts """
def __init__(self):
self.chatid_games = dict()
self.userid_players = dict()
self.userid_current = dict()
self.remind_dict = dict()
self.logger = logging.getLogger(__name__)
def new_game(self, chat):
"""
Create a new game in this chat
"""
chat_id = chat.id
self.logger.debug("Creating new game in chat " + str(chat_id))
game = Game(chat)
if chat_id not in self.chatid_games:
self.chatid_games[chat_id] = list()
# remove old games
for g in list(self.chatid_games[chat_id]):
if not g.players:
self.chatid_games[chat_id].remove(g)
self.chatid_games[chat_id].append(game)
return game
def join_game(self, user, chat):
""" Create a player from the Telegram user and add it to the game """
self.logger.info("Joining game with id " + str(chat.id))
try:
game = self.chatid_games[chat.id][-1]
except (KeyError, IndexError):
raise NoGameInChatError()
if not game.open:
raise LobbyClosedError()
if user.id not in self.userid_players:
self.userid_players[user.id] = list()
players = self.userid_players[user.id]
# Don not re-add a player and remove the player from previous games in
# this chat, if he is in one of them
for player in players:
if player in game.players:
raise AlreadyJoinedError()
try:
self.leave_game(user, chat)
except NoGameInChatError:
pass
except NotEnoughPlayersError:
self.end_game(chat, user)
if user.id not in self.userid_players:
self.userid_players[user.id] = list()
players = self.userid_players[user.id]
player = Player(game, user)
if game.started:
player.draw_first_hand()
players.append(player)
self.userid_current[user.id] = player
def leave_game(self, user, chat):
""" Remove a player from its current game """
player = self.player_for_user_in_chat(user, chat)
players = self.userid_players.get(user.id, list())
if not player:
games = self.chatid_games[chat.id]
for g in games:
for p in g.players:
if p.user.id == user.id:
if p == g.current_player:
g.turn()
p.leave()
return
raise NoGameInChatError
game = player.game
if len(game.players) < 3:
raise NotEnoughPlayersError()
if player is game.current_player:
game.turn()
player.leave()
players.remove(player)
# If this is the selected game, switch to another
if self.userid_current.get(user.id, None) is player:
if players:
self.userid_current[user.id] = players[0]
else:
del self.userid_current[user.id]
del self.userid_players[user.id]
def end_game(self, chat, user):
"""
End a game
"""
self.logger.info("Game in chat " + str(chat.id) + " ended")
send_promotion_async(chat, chance=0.15)
# Find the correct game instance to end
player = self.player_for_user_in_chat(user, chat)
if not player:
raise NoGameInChatError
game = player.game
# Clear game
for player_in_game in game.players:
this_users_players = \
self.userid_players.get(player_in_game.user.id, list())
try:
this_users_players.remove(player_in_game)
except ValueError:
pass
if this_users_players:
try:
self.userid_current[player_in_game.user.id] = this_users_players[0]
except KeyError:
pass
else:
try:
del self.userid_players[player_in_game.user.id]
except KeyError:
pass
try:
del self.userid_current[player_in_game.user.id]
except KeyError:
pass
self.chatid_games[chat.id].remove(game)
if not self.chatid_games[chat.id]:
del self.chatid_games[chat.id]
def player_for_user_in_chat(self, user, chat):
players = self.userid_players.get(user.id, list())
for player in players:
if player.game.chat.id == chat.id:
return player
return None
================================================
FILE: genpot.sh
================================================
#!/usr/bin/bash
currentVer='1.0'
xgettext *.py -o ./locales/unobot.pot --foreign-user \
--package-name="uno_bot" \
--package-version="$currentVer" \
--msgid-bugs-address='uno@jhoeke.de' \
--keyword=__ \
--keyword=_ \
--keyword=_:1,2 \
--keyword=__:1,2
================================================
FILE: images/api_auth.json.sample
================================================
{
"api_id": 0,
"api_hash": ""
}
================================================
FILE: images/build_classic_colorblind_deck.py
================================================
"""
Script to build the classic colorblind deck from the classic deck.
Requires imagemagick to be installed and in the path.
"""
from pathlib import Path
from shutil import copyfile
from subprocess import run
IMAGES_DIR = Path(__file__).resolve().parent
CLASSIC_DIR = IMAGES_DIR / "classic"
COLORBLIND_DIR = IMAGES_DIR / "classic_colorblind"
COLORBLIND_OVERLAY_DIR = IMAGES_DIR / "colorblind_overlay"
COLORS = ["r", "g", "b", "y"]
NUMBERS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "draw", "reverse", "skip"]
SPECIALS = ["colorchooser", "draw_four"]
def overlay_image(color, number):
base = CLASSIC_DIR / "png" / f"{color}_{number}.png"
overlay = COLORBLIND_OVERLAY_DIR / f"{color}.png"
out = COLORBLIND_DIR / "png" / f"{color}_{number}.png"
run(["magick", "convert", str(base), str(overlay), "-composite", str(out)])
def create_not_playable(card):
base = COLORBLIND_DIR / "png" / f"{card}.png"
overlay = COLORBLIND_OVERLAY_DIR / "not_playable.png"
out = COLORBLIND_DIR / "png_not_playable" / f"{card}.png"
run(
[
"magick",
"convert",
str(base),
"-modulate",
"75,20",
"-brightness-contrast",
"0x10",
str(overlay),
"-composite",
str(out),
]
)
def convert_png_to_webp(suffix):
for color in COLORS:
for number in NUMBERS:
card = f"{color}_{number}"
png = COLORBLIND_DIR / f"png{suffix}" / f"{card}.png"
webp = COLORBLIND_DIR / f"webp{suffix}" / f"{card}.webp"
run(["magick", "convert", str(png), "-define", "webp:lossless=true", str(webp)])
for special in SPECIALS:
png = COLORBLIND_DIR / f"png{suffix}" / f"{special}.png"
webp = COLORBLIND_DIR / f"webp{suffix}" / f"{special}.webp"
run(["magick", "convert", str(png), "-define", "webp:lossless=true", str(webp)])
def main():
(COLORBLIND_DIR / "png").mkdir(parents=True, exist_ok=True)
(COLORBLIND_DIR / "png_not_playable").mkdir(parents=True, exist_ok=True)
(COLORBLIND_DIR / "webp").mkdir(parents=True, exist_ok=True)
(COLORBLIND_DIR / "webp_not_playable").mkdir(parents=True, exist_ok=True)
for color in COLORS:
for number in NUMBERS:
overlay_image(color, number)
for special in SPECIALS:
copyfile(
CLASSIC_DIR / "png" / f"{special}.png",
COLORBLIND_DIR / "png" / f"{special}.png",
)
for color in COLORS:
for number in NUMBERS:
create_not_playable(f"{color}_{number}")
for special in SPECIALS:
create_not_playable(special)
convert_png_to_webp("")
convert_png_to_webp("_not_playable")
if __name__ == "__main__":
main()
================================================
FILE: images/classic/source.txt
================================================
https://commons.wikimedia.org/wiki/File:UNO_cards_deck.svg
================================================
FILE: images/colorblind_overlay/colorblind_overlay.ai
================================================
%PDF-1.6
%
1 0 obj
<</Metadata 2 0 R/OCProperties<</D<</ON[21 0 R]/Order 22 0 R/RBGroups[]>>/OCGs[21 0 R]>>/Pages 3 0 R/Type/Catalog>>
endobj
2 0 obj
<</Length 22966/Subtype/XML/Type/Metadata>>stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 9.0-c001 79.14ecb42, 2022/12/02-19:12:44 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/"
xmlns:xmpTPg="http://ns.adobe.com/xap/1.0/t/pg/"
xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
xmlns:stFnt="http://ns.adobe.com/xap/1.0/sType/Font#"
xmlns:xmpG="http://ns.adobe.com/xap/1.0/g/"
xmlns:illustrator="http://ns.adobe.com/illustrator/1.0/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
<xmp:CreatorTool>Adobe Illustrator 27.4 (Windows)</xmp:CreatorTool>
<xmp:CreateDate>2023-04-08T18:52:11+02:00</xmp:CreateDate>
<xmp:MetadataDate>2023-04-08T18:52:11+02:00</xmp:MetadataDate>
<xmp:ModifyDate>2023-04-08T18:52:11+02:00</xmp:ModifyDate>
<xmp:Thumbnails>
<rdf:Alt>
<rdf:li rdf:parseType="Resource">
<xmpGImg:width>256</xmpGImg:width>
<xmpGImg:height>72</xmpGImg:height>
<xmpGImg:format>JPEG</xmpGImg:format>
<xmpGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgASAEAAwER
AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
+DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6yt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H8hj810nkryK0
jsyavyYkmlneUqT/AMw2H8nDzSdDDzVbfyv5RtldLeXXYUk+2sdtfIG+YFuK4RpYjkSkaOI5E/NM
tP0O3ksRoukWU9poryBtUvbtHiluEWhaBI5AktJKcJGZFXhULUmq3Y8YgKDfixRgKCf65YXc6293
Ycf0hYSGa3SQlY5QylJIXYAlQ6Nsd+LBWo1KGbYklz+iLqUS3MGr2NwG5Pax29zIqSb1KtAk8JJr
1jcj8c1mfsrHklxcU49djtfe5mLXTgKqJ94Q0ml+VpHLyDVndt2ZrK9JPzJt8xZez+CRsmZPvH6m
8dq5QKAj8mho/lPgRw1SlRX/AEK8r3/5d8H+h3T98vmP1J/lbL5Nfofyl/Jqv/SFef8AZPj/AKHd
P3z+Y/Uv8r5v6KIWDQFmjmFvq2oTxbwW8ttdAFhuBymjhiX/AGbhfHL4di4RISkZTr+cbapdo5DE
gCMb7gnmiWN8sl1qWpKiahfFQYYzzWG3i5ejDzovIjmzsf5mIHwgZt3AfOP5t/kn5r0rzNd+YPLF
pPqWl3s73ipaIJLm1mmYtJH6CDk8ZZzw4KaL8LDbkwx5MmHIMmM1IPQaPXYMmHwNR9I5Fhf6B/Nf
/qw6z/3DJ/8Aqhmy/wBEGu7/APYhl+Q7M/nn5/sd+gfzX/6sOs/9wyf/AKoY/wCiDXd/+xC/kOzP
55+f7G30T82XdnbQtZLMSSf0XP1O/wDvjAO39aBV/wCxC/kOzP55+f7Fe0svzms+f1TS9et/UFJP
S0+5TkPfjCK5Cfbern9XCffGP6k/kezP55+f7E48hfkl51816/DceY7K507REcHULi/RoJpY4yCb
eGA+nIPU5U58Qq/EalhxOFnz5dRPjymyubWabT4Ti0+5lzL/AP/Z</xmpGImg:image>
</rdf:li>
</rdf:Alt>
</xmp:Thumbnails>
<xmpTPg:NPages>1</xmpTPg:NPages>
<xmpTPg:HasVisibleTransparency>False</xmpTPg:HasVisibleTransparency>
<xmpTPg:HasVisibleOverprint>False</xmpTPg:HasVisibleOverprint>
<xmpTPg:MaxPageSize rdf:parseType="Resource">
<stDim:w>193.599991</stDim:w>
<stDim:h>289.599976</stDim:h>
<stDim:unit>Pixels</stDim:unit>
</xmpTPg:MaxPageSize>
<xmpTPg:Fonts>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<stFnt:fontName>RobotoSlab-Bold</stFnt:fontName>
<stFnt:fontFamily>Roboto Slab</stFnt:fontFamily>
<stFnt:fontFace>Bold</stFnt:fontFace>
<stFnt:fontType>TrueType</stFnt:fontType>
<stFnt:versionString>Version 2.001</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>RobotoSlab-Bold.ttf</stFnt:fontFileName>
</rdf:li>
</rdf:Bag>
</xmpTPg:Fonts>
<xmpTPg:PlateNames>
<rdf:Seq>
<rdf:li>Cyan</rdf:li>
<rdf:li>Magenta</rdf:li>
<rdf:li>Yellow</rdf:li>
<rdf:li>Black</rdf:li>
</rdf:Seq>
</xmpTPg:PlateNames>
<xmpTPg:SwatchGroups>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<xmpG:groupName>Default Swatch Group</xmpG:groupName>
<xmpG:groupType>0</xmpG:groupType>
</rdf:li>
</rdf:Seq>
</xmpTPg:SwatchGroups>
<illustrator:Type>Document</illustrator:Type>
<illustrator:CreatorSubTool>AIRobin</illustrator:CreatorSubTool>
<dc:format>application/pdf</dc:format>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">colorblind_overlay</rdf:li>
</rdf:Alt>
</dc:title>
<xmpMM:InstanceID>uuid:d0e88164-e54a-43f1-9176-e4b67b8944dd</xmpMM:InstanceID>
<xmpMM:DocumentID>xmp.did:0c5f72c6-954f-6a4d-8cba-e740cb0ca04d</xmpMM:DocumentID>
<xmpMM:OriginalDocumentID>xmp.did:6aa152a9-2e2b-ef49-b9a6-6c5e8b86b26c</xmpMM:OriginalDocumentID>
<xmpMM:RenditionClass>proof:pdf</xmpMM:RenditionClass>
<xmpMM:History>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:6aa152a9-2e2b-ef49-b9a6-6c5e8b86b26c</stEvt:instanceID>
<stEvt:when>2023-04-08T17:06:15+02:00</stEvt:when>
<stEvt:softwareAgent>Adobe Illustrator 27.4 (Windows)</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<stEvt:action>saved</stEvt:action>
<stEvt:instanceID>xmp.iid:0c5f72c6-954f-6a4d-8cba-e740cb0ca04d</stEvt:instanceID>
<stEvt:when>2023-04-08T18:51:30+02:00</stEvt:when>
<stEvt:softwareAgent>Adobe Illustrator 27.4 (Windows)</stEvt:softwareAgent>
<stEvt:changed>/</stEvt:changed>
</rdf:li>
</rdf:Seq>
</xmpMM:History>
<xmpMM:DerivedFrom rdf:parseType="Resource">
<stRef:instanceID>xmp.iid:0f37ae40-281b-5247-ba02-870759ad3e47</stRef:instanceID>
<stRef:documentID>xmp.did:6aa152a9-2e2b-ef49-b9a6-6c5e8b86b26c</stRef:documentID>
<stRef:originalDocumentID>xmp.did:6aa152a9-2e2b-ef49-b9a6-6c5e8b86b26c</stRef:originalDocumentID>
</xmpMM:DerivedFrom>
<pdf:Producer>Adobe PDF library 17.00</pdf:Producer>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>
endstream
endobj
3 0 obj
<</Count 5/Kids[5 0 R 18 0 R 19 0 R 20 0 R 23 0 R]/Type/Pages>>
endobj
5 0 obj
<</ArtBox[0.0 0.0000610352 193.6 289.6]/BleedBox[0.0 0.0 193.6 289.6]/Contents 24 0 R/CropBox[0.0 0.0 193.6 289.6]/LastModified(D:20230408185211+02'00')/MediaBox[0.0 0.0 193.6 289.6]/Parent 3 0 R/Resources<</ExtGState<</GS0 25 0 R>>/Font<</TT0 26 0 R>>/ProcSet[/PDF/Text]/Properties<</MC0 21 0 R>>>>/TrimBox[0.0 0.0 193.6 289.6]/Type/Page/PieceInfo<</Illustrator 8 0 R>>>>
endobj
18 0 obj
<</ArtBox[0.0 0.0000610352 193.6 289.6]/BleedBox[0.0 0.0 193.6 289.6]/Contents 27 0 R/CropBox[0.0 0.0 193.6 289.6]/LastModified(D:20230408185211+02'00')/MediaBox[0.0 0.0 193.6 289.6]/Parent 3 0 R/Resources<</ExtGState<</GS0 25 0 R>>/Font<</TT0 26 0 R>>/ProcSet[/PDF/Text]/Properties<</MC0 21 0 R>>>>/TrimBox[0.0 0.0 193.6 289.6]/Type/Page/PieceInfo<</Illustrator 8 0 R>>>>
endobj
19 0 obj
<</ArtBox[0.0 0.0 193.6 289.522]/BleedBox[0.0 0.0 193.6 289.6]/Contents 28 0 R/CropBox[0.0 0.0 193.6 289.6]/LastModified(D:20230408185211+02'00')/MediaBox[0.0 0.0 193.6 289.6]/Parent 3 0 R/Resources<</ExtGState<</GS0 25 0 R>>/Font<</TT0 26 0 R>>/ProcSet[/PDF/Text]/Properties<</MC0 21 0 R>>>>/TrimBox[0.0 0.0 193.6 289.6]/Type/Page/PieceInfo<</Illustrator 8 0 R>>>>
endobj
20 0 obj
<</ArtBox[0.0 0.0 193.6 289.522]/BleedBox[0.0 0.0 193.6 289.6]/Contents 29 0 R/CropBox[0.0 0.0 193.6 289.6]/LastModified(D:20230408185211+02'00')/MediaBox[0.0 0.0 193.6 289.6]/Parent 3 0 R/Resources<</ExtGState<</GS0 25 0 R>>/Font<</TT0 26 0 R>>/ProcSet[/PDF/Text]/Properties<</MC0 21 0 R>>>>/TrimBox[0.0 0.0 193.6 289.6]/Type/Page/PieceInfo<</Illustrator 8 0 R>>>>
endobj
23 0 obj
<</ArtBox[0.0 0.0 193.6 289.6]/BleedBox[0.0 0.0 193.6 289.6]/Contents 30 0 R/CropBox[0.0 0.0 193.6 289.6]/LastModified(D:20230408185211+02'00')/MediaBox[0.0 0.0 193.6 289.6]/Parent 3 0 R/Resources<</ExtGState<</GS0 25 0 R>>/Properties<</MC0 21 0 R>>>>/TrimBox[0.0 0.0 193.6 289.6]/Type/Page/PieceInfo<</Illustrator 8 0 R>>>>
endobj
30 0 obj
<</Filter/FlateDecode/Length 677>>stream
HVn1+t.@YHk"'Hs`Hz JC×>VtEYjvkd]}?>݃O?n->No
J\r\\Lʁ >S~IdЈ2&6e8+py0]]T6x妘YZ~6A+|S}*ћ~G^>rӄgr8:UC2%dQC6.!Yٛ*
(;]%g17Q
BStSWk5iEf-[Rtsw@6TQ25(br5nGdEP&i~(*<ebCf*[<I#TÛ_zzFflSAYs]hB+ٔ-%0(R<3CN2#| .g~д5
'pr`{ :l-2h\d
5
wk*>qH)n&:ɕУg?-+*ƾA+`^Zk1|`>0Lvvyh̟>~nw:zhN8sWkD}~d:ٺȴL@9شI?ㇻ5l^FmP<h6'z~0 ]
endstream
endobj
8 0 obj
<</LastModified(D:20230408185211+02'00')/Private 9 0 R>>
endobj
9 0 obj
<</AIMetaData 10 0 R/AIPrivateData1 11 0 R/ContainerVersion 12/CreatorVersion 27/RoundtripStreamType 2/RoundtripVersion 24>>
endobj
10 0 obj
<</Length 1542>>stream
%!PS-Adobe-3.0
%%Creator: Adobe Illustrator(R) 24.0
%%AI8_CreatorVersion: 27.4.0
%%For: (jhoeke) ()
%%Title: (colorblind_overlays.aic)
%%CreationDate: 4/8/2023 6:52 PM
%%Canvassize: 16383
%%BoundingBox: 0 -1 1048 290
%%HiResBoundingBox: 0 -0.077777730093658 1047.99995112419 289.600155067434
%%DocumentProcessColors: Cyan Magenta Yellow Black
%AI5_FileFormat 14.0
%AI12_BuildNumber: 669
%AI3_ColorUsage: Color
%AI7_ImageSettings: 0
%%RGBProcessColor: 0 0 0 ([Registration])
%AI3_Cropmarks: 854.399963378906 0 1047.99995422363 289.599975585938
%AI3_TemplateBox: 97.5 145.099975585938 97.5 145.099975585938
%AI3_TileBox: 645.19995880127 -251.200012207031 1257.19995880127 540.799987792969
%AI3_DocumentPreview: None
%AI5_ArtSize: 14400 14400
%AI5_RulerUnits: 6
%AI24_LargeCanvasScale: 1
%AI9_ColorModel: 1
%AI5_ArtFlags: 0 0 0 1 0 0 1 0 0
%AI5_TargetResolution: 800
%AI5_NumLayers: 1
%AI17_Begin_Content_if_version_gt:24 4
%AI10_OpenToVie: -487 864.599975585938 1 0 8629 8116.5 2052 1274 18 0 0 78 121 0 0 0 1 1 0 1 1 0 1
%AI17_Alternate_Content
%AI9_OpenToView: -487 864.599975585938 1 2052 1274 18 0 0 78 121 0 0 0 1 1 0 1 1 0 1
%AI17_End_Versioned_Content
%AI5_OpenViewLayers: 7
%AI17_Begin_Content_if_version_gt:24 4
%AI17_Alternate_Content
%AI17_End_Versioned_Content
%%PageOrigin:-286 16.5999755859375
%AI7_GridSettings: 72 8 72 8 1 0 0.800000011920929 0.800000011920929 0.800000011920929 0.899999976158142 0.899999976158142 0.899999976158142
%AI9_Flatten: 1
%AI12_CMSettings: 00.MS
%%EndComments
endstream
endobj
11 0 obj
<</Length 39491>>stream
%AI24_ZStandard_Data(/ X,:'$D:\F7uwwS5
kj X nr[ -@
#@M`M4] 6__?3XӾ;\sAsyu{ڴ廍_6
QvEl6d{W8 -`veAZ@q;1evy-\5W6f6]{ԭ@|kǮ08se3eЦ[-8Λ[WQ%}Z|P$bK"n[F/3-Òa.q08]5ȳaw:Jْ%oOlInf*|lǶMfˏ\b.3݆ʼpcW;SLo^/6K xxQ>X>1?@±
|5#v/,9ueL@/6@8oQ7<s}CX=q]0Bwn]_G^oqx&kghxEߵF^o-gSu"$m _wn%w)wx&౺wl86!qH/zM)GîUeL{^S#E6vQGm)Lp 2d:+e< xCJLc6,^v!d< Ż-_Ssfc08"dBowߐeX/\(k+y۽j9)k6cW{3-@
oNM"BDCƲsع(:uAw|wej1ͺgYct%k|mt[6Z
uF#xݷxFH9YdˊXBG!,Iێe1.מᏑC䐺tyo؞?<٘C"/c鶮G>6ғђ!gm5k4e`-0כӳh8vߵpn-Wnֵh[_F59[A9a]e,<ďa-mm}o%kw6a[H$n8]-?[gͶu;JmhaPops6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