jh0ker / mau_mau_bot Goto Github PK
View Code? Open in Web Editor NEWTelegram Bot that allows you to play Mau Mau (UNO) via inline queries
License: GNU Affero General Public License v3.0
Telegram Bot that allows you to play Mau Mau (UNO) via inline queries
License: GNU Affero General Public License v3.0
I just start this bot today and got this error
Traceback (most recent call last):
File "bot.py", line 32, in <module>
from results import (add_call_bluff, add_choose_color, add_draw, add_gameinfo,
File "D:\web-project\bbunobot\results.py", line 29, in <module>
from utils import display_color, display_color_group, display_name
File "D:\web-project\bbunobot\utils.py", line 26, in <module>
from internationalization import _, __
File "D:\web-project\bbunobot\internationalization.py", line 81, in <module>
_ = _Underscore()
File "D:\web-project\bbunobot\internationalization.py", line 43, in __init__
in available_locales.keys()
File "D:\web-project\bbunobot\internationalization.py", line 44, in <dictcomp>
if locale != 'en_US' # No translation file for en_US
TypeError: invalid file: None
I don't know what's it.
I saw that it is possible to call a bluff but there is no way to bluff so that option is useless.
This issue is to keep track of the development of an AI ("artificial intelligence") player.
A first, naive implementation is now live on the ismcts
branch. It is currently extremely badly integrated (I'll be working on a proper integration, please wait for that until you start contributing code, as this is also dependant on #6).
For testing purposes, you can already play against it using the /add_ai
command. To increase iterations, you can use the /set_ai <iterations>
command.
Right now, the AI is using a modified version of the "Monte Carlo Tree Search", which is called "Information Set Monte Carlo Tree Search" or short: ISMCTS
The current implementation is taken from http://www.aifactory.co.uk/newsletter/2013_01_reduce_burden.htm
It is basically a template to work with most (if not all) imperfect information games, I've simply added the rules of UNO.
Right now, the whole thing is very inefficient. It's written in pure python, so that's kinda obvious. To address this issue, I'd like to implement the algorithm in Cython (http://cython.org/), but I think there will have to be some other changes. Quite possibly this means rewriting big parts of the UNO logic in Cython. But the code needs a re-write anyways (again, see #6).
Another dimension to the efficiency is that I'd like to offer this service to all users of my bot instance. This means that even by improving this algorithm by say a factor of 1000 (which is not that unrealistic with Cython), it won't be all too helpful in reality. My initial tests showed little difference in the decision making for 10 to 1000 iterations, and 1000 iterations already take several seconds on my i7-powered laptop.
I have discussed this with a colleague, and his idea was to train some kind of neural network once, and then use the output of that network to determine the next card based on the circumstances. He said, once the network is trained, complexity to get the next move would be O(1) (or O(n), not sure wich)
I have access to rather powerful workstations at my university, so I could possibly use those to train the neural network with different settings of iterations. Of course I'd make the result publicly available.
I have limited knowledge when it comes to neural networks. I know how it works in theory, but my experience does not exceed playing around with http://playground.tensorflow.org/ I also know that there are similar techniques that actually have different names, I'm just grouping everything under "neural network" here.
To those who know more than me:
If a player starts and joins a game on a group and then the group becomes a supergroup the player cannot leave the game anymore
Hello,
Today I noticed a bug:
If you place a +4 card and leave the game, the "Bluff called!" cards go to another player.
(The person who played before the person, which left the game)
Clearly, the issue title is to be understood with a little bit of irony...
The code I have written for this bot is horrible. The reason is that in the beginning, this was merely a proof-of-concept and a fun-project.
Now that the bot is AGPL-Licensed, I'd like to get this thing ready to be understood by others:
Things to do:
The only help I'm asking from you right now is to point out more issues in the code :)
Just found this error
2016-09-02 18:04:49,538 - utils - ERROR - 'Bad Request: QUERY_ID_INVALID'
Traceback (most recent call last):
File "/home/lshaf/apps/bbunobot/utils.py", line 103, in answer_async
bot.answerInlineQuery(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 121, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/telegram/bot.py", line 821, in answerInlineQuery
result = request.post(url, data, timeout=kwargs.get('timeout'))
File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 235, in post
**urlopen_kwargs)
File "/usr/local/lib/python3.4/dist-packages/telegram/utils/request.py", line 180, in _request_wrapper
raise BadRequest(repr(message))
telegram.error.BadRequest: 'Bad Request: QUERY_ID_INVALID'
Hi Dev,
Is there any way to end the game even I didn't join the game?
I just got a problem when players on my group played without end it? they just let game session turned on and didn't play it. I can't do anything because they close the lobby.
I need command to end the game (only for creator and admin group).
seems we can have multiple session game in 1 group, is that bug or feature? because sometimes it's bugged. your code can't separate each session.
For example:
there's 4 player, call them A, B, C and D.
A - start and join
B - join
A - start and close
before A and B finish
C - start and join (new session)
D - join
C - start and close
and however, A want to open their lobby but they can't! the bot said "Only the game creator (C) can do that.". so how about session A?
Thanks 😄
As the title says, when the server goes down for a reboot (for whatever reason), we lose all progress in our active games.
Is this a configuration error on my end, a bug, or a feature that hasn't been implemented?
Since Telegram update 2.1.10, I cannot see the cards stickers in the inline query box. It is just empty spaces but clickable. It still works but I do not know what cards I am playing.
Hello. I have installed this awesome bot on my server, but I got a weird issue with it. The bot seems to work flawlessly, however, when a player chooses a card after starting the game, the game completely frozes and will not go further.
System specs:
Debian 8
Python 3.5.3
I have tried disabling privacy mode for the bot, with no luck.
Thanks.
EDIT: I got new error lines, seems to be timeout.
` File "/home/r33int/.local/lib/python3.5/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/home/r33int/.local/lib/python3.5/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request
exc_cls=ReadTimeoutError)
File "/home/r33int/.local/lib/python3.5/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout
raise exc_cls(*args)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=2.5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/r33int/Git/mau_mau_bot/utils.py", line 92, in send_async
bot.sendMessage(*args, **kwargs)
File "/home/r33int/.local/lib/python3.5/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/home/r33int/.local/lib/python3.5/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/home/r33int/.local/lib/python3.5/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/home/r33int/.local/lib/python3.5/site-packages/telegram/utils/request.py", line 192, in _request_wrapper
raise TimedOut()
telegram.error.TimedOut: Timed out
2018-03-02 23:09:19,728 - telegram.ext.updater - ERROR - Error while getting Updates: Timed out
2018-03-02 23:09:19,729 - utils - ERROR - Timed out
NoneType: None
2018-03-02 23:09:57,021 - actions - INFO - XemTV (@xemles) was skipped!.
2018-03-02 23:09:57,022 - actions - INFO - Started countdown for player: Enzo (@r33int). 100 seconds.`
relatet to error #69:
The Compile seems to be hardcoded?
It's been a while since the last compatibility update.
Could anyone help out?
https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-12.0
it gives error of this type:
\mau_mau_bot-master\internationalization.py", line 38, in
open(gettext.find(
TypeError: expected str, bytes or os.PathLike object, not NoneType
the code is:
def init(self):
self.translators = {
locale: gettext.GNUTranslations(
open(gettext.find(
GETTEXT_DOMAIN, GETTEXT_DIR, languages=[locale]
), 'rb')
)
for locale
in available_locales.keys()
if locale != 'en_US' # No translation file for en_US
}
self.locale_stack = list()
As Telegram accepts only 50 entries as answers to inline queries, the GUI stops showing up as soon as you have 49 cards: 49 cards + "draw card" + "?" means 51 answers, thus, the Telegram servers apparently completely discard the response.
I do however admit that it is impossible to trigger this accidentially.
This is with the fast gamemode.
"Last card: ⬛️Draw Four". Even black cards can't be used.
Bot does not respond in groups with topics. I created a topic for games in my group, but @unobot doesn't respond. Other game bots work correctly
It would be great if that was possible to happen! Thank you!
I don't think you should be able to re-join a game you've left, or re-join a game you've already won.
I was playing against someone who played a +4 Wild Card and was able to simply /leave and /join the game to give me a fresh hand and reset my card count to 7.
Additionally, I was playing with a friend who won a game (which makes you auto-leave it), and was then able to re-join the game and win a SECOND time. I think if you win a game you shouldn't be able to re-join the same game.
Ia good
How can I fix this error when I want to run the code python3 bot.py
Traceback (most recent call last):
File "bot.py", line 24, in <module>
from telegram import ParseMode, Message, Chat, InlineKeyboardMarkup, \
ImportError: No module named 'telegram'
Hi.
Today I started to get this error when 2 players have joined and one of us starts a game:
2016-11-25 16:44:15,895 - game - INFO - Playing card 💚5
2016-11-25 16:44:15,982 - telegram.ext.dispatcher - ERROR - run_async function raised exception
Traceback (most recent call last):
File "/home/xxx/uno/src/python-telegram-bot/telegram/ext/dispatcher.py", line 163, in _pooled
promise.run()
File "/home/xxx/uno/src/python-telegram-bot/telegram/utils/promise.py", line 36, in run
self._result = self.pooled_function(*self.args, **self.kwargs)
File "./bot.py", line 279, in send_first
timeout=TIMEOUT)
File "/home/xxx/uno/src/python-telegram-bot/telegram/bot.py", line 124, in decorator
result = func(self, *args, **kwargs)
File "/home/xxx/uno/src/python-telegram-bot/telegram/bot.py", line 150, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/home/xxx/uno/src/python-telegram-bot/telegram/utils/request.py", line 207, in post
**urlopen_kwargs)
File "/home/xxx/uno/src/python-telegram-bot/telegram/utils/request.py", line 152, in _request_wrapper
raise BadRequest(repr(message))
telegram.error.BadRequest: 'Bad Request: Wrong file identifier/HTTP URL specified'
I managed to start a game a few hours later, but after a while I got:
2016-11-25 16:42:21,085 - utils - ERROR - 'Bad Request: DOCUMENT_INVALID'
Traceback (most recent call last):
File "/home/xxx/uno/utils.py", line 103, in answer_async
bot.answerInlineQuery(*args, **kwargs)
File "/home/xxx/uno/src/python-telegram-bot/telegram/bot.py", line 124, in decorator
result = func(self, *args, **kwargs)
File "/home/xxx/uno/src/python-telegram-bot/telegram/bot.py", line 856, in answerInlineQuery
result = self._request.post(url, data, timeout=timeout)
File "/home/xxx/uno/src/python-telegram-bot/telegram/utils/request.py", line 207, in post
**urlopen_kwargs)
File "/home/xxx/uno/src/python-telegram-bot/telegram/utils/request.py", line 152, in _request_wrapper
raise BadRequest(repr(message))
Whats happening? The bot have been running for weeks, and the problem started today.
And @unobot won't start a game either.
i'm running docker compose file but when i build image that message appears, bot donst do nothing
Would it be feasible to have the bot remove it's associated messages from the history after a match is completed?
If that is possible and implemented, could The bot post a plaintext summary of the match including the number of opponents, who they were, the number of total turns taken, and the winner?
Today we were playing uno when it started to fail sometimes. The thing is that when we type bot's login then nothing happens and we don't see our cards.
We use latest version of Telegram on Nexus 5 and other Android.
Do you know anything about it?
Green 9 and Red 8 are not loading, it stays forever invisible for the ones who cleaned Telegram's cache and needed to load the pack again.
Current license is CC0, but with the bot gaining popularity, I'd prefer using AGPL and get a bit more serious.
Things to do
How about change the way of appending players to random in case of cheating?
For example, change players.append(player)
to players.insert(randrange(len(players) + 1), player)
.
I would like to send a patch.
[root@hno3 mau_mau_bot]# python3.4 bot.py
Traceback (most recent call last):
File "bot.py", line 31, in <module>
from results import (add_call_bluff, add_choose_color, add_draw, add_gameinfo,
File "/root/mau_mau_bot/results.py", line 29, in <module>
from utils import display_color, display_color_group, display_name
File "/root/mau_mau_bot/utils.py", line 25, in <module>
from internationalization import _, __
File "/root/mau_mau_bot/internationalization.py", line 27, in <module>
from shared_vars import gm
File "/root/mau_mau_bot/shared_vars.py", line 22, in <module>
from telegram.contrib.botan import Botan
ImportError: No module named 'telegram.contrib'
my system is centos6.9,installed python3.4.
and what is botan,how can i install it?
Thanks in advance.
@jh0ker
I found a error when I'd have only two cards: a DRAW_FOUR and a RED SKIP card.
The current card in game was a YELLOW 4. I threw the DRAW_FOUR, and then I chose the color red. After that, the next player called a bluff. I received 4 cards.
Ao tentar iniciar o bot retorna esses erros...
root@UnoBot:~/UnoBot# python bot.py
/root/UnoBot/telegram/emoji.py:37: UserWarning: telegram.Emoji is being deprecated, please see https://git.io/v6DeB
warnings.warn("telegram.Emoji is being deprecated, please see https://git.io/v6DeB")
Traceback (most recent call last):
File "bot.py", line 32, in
from results import (add_call_bluff, add_choose_color, add_draw, add_gameinfo,
File "/root/UnoBot/results.py", line 29, in
from utils import display_color, display_color_group, display_name
File "/root/UnoBot/utils.py", line 26, in
from internationalization import _, __
File "/root/UnoBot/internationalization.py", line 24, in
from locales import available_locales
File "/root/UnoBot/locales/init.py", line 21, in
from .available import available_locales
File "/root/UnoBot/locales/available.py", line 30, in
available_locales = {'en_US': flag('US') + ' English (US)',
File "/root/UnoBot/locales/available.py", line 27, in flag
return chr(ord(code[0]) + OFFSET) + chr(ord(code[1]) + OFFSET)
ValueError: chr() arg not in range(256)
Alguém me ajuda a resolver pf
Hello, I would like to share some feedback with you:
• "Sanic" mode should be "Sonic" mode?
• It would be nice to be able to configure the Sonic mode (ex. /setsonictime 30-20-10 (s))
• Same for the group language (ex. /setgrouplang)
• Modes list is "cutted" (🎻 Classic mo...)
It would also be nice a pic or icon for each mode in the square preview.
Thanks in advance
[root@kant mau_mau_bot]# python3 bot.py /usr/local/lib/python3.5/site-packages/telegram/emoji.py:37: UserWarning: telegram.Emoji is being deprecated, please see https://git.io/v6DeB warnings.warn("telegram.Emoji is being deprecated, please see https://git.io/v6DeB") /usr/local/lib/python3.5/site-packages/telegram/emoji.py:37: UserWarning: telegram.Emoji is being deprecated, please see https://git.io/v6DeB warnings.warn("telegram.Emoji is being deprecated, please see https://git.io/v6DeB") /usr/local/lib/python3.5/site-packages/telegram/ext/messagehandler.py:88: UserWarning: Using a list of filters in MessageHandler is getting deprecated, please use bitwise operators (& and |) instead. More info: https://git.io/vPTbc. warnings.warn('Using a list of filters in MessageHandler is getting ' &
i think maybe need update? but how to update or need u update?
@jh0ker
I do not quite understand what role admin_list, and how to edit
Thanks in advance
@jh0ker
There is an ongoing bug which fails to check if a card can be sent and as a consequence doesn't record the play, doesn't update the hand, etc. and leads to timeout skipping to the next player, allowing the sticker to be sent to the group but not removing the card from the hand and not finishing the current play.
Trace:
2021-11-09 11:42:02,292 - utils - ERROR - Message text is empty
Traceback (most recent call last):
File "/home/iuri/git/iuriguilherme/mau_mau_bot/utils.py", line 92, in send_async
bot.sendMessage(*args, **kwargs)
File "/home/iuri/.local/share/virtualenvs/mau_mau_bot-hie6xpcQ/lib/python3.7/site-packages/telegram/bot.py", line 57, in decorator
result = func(self, *args, **kwargs)
File "/home/iuri/.local/share/virtualenvs/mau_mau_bot-hie6xpcQ/lib/python3.7/site-packages/telegram/bot.py", line 82, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/home/iuri/.local/share/virtualenvs/mau_mau_bot-hie6xpcQ/lib/python3.7/site-packages/telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "/home/iuri/.local/share/virtualenvs/mau_mau_bot-hie6xpcQ/lib/python3.7/site-packages/telegram/utils/request.py", line 210, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Message text is empty
The cards only shows if I leave the chat screen and go back to uno group. When I stays in chat and my turn comes the cards don't loads until I leave the chat screen ( http://checker.in/go/2435344 )
When a game ends with a reverse card, the stats are not updated (except for the number of cards played). This happened two times in a 1vs1, but also probably in largest games.
Another problem concern the permission to change mode, kill the game, open and close the lobby when the mode is changed to wild or fast. In that cases everyone can do it, even if they aren't game creators or admins.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.