Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several improvement about supergroup and channel #61

Merged
merged 8 commits into from
Feb 23, 2016

Conversation

huiyiqun
Copy link
Contributor

Summary:
Adds Sender.channel_rename(...),
a Channel argument type,
and fixes for the related dict entries (fix_message and fix_peer).


Original Pull Request by @huiyiqun:
I have written a tg-based bot with your project.

In order to work with supergroup, I compiled the telegram-cli from the test branch and fix some problem of pytz. What's more, some missing features are added.

I'm glad if these code help.

@@ -41,12 +42,19 @@ def fix_message(message):


def fix_peer(peer):
# rename peer_type => type
if peer["peer_type"]:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To check for existence too, use

if "peer_type" in peer and peer["peer_type"]:

That above only checks the value of that attribute.
It will fail, if there is no "peer_type" key.

@luckydonald
Copy link
Owner

Wow, looking good.
Did you test that in python 2.7 and 3 (e.g. 3.4) ?

@@ -134,6 +134,7 @@
# functions["channel_set_admin"] = ("channel_set_admin", <channel> <admin> <type> Sets channel admin. 0 - not admin, 1 - moderator, 2 - editor
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can have a look at this old line here, while your on it.
I wonder why channel_set_admin is not implemented.

@huiyiqun
Copy link
Contributor Author

I test it in Python 3.5.1

@luckydonald
Copy link
Owner

Thanks!
Could you please test it a little in python 2 too?
I have no CLI set up at the moment.

Also don't miss my comment added above

@luckydonald
Copy link
Owner

I am gonna Merge this. In case something fails we should just open a new issue.

luckydonald added a commit that referenced this pull request Feb 23, 2016
Several improvements about supergroup and channel. Currently needs test branch.
Added new command: `channel_rename` to rename a channel  (CLI: `rename_channel`)
PR #61, Thanks @huiyiqun
@luckydonald luckydonald merged commit 85657b5 into luckydonald:master Feb 23, 2016
@@ -85,6 +85,12 @@ def parse(self, value):
return super(User, self).parse(value)


class Channel(Peer):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate of line 100...?

Will fix this.

@luckydonald
Copy link
Owner

And it is in Version 0.4.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants