hangoutsbot / hangoutsbot

Google Hangouts bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about Hangouts Bot and Hangups

gan-h opened this issue · comments

Hello, I downloaded Hangouts Bot today, and I'm very excited to see it working. Is there any way to add or remove users from the chat using Hangouts Bot though?

Thanks,
Winterpenguins

Take a look at PR #911. It adds the functionality for bot to do real kick. You would have to merge that and create a plug-in that uses the shared plug-in hook.

Thanks for the quick reply. What about the functionality to add users, and how would one see who joined or kicked?

I read on Hangups, that people could see who created a membership change event. Is there some kind of command that does this in Hangouts Bot?

Thanks,
Winterpenguins

Take a look at the adduser command in plugins/convtools.py. That will help for adding users. To see who was added, take a look at plugins/restrictedadd.py for how to add a listener for add/remove

Thank you. Your replies have been very helpful for me 👍. There is now another issue :(
As I was looking through restrictedadd, I noticed that lines of code like these:
if event.conv_event.type_ == hangups.MembershipChangeType.JOIN:
(The bolded part)
Come up with errors similar to: [pylint] E1101:Module 'hangups' has no 'MembershipChangeType',
I don't know what is wrong. I have the hangups module installed and everything. Am I missing something obvious here?

Thanks,
Winterpenguins

P.S. hangups is imported

Are you on v3 (v3.0 branch) or v2 (master)? The latter uses an outdated fork of hangups without a lot of the protobuf enum classes, whereas the former uses upstream. Sounds like you may have an inconsistent setup.

I'm using v3.0 branch. I just reinstalled everything for hangouts bot along the site packages to make sure. I'm also not sure what you mean by inconsistent setup...? I'm using v3.0 so I should be using hangups 0.4.4 right? Anyhow, the problems previously mentioned still persist, and I'm just stumped on this issue.

Here are some more details about this:

Doing /bot version prints:
Bot Version: 3.0.0-beta
Python Version: 3.6.5

  • aiohttp 2.3.10
  • appdirs 1.4.3
  • emoji 0.5.0
  • hangups 0.4.4
  • telepot 12.7

Common problems are still there:
Hangups did not have that member. There are also other errors that I did not mention such as, an undefined variable error regarding "" in lines of code such as
raise ValueError(**
**("conversation {} not found").format(source_conv))
(The bolded part is making the error)

I am also unable to import plugins and commands, along with many other things.
(import plugins)
(from commands import command)

[pylint] E0611:No name 'HangupsBotExceptions' in module 'exceptions'
Caused by from exceptions import HangupsBotExceptions

[pylint] E0611:No name 'simple_parse_to_segments' in module 'utils'
[pylint] E0611:No name 'class_from_name' in module 'utils'
Caused by from utils import simple_parse_to_segments, class_from_name

There are actually more than I can list regarding things not being able to be imported. In hangoutsbot, there are many problems being reported about imported files, but you can still run the whole file, and have it be functional.

you can still run the whole file, and have it be functional

Right, so there's no actual errors at runtime, just during linting? I suspect pylint's results aren't going to be accurate due to mangling of sys.modules in a few places (references to hangups are replaced with hangups_shim for backwards compatibility).