GithubHelp home page GithubHelp logo

eriknyquist / nedry Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 3.0 1.26 MB

Nedry is a fun & useful discord bot with a modular plugin system (formerly "twitch_monitor_discord_bot")

License: Apache License 2.0

Python 100.00%
discord discord-bot twitch twitch-api bots python3 python-3 python discord-bots twitch-api-helix

nedry's Issues

Invalid twitch streamer:

Windows Python 3.10
Debian 11 Python 3.9

When run command @bot !addstreamers streamer always - get error: Invalid twitch streamer:
If add streamer to config file, get error:
Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/olo/.local/lib/python3.9/site-packages/twitch_monitor_discord_bot/__main__.py", line 112, in <module> main() File "/home/olo/.local/lib/python3.9/site-packages/twitch_monitor_discord_bot/__main__.py", line 93, in main monitor = TwitchMonitor(config.twitch_clientid, config.streamers) File "/home/olo/.local/lib/python3.9/site-packages/twitch_monitor_discord_bot/twitch_monitor.py", line 36, in __init__ self._update_users() File "/home/olo/.local/lib/python3.9/site-packages/twitch_monitor_discord_bot/twitch_monitor.py", line 39, in _update_users self.users = self.translate_usernames(self.usernames) File "/home/olo/.local/lib/python3.9/site-packages/twitch_monitor_discord_bot/twitch_monitor.py", line 88, in translate_usernames users.extend(self.client.users.translate_usernames_to_ids(req)) File "/home/olo/.local/lib/python3.9/site-packages/twitch/api/users.py", line 129, in translate_usernames_to_ids response = self._request_get("users?login={}".format(usernames)) File "/home/olo/.local/lib/python3.9/site-packages/twitch/api/base.py", line 53, in _request_get response.raise_for_status() File "/home/olo/.local/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.twitch.tv/kraken/users?login=streamer_name_example

default_bot_config.json not written on fresh install since nedry==2.2.0

Really as simple as it is described. When installing Nedry from pypi, I can only get the default_bot_config.json to appear when using the first version available, 2.1.0. On subsequent versions Created default config file 'default_bot_config.json', please add required parameters is output but there is no file to be found. Debian/Ubuntu as platform with deadsnakes python3.9 and default python3-pip package.

Twitch streamer annoucenemts stop working sometimes

This is not the full trace but should be enough. Restarting Nedry fixes this issue. I guess some error would need to be catched?

Twitch userids changed to 00000000

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 353, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f8e41f26490>: Failed to establish a new connection: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.twitch.tv', port=443): Max retries exceeded with url: /helix/streams?user_id=00000000 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8e41f26490>: Failed to establish a new connection: [Errno 110] Connection timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 156, in _streamer_check_loop
    self._check_streamers_retry()
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 131, in _check_streamers_retry
    self._check_streamers()
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 91, in _check_streamers
    channels = self.read_all_streamer_info()
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 196, in read_all_streamer_info
    all_info = [self._read_streamer_info(u) for u in self.usernames]
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 196, in <listcomp>
    all_info = [self._read_streamer_info(u) for u in self.usernames]
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 186, in _read_streamer_info
    return TwitchChannel(user, username)
  File "/usr/local/lib/python3.9/dist-packages/nedry/twitch_monitor.py", line 34, in __init__
    self.is_live = False if user is None else user.is_live
  File "/home/csgo/.local/lib/python3.9/site-packages/twitch/helix/models/user.py", line 39, in is_live
    if self.stream:
  File "/home/csgo/.local/lib/python3.9/site-packages/twitch/helix/models/user.py", line 34, in stream
    return helix.Streams(api=self._api, user_id=int(self.id))[0]
  File "/home/csgo/.local/lib/python3.9/site-packages/twitch/helix/resources/streams.py", line 17, in __init__
    response: dict = self._api.get(self._path, params=kwargs)
  File "/home/csgo/.local/lib/python3.9/site-packages/twitch/api.py", line 111, in get
    return self.request('GET', path, ignore_cache, params=params, headers=self._headers(headers), **kwargs)
  File "/home/csgo/.local/lib/python3.9/site-packages/twitch/api.py", line 90, in request
    response = requests.Session().send(request)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.twitch.tv', port=443): Max retries exceeded with url: /helix/streams?user_id=00000000 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8e41f26490>: Failed to establish a new connection: [Errno 110] Connection timed out'))


Feature request: Clip/vod search

I'm requesting a feature where the bot would search for new clips made of the same Twitch streamers being monitored with some longer interval like 10 minutes, or maybe even a few hours.

clearallstreamers AttributeError: 'BotConfigManager' object has no attribute 'confing'

config.confing.streamers_to_monitor.clear()

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/nedry/discord_bot.py", line 110, in on_message
    resp = self.on_mention(message)
  File "/usr/local/lib/python3.9/dist-packages/nedry/discord_bot.py", line 294, in on_mention
    events.emit(EventType.BOT_COMMAND_RECEIVED, message, msg)
  File "/usr/local/lib/python3.9/dist-packages/nedry/events.py", line 96, in emit
    _events[event_type].emit(*event_args, **event_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/nedry/events.py", line 49, in emit
    stop_processing_events = handler(*event_args, **event_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/nedry/discord_bot.py", line 276, in _on_bot_command_received
    resp = self.cmdprocessor.process_command(discord_message.channel, discord_message.author, cmd_msg)
  File "/usr/local/lib/python3.9/dist-packages/nedry/command_processor.py", line 492, in process_command
    return handler(command, argtext, msg_data, self, self.config, self.twitch_monitor)
  File "/usr/local/lib/python3.9/dist-packages/nedry/command_processor.py", line 637, in cmd_clearallstreamers
    config.confing.streamers_to_monitor.clear()
AttributeError: 'BotConfigManager' object has no attribute 'confing'

AttributeError: 'list' object has no attribute 'get'

Unexpectedly I started getting this error after restarting nedry. Didn't change anything in config.. Just added a couple Twitch nicknames, but I don't think it is related to those. Removing social_credit from enable_plugins and plugin_data makes Nedry run again.

csgo@csgo2:~$ cd ~ && python3 -m nedry default_bot_config.json
[2023-04-28 21:18:50,154][INFO][__init__:12]: nedry 2.4.2
[2023-04-28 21:18:50,474][DEBUG][twitch_monitor:70]: Connecting to Twitch
[2023-04-28 21:19:03,455][INFO][twitch_monitor:80]: Connected to twitch
[2023-04-28 21:19:03,456][DEBUG][twitch_monitor:85]: Started twitch monitor thread
[2023-04-28 21:19:03,468][WARNING][client:257]: PyNaCl is not installed, voice will NOT be supported
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin knock_knock_jokes 1.0.0
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin wiki 1.0.0
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin mock 1.0.0
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin schedule 1.2.0
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin trivia 1.0.0
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin stories 1.0.0
[2023-04-28 21:19:03,469][INFO][plugin:72]: loaded plugin social_credit 1.0.0
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/csgo/.local/lib/python3.9/site-packages/nedry/__main__.py", line 108, in <module>
    main()
  File "/home/csgo/.local/lib/python3.9/site-packages/nedry/__main__.py", line 88, in main
    plugin_manager.startup_plugins()
  File "/home/csgo/.local/lib/python3.9/site-packages/nedry/plugin.py", line 191, in startup_plugins
    plugin = self._plugin_modules[n].startup()
  File "/home/csgo/.local/lib/python3.9/site-packages/nedry/builtin_plugins/social_credit.py", line 175, in startup
    Serializer(config).from_dict(config_data)
  File "/home/csgo/.local/lib/python3.9/site-packages/versionedobj/serializer.py", line 142, in from_dict
    migration_result, attrs = obj._vobj__migrate(version, attrs)
  File "/home/csgo/.local/lib/python3.9/site-packages/versionedobj/object.py", line 199, in _vobj__migrate
    old_version = attrs.get('version', None)
AttributeError: 'list' object has no attribute 'get'

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.