GithubHelp home page GithubHelp logo

fixator10 / fixator10-cogs Goto Github PK

View Code? Open in Web Editor NEW
68.0 4.0 53.0 3.76 MB

Cogs for Red-DiscordBot. Including port of Stevy's V2 leveler.

License: MIT License

Python 100.00%
cog discord discord-bot red-discordbot cogs-red-discordbot cogs minecraft saucenao tracemoe godville

fixator10-cogs's Introduction

fixator10-cogs's People

Contributors

aikaterna avatar apoo711 avatar ctin avatar dependabot[bot] avatar ecosgpi avatar fixator10 avatar flaree avatar github-actions[bot] avatar kablekompany avatar kennnyshiwa avatar leetfin avatar madebylydia avatar owocado avatar phenom4n4n avatar pre-commit-ci[bot] avatar predaaa avatar vexed01 avatar zephyrkul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fixator10-cogs's Issues

[Leveler] Down Rep command

Is your feature request related to a problem? Please describe.
You can add rep to users, but you can't remove rep points from users
Describe the solution you'd like
A command to down rep users (literally just remove a point from them, instead of adding one)
Describe alternatives you've considered
There really are none.

Fix 10 Maintainability issues in multiple files

CodeFactor found multiple issues:

TODO: Find a better way do detect mods and other shit like that

steamcommunity\steamcommunity.py:196
Commit f1581b3

Wildcard import dateutil.parser

godvilledata\godvilledata.py:4
Commit a7df069

No exception type(s) specified

translators\translators.py:109
Commit fe5813e
minecraftdata\minecraftdata.py:74
Commit f478ea7
minecraftdata\minecraftdata.py:109
Commit f478ea7
minecraftdata\minecraftdata.py:127
Commit f478ea7
minecraftdata\minecraftdata.py:189
Commit f478ea7
minecraftdata\minecraftdata.py:207
Commit f478ea7

TODO: find new library/api for that

minecraftdata\minecraftdata.py:134
Commit f478ea7

Wildcard import cogs.utils.chat_formatting

memegen\memegen.py:8
Commit fe5813e

[Captcha] Two major suggestions (ratelimit issues)

Is your feature request related to a problem? Please describe.
I have used this cog in the past at a large-ish scale. If you are unfortunate enough to get raided, this cog will be your first class ticket to bot quarantine. Discord does not remove that (still have a ticket open from December, I have moved on).

You cannot set the allowed retries to zero, say goodbye to your reaction limits. Furthermore, I have not touched the cog in a while, but I hope there is an option now to disable the DM it sends on failure. The thousands of bots will not be able to pass the captcha, they will get the error DM, therefore this cog will send thousands of DMs in a matter of minutes. Your one way ticket to quarantine.

Describe the solution you'd like
Add a way to disable retrying the captcha (reaction death) and a way to disable the DM on failure (assuming it's not in there already).

Reference my issue that was not carried over here.

Describe alternatives you've considered
I don't use this cog anymore. I want to help anyone who does still use it help themselves in not losing their bot to something they cannot control.

Additional context
I do appreciate and thank you for taking over and continuing this cog, it's helpful when it doesn't turn against you due to Discord's crap userbot raid filtering.

[Leveler] Exception with [p]top command

Describe the bug

Exception thrown with the [p]top command.

To Reproduce

Seems like you just have to run the [p]top command when you haven't sent any other messages in the server?

Expected behavior

No exception thrown, show the expected output of [p]top.

Bot's logs

Traceback (most recent call last):
  File "/data/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/data/cogs/CogManager/cogs/leveler/leveler.py", line 390, in top
    await self._find_server_exp(user, server),
  File "/data/cogs/CogManager/cogs/leveler/leveler.py", line 3583, in _find_server_exp
    for i in range(userinfo["servers"][str(server.id)]["level"]):
TypeError: 'NoneType' object is not subscriptable

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

Traceback (most recent call last):
  File "/data/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/data/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/data/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'NoneType' object is not subscriptable

Red version

3.4.9

Additional context

Happened in my server with a member who just joined the server. I can run the [p]top command just fine, but when they ran it the exception above happened instead. I did a quick glance at the code and it's probably because userinfo on line 3580 is None, since they never sent any messages beforehand.

[MessagesLog] Clarify language by changing "redacted" to "edited"

Is your feature request related to a problem? Please describe.

Potentially confusing wording in the messages log cog.

Describe the solution you'd like

I would like to suggest that the word "redacted" be changed to "edited" to make it more clear what is being logged, as "edited" is the official terminology Discord uses.

Additional context

N/A

[AdminUtils] Add delchannel and delrole

Please add two simple commands delchannel and delrole that can delete a channel or role based on name or channel/role ID. This is a really simple feature that could be combo'd with other cogs and automated triggers to do some cool stuff.

[Leveler] Fix 10 Security, 38 Maintainability issues in leveler\leveler.py

[Leveler] Updating badges has no effect

When adding a new badge and then entering the same command but with ,for example, a changed price, the changes are not updated in the DB, even though the message is sent that says it got updated.

I assume this error comes from the missing string conversion of the server ID in line 1829

{"server_id": serverid}, {"$set": {"badges": badges["badges"]}}

[Leveler] Can't load the cog in Red 3.2.2

After updating to the latest version of Red (being 3.2.2)

the Leveler cog has stopped functioning and can't be loaded any longer.

These are the errors displayed in the Console:

http://prntscr.com/qp5dbh (Screenshot link)

Bare in mind i do have Pillow installed and Numpy (the correct versions)
hopefully this gets fixed, and if it is something on my side. please help me fix it.

Thank you for your amazing cogs.

[DataUtils] Addition of Nickname Column to rolemembers command

Is your feature request related to a problem? Please describe.
When using rolemembers to pull a list of all members for a server, some users are more easily identified by their given nickname rather than their actual username.

Describe the solution you'd like
It would be nice if the rolemembers command could also return a column with the related nickname at the time of the query such that results would be:
ID, Name, Nickname

Describe alternatives you've considered

Additional context
Part of this desire is to help manage a server where everyone is required to set a nickname (which doesn't change after). Adding this additional column (either optionally or always included) would be very useful for scenarios like this where the name you see differs from the username and getting a list to cross reference that includes it all is most useful.

[PersonalRoles] Role icon support

Discord is currently slowly rolling out a feature that lets you upload icons for roles. Since the PersonalRoles Cog lets people customize their own role i wonder if there is some way to also enable that people can upload their own icon for their personal role.

[Leveler] New Command Request feature - [p]lvladmin giveexp / takeexp @user EXP

Simple but useful feature. The ability for admins/owners to add a specific EXP amount to users. Nice to have a setlevel command, but [p]lvladmin giveexp @user exp and [p]lvladmin takeexp @user exp would be quite useful as well to give and take users certain amount of EXP rather than a set level.

I do believe this is a mee6 feature already.

--> Added the suggestion to take EXP as well.

[Leveler] Global to local config

Hey there, so something I've noticed thats kinda suprising to me how the Leveler cog is global settings for everything would there be a way to have a "default setting" but let server owners be able to adjust things like exp gain and such on their own that it only changes on their own server

Maybe I'm just being abit qol about this but it does limited what you can do with this cog.

My regards

[Leveler] Cleanup command

Hi! I like to suggest some delete commands for leveler. My idea is to have a command called [p]lvlreset. It can have the options to wipe out the levels for an individual user or the whole server. Hope it makes sense, thank you for reading.

[Leveler] Motor needs to be less than version 3.0.0

Describe the bug
A user was loading a newly installed copy of leveler on their bot and got this
image

To Reproduce
Install motor > 2.5.1 and try to load leveler, motor 3.0.0 was just released a couple days ago seems like

Expected behavior
The info.json should have an upper bound for motor's version

Bot's logs
The image in the "Describe the bug" section

Red version
Red 3.4.16

Additional context
I would have PRed the change myself but I don't know what you would like to make the valid motor version range

[Leveler] Clear empty badges

When using the [p]profile command if you have no badges equipped in a slot it displays a plus sign to indicate you can have a badge there, but once you put some badges in place it tends to look off having those pluses there. Is it possible to either disable those pluses all together or to make them disappear after getting the first badge

ImportError: cannot import name '_imaging' from 'PIL' in leveler (Ubuntu,Bionic)

[2019-07-03 21:28:19] [ERROR] red: Package loading failed
Traceback (most recent call last):
File "/home/edgar06ka/bot/lib/python3.7/site-packages/redbot/core/core_commands.py", line 104, in _load
await bot.load_extension(spec)
File "/home/edgar06ka/bot/lib/python3.7/site-packages/redbot/core/bot.py", line 252, in load_extension
lib = spec.loader.load_module()
File "", line 405, in _check_name_wrapper
File "", line 905, in load_module
File "", line 730, in load_module
File "", line 265, in _load_module_shim
File "", line 696, in _load
File "", line 677, in _load_unlocked
File "", line 726, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/edgar06ka/mybot/cogs/CogManager/cogs/leveler/init.py", line 1, in
from .leveler import Leveler
File "/home/edgar06ka/mybot/cogs/CogManager/cogs/leveler/leveler.py", line 4, in
from PIL import Image, ImageDraw, ImageFont, ImageColor, ImageOps, ImageFilter
File "/home/edgar06ka/mybot/cogs/Downloader/lib/PIL/Image.py", line 60, in
from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/home/edgar06ka/mybot/cogs/Downloader/lib/PIL/init.py)

[Weather] Chore: Dark Sky can't generate new API Keys - change API

The Issue
Forecast.io (Dark Sky) is no longer accepting new sign ups, so new users of the bot cog can no longer generate API keys. Dark Sky itself is going to stop at the end of 2021.

Possible Alternatives in Order of Suitability

  • Open Weather Map
  • AccuWeather
  • Met Office (UK Government - so may be slightly inaccurate for international weather. Will still return a result with varying degrees of accuracy (great in major cities, good for ex-commonwealth, kind of 'eh' for everywhere else.)

EDIT: Spelling errors and incomplete sentence... oops...

[Leveler] Bug report

Describe the bug
i am unable to run leveler on my Red-Bot

To Reproduce
load the repo
install the cog
ask to load

Expected behavior
run?

Bot's logs
object NoneType can't be used in 'await' expression
[21:42:41] ERROR [red] Package loading failed
╭─────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────╮
│ /home/pi/venv/lib/python3.11/site-packages/redbot/core/core_commands.py:188 in _load │
│ ❱ 188 await bot.load_extension(spec) │
│ /home/pi/venv/lib/python3.11/site-packages/redbot/core/bot.py:1680 in load_extension │
│ ❱ 1680 lib = spec.loader.load_module() │
│ in _check_name_wrapper:605 │
│ in load_module:1120 │
│ in load_module:945 │
│ in _load_module_shim:290 │
│ in _load:721 │
│ in _load_unlocked:690 │
│ in exec_module:940 │
│ in _call_with_frames_removed:241 │
│ /home/pi/.local/share/Red-DiscordBot/data/rhbot/cogs/CogManager/cogs/leveler/init.py:4 in │
│ ❱ 4 from .leveler import Leveler │
│ /home/pi/.local/share/Red-DiscordBot/data/rhbot/cogs/CogManager/cogs/leveler/leveler.py:9 in │
│ ❱ 9 from .abc import CompositeMetaClass │
│ /home/pi/.local/share/Red-DiscordBot/data/rhbot/cogs/CogManager/cogs/leveler/abc.py:8 in │
│ ❱ 8 from motor.motor_asyncio import AsyncIOMotorClient, AsyncIOMotorDatabase │
│ /home/pi/.local/share/Red-DiscordBot/data/rhbot/cogs/Downloader/lib/motor/motor_asyncio.py:18 in │
│ ❱ 18 from .frameworks import asyncio as asyncio_framework │
│ /home/pi/.local/share/Red-DiscordBot/data/rhbot/cogs/Downloader/lib/motor/frameworks/asyncio/init.py:28 in │
│ ❱ 28 from asyncio import coroutine # For framework interface. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'coroutine' from 'asyncio' (/usr/lib/python3.11/asyncio/init.py)

Red version
3.5.1

Additional context
seens to be hapenning in a lot of other cogs...

[Leveler] pip dependencies incompatible

Describe the bug
While installing the SciPy for Leveler cog in venv getting following error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
red-discordbot 3.4.5 requires attrs==19.3.0, but you have attrs 20.3.0 which is incompatible.
red-discordbot 3.4.5 requires Pygments==2.6.1, but you have pygments 2.7.4 which is incompatible.
red-discordbot 3.4.5 requires pytz==2020.1, but you have pytz 2020.5 which is incompatible.

To Reproduce

  1. Enter Redbot venv
  2. Execcute below command
    python -m pip install -U --force-reinstall numpy scipy matplotlib ipython jupyter pandas sympy nose

Expected behavior
Expecting to install " SciPy" without any error.

Red version
3.4.5

Additional context
I don't know whether it is related to above pip installation issues but I cant change the value of !lvladmin msgcredits and !lvladmin setprice both are stuck to0.

[leveler] Timeout on leveler command when badge url inactive.

Describe the bug
If the image URL for a badge is no longer valid, commands that interact with levelers badge system will have a large timeout before returning information (such as profile, available badges, etc).

To Reproduce

  • Create a Badge
  • Set the image URL to something which does not return an image
  • Run [p]profile

Expected behavior
In the instance that a badges image cannot be accessed, a lower timeout along with an error message logged about being unable to retrieve the badge would work well. Because this is nosql, updating the image url would have to be applied across all user objects rather than just in the badges table

Red version
3.4.12

Additional context
To resolve this issue, I had to manually update the badge url within mongodb across all user objects.

[messageslog] no longer working under redbot 3.5.x version

Describe the bug
After the 3.5.x update I wanted to check again if all commands of the respective cogs work, unfortunately your system was also affected where the bot has no longer responded to it :D an error message does not come, he also loads your system, but I can not see after I enter the green rake that he has accepted it. So, unfortunately i can't tell you more because i don't have any more info or error messages

To Reproduce
[/ or !]messageslog channel ⁠log-channel-for-all-chats

[Leveler] Remove multiple roles

Hello,

Currently it is not possible to remove multiple roles, I would like to request this.

Why?

I am busy with setting up a server where you get roles until a specified role that overrides the other roles. EG: The first 15 levels you will get cloths like socks,pants,gloves,hat etc etc etc. Then you get a full suite, what removes all previous roles. At this point you get extra roles until the next major thing that removes the previous roles.

LD;DR
Multiple roles to semi role role play in a semi role hoarding manner.

[Leveler] Updated red, now leveler doesn't load

Describe the bug

Can't load red, check logs below
To Reproduce

!load leveler
Expected behavior

Bot's logs

Feb 25 11:38:21 localhost redbot[1376]: [2022-02-25 11:38:21] [ERROR] red: Package loading failed
Feb 25 11:38:21 localhost redbot[1376]: Traceback (most recent call last):
Feb 25 11:38:21 localhost redbot[1376]:   File "/mnt/git/discordbot/cogs/CogManager/cogs/leveler/leveler.py", line 30, in <module>
Feb 25 11:38:21 localhost redbot[1376]:     from motor.motor_asyncio import AsyncIOMotorClient
Feb 25 11:38:21 localhost redbot[1376]:   File "/mnt/git/discordbot/cogs/Downloader/lib/motor/motor_asyncio.py", line 29, in <module>
Feb 25 11:38:21 localhost redbot[1376]:     AsyncIOMotorClient = create_asyncio_class(core.AgnosticClient)
Feb 25 11:38:21 localhost redbot[1376]:   File "/mnt/git/discordbot/cogs/Downloader/lib/motor/motor_asyncio.py", line 25, in create_asyncio_class
Feb 25 11:38:21 localhost redbot[1376]:     return create_class_with_framework(cls, asyncio_framework,
Feb 25 11:38:21 localhost redbot[1376]:   File "/mnt/git/discordbot/cogs/Downloader/lib/motor/metaprogramming.py", line 288, in create_class_with_framework
Feb 25 11:38:21 localhost redbot[1376]:     new_class_attr = attr.create_attribute(new_class, name)
Feb 25 11:38:21 localhost redbot[1376]:   File "/mnt/git/discordbot/cogs/Downloader/lib/motor/metaprogramming.py", line 204, in create_attribute
Feb 25 11:38:21 localhost redbot[1376]:     doc = getattr(cls.__delegate_class__, attr_name).__doc__
Feb 25 11:38:21 localhost redbot[1376]: AttributeError: type object 'MongoClient' has no attribute 'topology_description'
Feb 25 11:38:21 localhost redbot[1376]: During handling of the above exception, another exception occurred:
Feb 25 11:38:21 localhost redbot[1376]: Traceback (most recent call last):
Feb 25 11:38:21 localhost redbot[1376]:   File "/home/pix/vanilla/lib/python3.8/site-packages/redbot/core/core_commands.py", line 172, in _load

Red version

3.4.16
Additional context

[Leveler] setting badges to type 'bars' just makes them all go away

Describe the bug
I've set the badge type to bars via [p]lvlset badge type bars and then the badge area in my profile is just blank, see:

image

To Reproduce
Set the bot up, do [p]lvlset badge type bars, then [p]profile and there are no badges anymore.

Expected behavior
List of the user-selected badges in bars form

Bot's logs
Nothing out of the ordinary (no errors)

Red version
3.4.0

[Leveler] XP bar on the profile card is wrong

Describe the bug
I've just done the math and was wondering why the leaderboard with ?top says I have less XP than I should have by accumulating the values of the past levels shown on the profile card shown with ?profile. I couldn't wrap my head around it until I've tried around with some users. Seems like the XP required shown in the XP bar in the profile is calculated here:

return 139 * level + 65

But the top leaderboard and the XP that actually leads to levelups uses this formula:

return level * 65 + 139 * level * (level - 1) // 2

One example: the profile card said the user is Level 3 and at 468/621 XP to level up. But when I did check the leaderboard, it said they had 1080 points. I used the second formula to calculate that they needed 1094 XP to level up. So 14 XP more, not 153 XP like their profile said. They wrote a message, it gave 17 XP and they leveled up. The leaderboard showed 1097 points and their profile said Level 4 and 3/760 XP. the 760 needed is of course incorrect again. From 4 to 5 you need 621 XP to level up, not 760 (as calculated via the second formula). I've plotted the actual values in this pastebin. The "earned" value is interesting for the leaderboards. I assume that the XP required is calculated by the wrong formula here:

exp_total = await self._required_exp(userinfo["servers"][str(server.id)]["level"])

I think you just need to use the second formula and subtract the overall XP for the next level from the overall XP of the current level. My guess could be wrong, though.

To Reproduce
Chat until ?top says you're less than 20 XP away to a level up according to a value in the pastebin, e.g. 269 XP for level 2. Do ?profile and see how it says you need more than 20 XP for the level up. Write a message that yields XP. Check ?profile again and see that you've gained a level up.

Expected behavior
The profile exp total for the level should be correct, for example with the formula mentioned above.

Bot's logs
No error or anything.

Red version
v3.4.0

Additional context
n/a

[Leveler] Disable leveler

Would there be a way to "disable" the Leveler as I've noticed it's always creating a database even if a server doesnt use the level system which basicly wastes unecesarry space and basicly causes "tracking"

Prehaps have it off by default and a command to turn it on

Thanks in Advance!

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.