Giter VIP home page Giter VIP logo

pizzahat's Issues

Use Pycord rather than DiscordTogether

Is your feature request related to a problem? Please describe.
The bot currently uses DiscordTogether for voice channel embedded activities. The same functionality in built-in in pycord. Using another 3rd party library is not needed

Describe the solution you'd like
Use the create_activity_invite method on a voice channel.
Ex- link = await ctx.author.voice.channel.create_activity_invite(discord.EmbeddedActivity.watch_together)

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
I can create a pr if you want

Custom checks

Update custom checks to send custom msg, for example: if the server doesn't have a staff role set, instead of doing nothing (current), make the bot send an error msg -> "Staff role is not set for this server."

And likewise for the user_is_staff check.
Could be done by using discord.py's error handler

Also need to fix the custom checks, as they are not working as expected. A command should run if u have the staff role set and if the user is staff. But in cogs/admin.py, those commands won't run. They run when those checks are commented.

DB connection closed in the middle of an operation

The complete error from logging:

ERROR      - 2024-01-28 13:45:56,523 - client          : Ignoring exception in on_message_edit
Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 286, in _loop_reading
    length = fut.result()
             ^^^^^^^^^^^^
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 846, in _poll
    value = callback(transferred, key, ov)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\asyncio\windows_events.py", line 494, in finish_recv
    return ov.getresult()
           ^^^^^^^^^^^^^^
OSError: [WinError 121] The semaphore timeout period has expired

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 441, in _run_event
    await coro(*args, **kwargs)
  File "D:\Projects\PizzaHat\PizzaHat\utils\events.py", line 105, in on_message_edit
    channel = await self.get_logs_channel(before.guild.id)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Projects\PizzaHat\PizzaHat\utils\events.py", line 77, in get_logs_channel
    data = await self.bot.db.fetchval("SELECT channel_id FROM modlogs WHERE guild_id=$1", guild_id)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\pool.py", line 608, in fetchval
    async with self.acquire() as con:
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\pool.py", line 1005, in __aexit__
    await self.pool.release(con)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\pool.py", line 879, in release
    return await asyncio.shield(ch.release(timeout))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\pool.py", line 220, in release
    raise ex
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\pool.py", line 210, in release
    await self._con.reset(timeout=budget)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\connection.py", line 1366, in reset
    await self.execute(reset_query, timeout=timeout)
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\asyncpg\connection.py", line 317, in execute
    return await self._protocol.query(query, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "asyncpg\protocol\protocol.pyx", line 338, in query
asyncpg.exceptions.ConnectionDoesNotExistError: connection was closed in the middle of operation

DB error

Switching from bot.start() to bot.run() required some steps to change the __main__.py. That caused some DB issues, works, but gives some error msg in the terminal when using the sql command

ERROR MSG

C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py:80: RuntimeWarning: coroutine 'Pool.fetchval' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'PizzaHat/PizzaHat'
  2. Run py .
  3. Run sql cmd and tickets cog also seem to cause this issue

Expected behavior
Bot should run normal without any errors.

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.