Shuhala / tournament-discord-bot

Discord Bot to manage Toornament tournaments (particularly for Fortnite!)
2 stars 3 forks source link

TypeError: __new__() got an unexpected keyword argument 'deny_new' #1

Closed mattiasclaesson closed 4 years ago

mattiasclaesson commented 4 years ago

I got the following error just by starting the bot.

2020-09-09 20:20:12,013 ERROR    errbot.backends.base      Exception occurred in serve_once: Traceback (most recent call last):   File "/usr/local/lib/python3.7/site-packages/errbot/backends/base.py", line 699, in serve_forever     if self.serve_once():   File "backends/discord/discord.py", line 739, in serve_once     DiscordBackend.client.start(self.token)   File "/usr/local/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete     return future.result()   File "/usr/local/lib/python3.7/site-packages/discord/client.py", line 585, in start     await self.connect(reconnect=reconnect)   File "/usr/local/lib/python3.7/site-packages/discord/client.py", line 499, in connect     await self._connect()   File "/usr/local/lib/python3.7/site-packages/discord/client.py", line 463, in _connect     await self.ws.poll_event()   File "/usr/local/lib/python3.7/site-packages/discord/gateway.py", line 471, in poll_event     await self.received_message(msg)   File "/usr/local/lib/python3.7/site-packages/discord/gateway.py", line 425, in received_message     func(data)   File "/usr/local/lib/python3.7/site-packages/discord/state.py", line 750, in parse_guild_create     guild = self._get_create_guild(data)   File "/usr/local/lib/python3.7/site-packages/discord/state.py", line 725, in _get_create_guild     guild._from_data(data)   File "/usr/local/lib/python3.7/site-packages/discord/guild.py", line 290, in _from_data     self._sync(guild)   File "/usr/local/lib/python3.7/site-packages/discord/guild.py", line 321, in _sync     self._add_channel(CategoryChannel(guild=self, data=c, state=self._state))   File "/usr/local/lib/python3.7/site-packages/discord/channel.py", line 726, in init     self._update(guild, data)   File "/usr/local/lib/python3.7/site-packages/discord/channel.py", line 737, in _update     self._fill_overwrites(data)   File "/usr/local/lib/python3.7/site-packages/discord/abc.py", line 294, in _fill_overwrites     self._overwrites.append(_Overwrites(id=overridden_id, **overridden)) TypeError: new() got an unexpected keyword argument 'deny_new'

As far as I understand there has been changes made to the discord api, and since we are on 1.3.1 its too old work anymore. It seem to be desribed here: https://stackoverflow.com/questions/63027848/discord-py-glitch-or-random-error-typeerror-new-got-an-unexpected-keywor

I did get it to work with discord.py 1.4.1,with no obvious side effects (to me atleast).

Do you want me to make a PR with the version change?

Shuhala commented 4 years ago

Hi Mattias,

You can create a PR that I will review, otherwise I will probably take a look at it this week and fix it. Thanks for reporting this error! :)

mattiasclaesson commented 4 years ago

Hi,

Yes I got the docker stuff to run. I had some issues getting the correct version of python, poetry, and pip installed. I used the PyCharm IDE.

I was not aware that you did modify discord.py, maybe its easier for you to upgrade it then. Maybe do that PR to get it into the main version if possible.

I do not think I will aim for the exact same use case as you developed. Our small tournament is a solo participant operation. After some minor code tweaks its possible to query information about that type of tournament also.

The usecases I plan to add is for the kids to be able to lookup their pending matches, just list the match info with opponent name. Maybe add score reporting on a match. Could be cool for the bot to detect and notify when two players with a pending match both are online.

I sort of miss a general overview of how your functionality is intended to work. I can read the code, and did find the command documentation. Could you describe it briefly please?

I have managed to add our existing tournament to the bot. So its possible to show info about the tournament. Whats the next step, link captains/teams to matches?

/Mattias

Den sön 13 sep. 2020 kl 22:37 skrev Sophie Bernadin-Mercier < notifications@github.com>:

Hi Mattias,

You can create a PR that I will review, otherwise I will probably take a look at it this week and fix it. Thanks for reporting this error! :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Shuhala/tournament-discord-bot/issues/1#issuecomment-691722046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFQBCYQHZQT37WKC6TB7WLSFUUQ5ANCNFSM4RE43E3A .

Shuhala commented 4 years ago

Sure. To give some context about why I created this bot:

I had to manage a Fortnite tournament of 200+ players and my admins had to ask each players to take a screenshot of their score when they died, enter manually each one of them and then compile the result every game in Excel. The Fortnite UI didn't make it easy to run a tournament because there was no way to get the score after a match, we had to ask everyone to give us theirs.

When I created the bot, it alleviated this task by allowing players to send their score and screenshot(as a proof) to the bot instead of the admin, who could then export the csv with !download_match_scores [alias] [match_name] with the team names + screenshot to verify if needed.

Fortunately, mayhem now exists and solves the main problem I was trying to fix with this bot, which was (tl;dr) have a more scalable solution than having my admins manually entering the scores of a Fortnite tournament.

Shuhala commented 4 years ago

The features I implemented revolve around this problem in order to make this process as easy as possible for the players. The bot is linked with Toornament (tournament platform we used) so one could easily link his team with his discord account !link [alias] [team_name]. Once this is done, all the following captain commands are linked to this tournament (alias), ex: Fortnite, and team (team_name), meaning that one can be the captain of only 1 tournament (if multiple exists).

An administrator can then create a match !create_match [alias] [match_name] [password] [match_id] (I added the optional Toornament match_id to prevent people from another group accidentally joining the wrong match), and captains can join this match_name to receive the password.

This reminds me, another major issue we had with Fortnite was that there was no way for an admin to know how many people were in the lobby before starting the game. With the commands I mentioned before, after joining a game, a team captain could then notify the admin that he was ready with !ready [match_name]. The tournament admin could then track how many teams were ready before starting the match.

Shuhala commented 4 years ago

I just ran the bot after cleaning up all of my docker containers, and didn't encounter an error. Do you want to add me on Discord so we don't spam this thread? Shuhala#1164

Shuhala commented 4 years ago

I was not aware that you did modify discord.py, maybe its easier for you to upgrade it then.

Actually, I think I got confused here. What I modified is the discord.py errbot backend, which is not the same thing as the discord.py dependency. Updating the later should cause no issue if the latest version has no breaking changes.

Yes I got the docker stuff to run. I had some issues getting the correct version of python, poetry, and pip installed.

Not sure how you installed it, but in case you did it differently, running make run (source) in the console should be all you need to have the bot up and running. The dependencies will be installed by docker as specified in the Dockerfile. If you want to debug using Pycharm, you could use the Docker interpreter.

Shuhala commented 4 years ago

discord.py updated.