Git Product home page Git Product logo

pythontwitchbotframework's Issues

time stamp parsing for get_user_creation_date is off by 1-2 minutes

some how, you and phantombot get different account creation dates... haha
theplanetarian ➠ djbeyondearth with 1554 followers and 21491 views ◆ created at 22/04/2018 03:55:49
theplanetarian ➠ Twitch :black_medium_square: DjBeyondEarth with 1554 followers and 21491 views ◆ Created at 21/04/2018 20:55:49.
the top is you
the bottom is phantombot

!s crash the bot

Hello!

I got this working in raspberry pi but when i use default !s command in any other than admin account it crashes whole bot. So anyone can crash it. Below the errors it gets. Same happens in windows machine.

Traceback (most recent call last):
File "test.py", line 46, in
AddstarBot().run()
File "/home/pi/.local/lib/python3.7/site-packages/twitchbot/bots/basebot.py", line 299, in run
get_event_loop().run_until_complete(self.mainloop())
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/pi/.local/lib/python3.7/site-packages/twitchbot/bots/basebot.py", line 326, in mainloop
msg = Message(raw_msg, irc=self.irc, bot=self)
File "/home/pi/.local/lib/python3.7/site-packages/twitchbot/message.py", line 40, in init
self._parse()
File "/home/pi/.local/lib/python3.7/site-packages/twitchbot/message.py", line 83, in _parse
or self._parse_notice()
File "/home/pi/.local/lib/python3.7/site-packages/twitchbot/message.py", line 186, in _parse_notice
self.channel = channels[m['channel']]

To my use i only need info when someone donate bits , follows and subs channel. Is this right tool to use and does it get "real" bits donated or can viewers do fake donations.

Cheers!

Class PubSubBits missing from __init__.py

To import this class, I currently need to use

from twitchbot.pubsub.bits_model import PubSubBits

PubSubBits should be in the init.py file so it can be imported with

from twitchbot import PubSubBits

Missing files in sdist

It appears that the manifest is missing at least one file necessary to build
from the sdist for version 1.11.4. You're in good company, about 5% of other
projects updated in the last year are also missing files.

+ /tmp/venv/bin/pip3 wheel --no-binary pythontwitchbotframework -w /tmp/ext pythontwitchbotframework==1.11.4
Looking in indexes: http://10.10.0.139:9191/root/pypi/+simple/
Collecting pythontwitchbotframework==1.11.4
  Downloading http://10.10.0.139:9191/root/pypi/%2Bf/f8d/907c12a15a924/PythonTwitchBotFramework-1.11.4.tar.gz (56 kB)
    ERROR: Command errored out with exit status 1:
     command: /tmp/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-oei7st_8/pythontwitchbotframework/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-oei7st_8/pythontwitchbotframework/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-wheel-oei7st_8/pythontwitchbotframework/pip-egg-info
         cwd: /tmp/pip-wheel-oei7st_8/pythontwitchbotframework/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-wheel-oei7st_8/pythontwitchbotframework/setup.py", line 3, in <module>
        with open('requirements.txt') as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Whisper reply not working

I'm not able to get the bot reply to whisper. Message type is WHISPER and the bot act as it has replied via whisper, but nothing appears on the private chat on twitch. Am I missing something?

Function get_user_followers() does not work as expected due to API limitations

Hello,
as implemented right now, the function simply does not work as expected.

The function get_user_followers defined here does not return all followers.
According to the API documentation only 20 entries (default) but at maximum 100 entries are returned.

Possible Solutions:

  • Enhance the function to download all pages and collect all followers. BUT: In channels with many followers, the download of the complete list is not even useful. This could consum a huge amount of memory.
  • Remove the follower list and only grab the statistical data like for example number of followers. Add a function which enables the bot owner to download the information specific to a user. Done in the pull request here

Maybe someone has a better solution.

!duel game broken

The !duel game is quite broken.

1) First off, there is no balance checking at all, so you can duel somebody with any currency amount: !duel someone 9999999

2) Secondly, the winner doesn't seem to actually get the currency winnings at all. Running !bal after winning results in the same amount you had prior to the duel.

Solution: The issue is with the logic in Line 402 in currency_commands.py: loser = msg.author if winner == msg.author else challenger results in setting both the winner and loser to the same person. The line should instead be loser = msg.author if winner != msg.author else challenger

Turbo is a deprecated flag

Probably should be removed from tags as twitch will eventually drop it. Apparently the value will be stored in the badges instead.

add reverse permissions (removes permission to do something)

idea is to add a negating permission, for ex, globally everyone has the permission "eat".
but you want a group that that does not include that permission.
to acheive this, i propose adding a - negating permission, ex: -eat, this permission will REMOVE that permission for members of that group.
even if they are in other groups that have "eat" permission in it

Various bugs in the Command Console

Platform: Linux
Python 3.10

When using command_console.py, I've ran into a few different bugs:

1) Sometimes when using either /chat or /sendmsg, there is an exception: "TypeError: catching classes that do not inherit from Exception is not allowed" in command_console.py line 25

Solution: It should be except (json.JSONDecodeError, TypeError):

2) Everytime I use either /chat or /sendmsg, within about 1 minute there is an exception in the main bot script:

websockets.exceptions.ConnectionClosedError: sent 1011 (unexpected error) keepalive ping timeout; no close frame received

Subsequent /chat or /sendmsg commands then result in another exception in command_console.py:

websockets.exceptions.ConnectionClosedError: no close frame received or sent.

EDIT: Setting ping_interval=None on both the websocket server/client seems to fix this. Probably an okay solution if you're only running/connecting to the command console on the same localhost machine.

3) When I try to use /sendcmd !subbal username 5000 through the command console, it tells me I don't have enough points to subtract from. However I gave the username 50000 points to test with. When I do !subbal username 5000 directly in the chat, it works just fine. When going through the command console though, it's not retrieving the right amount of points. Is this a caching issue?

EDIT: It's actually not an issue with the Command Console. It appears to be getting the balance of the bot itself, and not the specified username. The if get_balance_from_msg(msg).balance < amount: check on line 134 in currency_commands.py checks against the author of the message, and not the target. The if get_balance_from_msg(msg).balance < amount: should probably also be moved into the else clause that follows to allow the "all" to be handled correctly.

And when using something like !subbal all 1000000 will result in negative balance. Not sure if that's intended or if it should have a floor of 0 and not go into the negatives.

Command cooldown

Command cooldowns per channel with custom bypass that can be specified per command

errors

Hello, i have error for version 2.10.0
py ver 3.6.6:

C:\Windows\system32>pip install git+https://github.com/sharkbound/PythonTwitchBo
tFramework.git@master
Collecting git+https://github.com/sharkbound/PythonTwitchBotFramework.git@master

  Cloning https://github.com/sharkbound/PythonTwitchBotFramework.git (to revisio
n master) to c:\users\lukin\appdata\local\temp\pip-req-build-lpino_vm
  Running command git clone -q https://github.com/sharkbound/PythonTwitchBotFram
ework.git 'C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm'
  Resolved https://github.com/sharkbound/PythonTwitchBotFramework.git to commit
d90c0003d5d2f01122e66f6e7ec2366a3d05e4fd
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\lukin\AppData\Local\Programs\Python\Python36\python.exe' -
c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lukin
\\AppData\\Local\\Temp\\pip-req-build-lpino_vm\\setup.py'"'"'; __file__='"'"'C:\
\Users\\lukin\\AppData\\Local\\Temp\\pip-req-build-lpino_vm\\setup.py'"'"';f = g
etattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) els
e io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().r
eplace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"
'exec'"'"'))' egg_info --egg-base 'C:\Users\lukin\AppData\Local\Temp\pip-pip-egg
-info-3fso1aeu'
       cwd: C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\
  Complete output (22 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\setup.py", li
ne 2, in <module>
      from twitchbot import BOT_VERSION
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\__i
nit__.py", line 6, in <module>
      from .arena import *
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\are
na.py", line 5, in <module>
      from twitchbot.channel import Channel
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\cha
nnel.py", line 9, in <module>
      from .api import StreamInfoApi
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\api
\__init__.py", line 1, in <module>
      from .streaminfoapi import *
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\api
\streaminfoapi.py", line 4, in <module>
      from .baseapi import Api
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\api
\baseapi.py", line 2, in <module>
      from .. import util
    File "C:\Users\lukin\AppData\Local\Temp\pip-req-build-lpino_vm\twitchbot\uti
l\__init__.py", line 2, in <module>
      from .twitch_api_util import *
    File "<fstring>", line 1
      (await resp.text("utf-8"))
                ^
  SyntaxError: invalid syntax
  ----------------------------------------
WARNING: Discarding git+https://github.com/sharkbound/PythonTwitchBotFramework.g
it@master. Command errored out with exit status 1: python setup.py egg_info Chec
k the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check th
e logs for full command output.

If I download repo from pypi.org, I have this error at runtime with code :

from twitchbot import BaseBot

if __name__ == '__main__':
    BaseBot().run()

in ide:
invalid syntax (<fstring>, line 1)

in py console:


Traceback (most recent call last):
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\ptvsd_launcher.py", line 119, in <module>
    vspd.debug(filename, port_num, debug_id, debug_options, run_as)
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\debugger.py", line 37, in deb
ug
    run(address, filename, *args, **kwargs)
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\_local.py", line 64, in run_f
ile
    run(argv, addr, **kwargs)
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\_local.py", line 125, in _run

    _pydevd.main()
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\_vendored\pydevd\pydevd.py",
line 1752, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\_vendored\pydevd\pydevd.py",
line 1099, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, loc
als)
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\_vendored\pydevd\pydevd.py",
line 1106, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "c:\program files (x86)\microsoft visual studio\2017\enterprise\common7\i
de\extensions\microsoft\python\core\Packages\ptvsd\_vendored\pydevd\_pydev_imps\
_pydev_execfile.py", line 25, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\lukin\source\repos\PythonApplication4\PythonApplication4\Python
Application4.py", line 1, in <module>
    from twitchbot import BaseBot
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\__init__.py", line 6, in <module>
    from .arena import *
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\arena.py", line 5, in <module>
    from twitchbot.channel import Channel
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\channel.py", line 9, in <module>
    from .api import StreamInfoApi
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\api\__init__.py", line 1, in <module>
    from .streaminfoapi import *
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\api\streaminfoapi.py", line 4, in <module>
    from .baseapi import Api
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\api\baseapi.py", line 2, in <module>
    from .. import util
  File "C:\Users\lukin\AppData\Local\Programs\Python\Python36\lib\site-packages\
twitchbot\util\__init__.py", line 2, in <module>
    from .twitch_api_util import *
  File "<fstring>", line 1
    (await resp.text("utf-8"))
              ^
SyntaxError: invalid syntax
Press any key to continue . . .

Supporting additional data for subscriptions

I don't have support for this yet but it would be kinda nice to see the other data for subscriptions to be implemented.

Like:

msg-param-cumulative-months and msg-param-months

msg-param-sub-plan (this one's weird because it's numbers unless its Prime, so maybe just explicitly check value and if Prime set to 0)

reply waiter mod raises InvalidStateError at times

stacktrace

error has occurred while triggering a event on a mod, details:
mod: replywaiter
event: Event.on_raw_message
error: <class 'asyncio.exceptions.InvalidStateError'>
reason: invalid state
stack trace:
Traceback (most recent call last):
  File "C:\Users\cvang\Desktop\PythonTwitchBotFramework-master\twitchbot\modloader.py", line 284, in trigger_mod_event
    output.append(await getattr(mod, event.value, _missing_function)(*args))
  File "C:\Users\cvang\Desktop\PythonTwitchBotFramework-master\twitchbot\builtin_mods\reply_waiter_mod.py", line 15, in on_raw_message
    future.set_result(msg)
asyncio.exceptions.InvalidStateError: invalid state

Overriding Events not working properly. Duplicate print in console.

Hi, when I run this

from twitchbot import BaseBot, Message
class MyCustomTwitchBot(BaseBot):
    async def on_privmsg_received(self, msg: Message):
        print(f'{msg.author} sent message {msg.content} to channel {msg.channel_name}')

if __name__ == '__main__':
    MyCustomTwitchBot().run()

console give me a duplicate messages like this

mdsubuntu(mdsubuntu): not working
mdsubuntu sent message not working to channel mdsubuntu

please give me a proper method to print only one message. thank you so much!

kraken api defunct

Hi,

Not sure if this project is still being maintained, but the kraken API has been decommissioned a few months ago so "get_user_creation_date" will no longer work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.