Skip to content

Commit 847fea1

Browse files
author
Pietro Albini
committed
Merge branch 'bugfixes-0.1.1'
Conflicts: docs/changelog.rst
2 parents a8d632d + 85deb48 commit 847fea1

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

botogram/defaults.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"""
88

99
from . import utils
10-
from . import objects
1110
from . import components
1211
from . import decorators
1312

@@ -142,7 +141,7 @@ def no_commands_hook(self, bot, chat, message):
142141
username = bot.itself.username
143142

144143
mentioned = splitted[0] == "/%s@%s" % (command, username)
145-
single_user = isinstance(chat, objects.User)
144+
single_user = chat.type == "private"
146145
if mentioned or single_user:
147146
chat.send("\n".join([
148147
bot._("Unknown command: /%(name)s", name=command),

botogram/syntaxes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99
import re
1010

1111

12-
_markdown_re = re.compile(r"("
12+
_markdown_re = re.compile(r".*("
1313
r"\*(.*)\*|"
1414
r"_(.*)_|"
1515
r"\[(.*)\]\((.*)\)|"
1616
r"`(.*)`|"
1717
r"```(.*)```"
18-
r")")
18+
r").*")
1919

20-
_html_re = re.compile(r"("
20+
_html_re = re.compile(r".*("
2121
r"<b>(.*)<\/b>|"
2222
r"<strong>(.*)<\/strong>|"
2323
r"<i>(.*)<\/i>|"
2424
r"<em>(.*)<\/em>|"
2525
r"<a\shref=\"(.*)\">(.*)<\/a>|"
2626
r"<code>(.*)<\/code>|"
2727
r"<pre>(.*)<\/pre>"
28-
r")")
28+
r").*")
2929

3030

3131
def is_markdown(message):

docs/changelog.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@ Here you can see what changed in every botogram release.
1414
botogram 0.2
1515
=============
1616

17-
*Alpha release, not released yet!*
17+
*Alpha release, not yet released*
1818

1919
No changes yet.
2020

21+
.. _changelog-0.1.1:
22+
23+
botogram 0.1.1
24+
==============
25+
26+
*Bugfix release, not yet released*
27+
28+
* Fix automatic syntax detector not working sometimes (`issue 26`_)
29+
* Fix "unknown command" message not showing up in private chats (`issue 25`_)
30+
31+
.. _issue 25: https://github.com/pietroalbini/botogram/issues/25
32+
.. _issue 26: https://github.com/pietroalbini/botogram/issues/26
33+
2134
.. _changelog-0.1:
2235

2336
botogram 0.1

tests/test_syntaxes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ def test_is_markdown():
1616

1717
for delimiter in "*", "_", "`", "```":
1818
assert botogram.syntaxes.is_markdown(delimiter+"a"+delimiter)
19+
assert botogram.syntaxes.is_markdown("!"+delimiter+"a"+delimiter+"!")
1920

2021
assert botogram.syntaxes.is_markdown("[a](b)")
22+
assert botogram.syntaxes.is_markdown("![a](b)!")
2123

2224

2325
def test_is_html():
@@ -26,10 +28,12 @@ def test_is_html():
2628

2729
for tag in "b", "strong", "i", "em", "pre", "code":
2830
assert botogram.syntaxes.is_html("<"+tag+">a</"+tag+">")
31+
assert botogram.syntaxes.is_html("!<"+tag+">a</"+tag+">!")
2932

3033
assert not botogram.syntaxes.is_html("<a>a</a>")
3134
assert not botogram.syntaxes.is_html("<a test=\"b\">a</a>")
3235
assert botogram.syntaxes.is_html("<a href=\"b\">a</a>")
36+
assert botogram.syntaxes.is_html("!<a href=\"b\">a</a>!")
3337

3438

3539
def test_guess_syntax():

0 commit comments

Comments
 (0)