phenom4n4n / phen-cogs Goto Github PK
View Code? Open in Web Editor NEWMy public cogs for Red, Discord bot.
Home Page: https://phen-cogs.readthedocs.io/en/latest/
License: MIT License
My public cogs for Red, Discord bot.
Home Page: https://phen-cogs.readthedocs.io/en/latest/
License: MIT License
Could you put here the dank memer flash sales feature like in Noumenon?
For the lock command add a sub command like role [mention/id] as some servers have member roles so locking the everyone role wont lock the chanel
so the end comand would look like this
[p]bumpreminder lock role {id}
Add support for aliasing tags, this should add a new aliases
attribute to tag objects. Caches will need to be built similar to bot.all_commands with all aliases as keys to the tag object for fast tag processing. Converters also need to be updated so passed aliases point to the regular tag object (and multiple aliases can’t be registered). The info command will need to show all tag aliases, and a tag’s aliases should be limited to 20. Also consider setting a server’s tag limit to 250.
Hi there,
I am not sure if this would be against Disboard ToS (like the bumping leaderboard), but it would be really cool if it would be possible to have a leaderboard that shows how fast everyone is responding to the bot by doing !d bump
. It could be an average or just the fastest time possible, both should work fine and look really cool!
hey,
nice nifty cog, thanks for that.
currently linkquoter only quotes links if they're of the same server, but I think if it could quote cross server links, it would be useful for owners and mods who operate on multiple community servers utilizing the same bot. It could potentially save us time when sharing cross server links so we don't have to spend time giving context to other users who don't know where the direct message link originated from because bot will automatically provide the rough context. there could be other scenarios in which this feature would be helpful to community leaders, which I am not able to think right now.
Banchart uses len(await ctx.guild.bans)
to determine how many bans there are for the header of the image, however the audit log can have a different number of ban events in many cases. If a user is unbanned, they will not be in ctx.guild.bans
, but a ban audit log case may remain for them. Also, audit log cases expire after a while, so a ban might exist with no audit log case. For this reason, I suggest tracking the number of bans as you iterate over them, then putting that number in the image. The "Gathering stats for the last {limit} bans.text can probably continue to use the naive
len(await ctx.guild.bans)` calculation.
Add a cooldown block tethered to a cooldown mapping object on the Tag object itself, which can key based on role, server, channel, or user. The parameter describes bucket type, payload describes response? default response should include time left.
Like unapproved EmbedMaker has editmsg
.
would there be a way to edit the webhook sesion cog so there is a setting to disable pings crossing both servers as this could esaly be used to raid and could get quite anoying
Binding a new role to a message should also update the contents of the message.
hi i have 20 cogs loaded in my bot but when i load linkquoter cog the bot is super slow for me and it hang really bad.
but when i unload linkquoter cog the bot is fast again. idk whats wrong for real. there is no error in my console too.
can u guys please fix this thank you.<333
my bot was slow yesterday and i unload and load all cogs 1 by 1 and i found out this.
I keep getting this error:
Traceback (most recent call last):
File "/home/bot/redenv/lib/python3.8/site-packages/redbot/core/core_commands.py", line 171, in _load
await bot.load_extension(spec)
File "/home/bot/redenv/lib/python3.8/site-packages/redbot/core/bot.py", line 1364, in load_extension
lib.setup(self)
File "/home/bot/.local/share/Red-DiscordBot/data/proleman/cogs/CogManager/cogs/tags/__init__.py", line 44, in setup
bot.add_cog(Tags(bot))
File "/home/bot/.local/share/Red-DiscordBot/data/proleman/cogs/CogManager/cogs/tags/core.py", line 90, in __init__
bot.add_dev_env_value("tags", lambda ctx: self)
File "/home/bot/redenv/lib/python3.8/site-packages/redbot/core/bot.py", line 352, in add_dev_env_value
raise RuntimeError(f"The name {name} is already used.")
RuntimeError: The name tags is already used.```
This happens every time I try to load the cog.
To be useful, [p]embed edit frommsg
should take two parameters, the source message id and the target message id. That's what I was expecting, but ...
It currently only takes one message parameter which it extracts the embed from, and then adds back to the message. The end result is that an edit happens, but with no actual change (i.e. same content it had before is written back to the message).
rapidfuzz seems to not be in the requirements but it was added in 5bf081e
Traceback:
Exception during loading of package
Traceback (most recent call last):
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/redbot/core/core_commands.py", line 171, in _load
await bot.load_extension(spec)
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/redbot/core/bot.py", line 1355, in load_extension
lib = spec.loader.load_module()
File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 962, in load_module
File "<frozen importlib._bootstrap_external>", line 787, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/red/.local/share/Red-DiscordBot/data/TechBot/cogs/CogManager/cogs/disboardreminder/__init__.py", line 25, in <module>
from .disboardreminder import DisboardReminder
File "/home/red/.local/share/Red-DiscordBot/data/TechBot/cogs/CogManager/cogs/disboardreminder/disboardreminder.py", line 45, in <module>
from .converters import FuzzyRole, StrictRole
File "/home/red/.local/share/Red-DiscordBot/data/TechBot/cogs/CogManager/cogs/disboardreminder/converters.py", line 4, in <module>
from rapidfuzz import process
ModuleNotFoundError: No module named 'rapidfuzz'
nt
Traceback (most recent call last):
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/red/.local/share/Red-DiscordBot/data/TechBot/cogs/CogManager/cogs/customping/customping.py", line 111, in ping
s = speedtest.Speedtest(secure=True)
File "/home/red/.local/share/Red-DiscordBot/data/TechBot/cogs/Downloader/lib/speedtest.py", line 1091, in __init__
self.get_config()
File "/home/red/.local/share/Red-DiscordBot/data/TechBot/cogs/Downloader/lib/speedtest.py", line 1173, in get_config
ignore_servers = list(
ValueError: invalid literal for int() with base 10: ''
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 832, in invoke
await super().invoke(ctx)
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1353, in invoke
await super().invoke(ctx)
File "/home/red/.pyenv/versions/red/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/red/.pyenv/versions/red/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: ValueError: invalid literal for int() with base 10: ''
Please have [p]tag raw
and [p]tag global raw
subcommands use code formatting for their output so that if the production of the tag is a URL, it won't be subject to Discord's URI-quoting, which mangles the result.
For example, a tag that simply outputs a link like https://...{args(1)}
is detected by Discord as a URL and thus rendered as https://...%7Bargs(1)%7D
which makes it very hard to understand. For the user to be able to make any use of it, they then need to manually convert that back to actual curly-braces (as when cuttting-and-pasting to use it in another command).
add support for [p]role target multirole remove [roles...] [args...]
Currently you can edit an embed message with fromfile, fromyaml, or fromjson, but not with any of the stored embeds.
There's no setting to set a "whitelist only" mode. Having no setting but a whitelist makes the whitelist useless since there's nothing about the cog that utilizes the whitelist. It's just there.
It would be cool to have a "whitelist only" mode as with my bot I allow people to invite my bot via requests and then whitelisting servers the bot can do in so I don't have to do any extra work like serverlocking, etc.
It would be cool if you could add message support to this cog as I find it useful as would many others that uses this cog.
Bot didn't have send embed perms. Not sure how you'd like to handle it since there's a couple different approaches, so I'm opening an issue.
Traceback (most recent call last):
File "/.../cat38/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/.../Red-DiscordBot/cogs/CogManager/cogs/permissionslocker/permissionslocker.py", line 96, in permlock
await ctx.send(embed=e)
File "/.../cat38/lib/python3.8/site-packages/redbot/core/commands/context.py", line 93, in send
return await super().send(content=content, **kwargs)
File "/.../cat38/lib/python3.8/site-packages/discord/abc.py", line 904, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
File "/.../cat38/lib/python3.8/site-packages/discord/http.py", line 241, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/.../cat38/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "/.../cat38/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 814, in invoke
await super().invoke(ctx)
File "/.../cat38/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1325, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/.../cat38/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: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
The alias command is already used in the core cog Alias and both the cogs cannot be loaded at once due to this reason.
When trying to use Retrigger from Trusty-Cogs with the fromdata command, the {attachment.url} isn't replaced with the posted image attachment URL. I use this to trigger a response to images posted in discord as an embedded message with a link to SauceNAO but the link always returns as: https://saucenao.com/search.php?db=999&url={attachment.url}
The current requirement parameters are only valid for guild tags since I can only define a role/channel and not a guild permission such as kick_member
for global commands. I'm trying every possible combination I can think of to make slash commands hidden or only accessible to Staff of a server however I have no luck.
I am requesting the following;
permissions
parameter in {required(...):[response]}
. This will enable the ability to require Discord permissions to run a mod command that should only be accessible to a user with said permission.I'm unsure how to limit global slash tags to Staff only unless you're able to help me in this regards.
Add support for auto roles and sticky roles.
Ongoing list of TODO's for Tags
After [p]migratecustomcom
, any of my former cc's that had {0}...{1} in them are converted to tags with args(0)...args(1). However, that's incorrect, as customcom is 0-indexed. It should output args(1)...args(2), etc.
If someone needed to edit an embed that has role reactions attached to the message, being able to edit the embed without needing to resend the embed and having to redo all of the said role reactions would make it a lot more convenient and it makes more logical sense.
Something like [p]embed edit <message_id> <fromfile/frommsg/fromdata/etc.>
I tried to use require block, but unable to check two parameters (&& check) with it.
I want role "r1" to be able to use tag "t1" only in channel "c1".
I tried {require(r1, c1):Error Message} {command: c1} This tag is working if any of r1 or c1 is satisfied. I want it to work only if both are satisfied
Is there any other way?
If this section is not meant for these type of questions. Sorry
linkquoter only shows the link quoted, but lets say I do [link] [message], and I have delete on, I think it would be good if the message would show up as the content and the embed as the linkquoted content
Hi,
aki session sometimes ends with said error as title says:
Here is the full traceback:
Traceback (most recent call last):
File "/opt/lib/python3.9/site-packages/redbot/vendored/discord/ext/menus/__init__.py", line 638, in update
await button(self, payload)
File "/opt/cogs/CogManager/cogs/aki/aki.py", line 34, in no
await self.aki.answer("no")
File "/opt/lib/python3.9/site-packages/akinator/async_aki/async_akinator.py", line 189, in answer
resp = self._parse_response(await w.text())
File "/opt/lib/python3.9/site-packages/akinator/async_aki/async_akinator.py", line 88, in _parse_response
return json.loads(",".join(response.split("(")[1::])[:-1])
File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I have a feeling this is an issue with upstream library but unsure so here's an issue.
I'd like to be able to access the bot instance in the Custom Block environment so that I can write code like:
[p]tagset block add taxon
from functools import partial
from pyinaturalist import get_taxa_autocomplete
bot = self.bot # self is the cog (i hope!)
class TaxonName(tse.Block):
ACCEPTED_NAMES = ("taxon",)
async def process(self, ctx: tse.Context):
query = ctx.verb.payload
response = await bot.run_in_executor(None, partial(get_taxa_autocomplete, q=query))
if response:
results = response.get("results")
if results:
taxon = results[0]
return taxon["name"]
return "No Match"
return TaxonName
Unfortunately, that results in:
Traceback (most recent call last):
File "/home/synrg/.local/share/Red-DiscordBot/data/CuckooBee/cogs/CogManager/cogs/tags/owner.py", line 111, in tagsettings_block_add
block = self.compile_block(code)
File "/home/synrg/.local/share/Red-DiscordBot/data/CuckooBee/cogs/CogManager/cogs/tags/owner.py", line 61, in compile_block
result = env["func"]()
File "<string>", line 6, in func
NameError: name 'self' is not defined
My workaround is to use loop = asyncio.get_event_loop()
and then run the synchronous API call get_taxa_autocomplete
in that, and that works, but being able to use the bot instance would open up other possibilities for custom blocks for which there are no such convenient alternatives.
I have my bot as part of a role which has the Manage Roles
permission enabled, but not Administrator.
For some reason, I run into a lot of issues when a channel is specified.
!reactrole create :regional_indicator_h:;@He/Him #role-assignment Blue
This command uses an existing role. I get the response Error in command 'reactrole create'. Check your console or logs for details.
Traceback (most recent call last):
File "/home/jademalo/.pyenv/versions/MTGPLBot/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/jademalo/MTGPLBot/cogs/CogManager/cogs/roleutils/reactroles.py", line 183, in reactrole_create
message = await channel.send(embed=e)
File "/home/jademalo/.pyenv/versions/MTGPLBot/lib/python3.8/site-packages/discord/abc.py", line 935, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
File "/home/jademalo/.pyenv/versions/MTGPLBot/lib/python3.8/site-packages/discord/http.py", line 241, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
This seems to be a simple missing permissions error, but it doesn't make a whole lot of sense since the bot should have the manage roles permission. In addition, it's not making a new role, so I've got absolutely zero idea why it would need any additional permissions.
Giving the bot the full Administrator permission results in this working correctly.
!reactrole create :regional_indicator_h:;@He/Him Blue
This command works correctly, so long as the command is invoked from the correct channel. It seems that the first command breaks due to it failing to place the role into a different channel? I'm not really sure.
Hopefully these cases are clear enough, I'm not really sure why this is happening. I can just about get the functionality I want by invoking it in the specific channel to begin with, but there's clearly something going wrong here. It will also sometimes just display the !reactrole create
help menu, and I've got no idea why it does that.
Across the repo command descriptions are lacking/not that helpful. I’d like to write full descriptions of most utility/moderation focused commands that include examples.
have the webhook cog have a option to run sesion forever in a channel not just have a 2 min timeout
Make the baron thingy leave botfarms, bl servers, smol servers, on init to prevent people who invite the bot while its offline which is exactly what happened today
Add support for adding global slash tags + slash commands.
Seems like the call to the main group command is missing ctx
.
Traceback (most recent call last):
File "/home/zephyrkul/redenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/zephyrkul/.local/share/Red-DiscordBot/cogs/CogManager/cogs/slashtags/commands.py", line 448, in slashtag_global_edit_tagscript
await self.slashtag_global_edit(tag, tagscript=tagscript)
File "/home/zephyrkul/redenv/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 291, in __call__
return self.callback(self.cog, *args, **kwargs)
TypeError: slashtag_global_edit() missing 1 required positional argument: 'tag'
i tried to use the reactrole bind but somehow it doesn't work. i provided the error below.
Exception in command 'reactrole bind'
Traceback (most recent call last):
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/mkurisu069/.local/share/Red-DiscordBot/data/Redbot/cogs/CogManager/cogs/roleutils/reactroles.py", line 163, in reactrole_add
r["rules"] = rules
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/redbot/core/config.py", line 115, in aexit
await self.value_obj.set(self.raw_value)
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/redbot/core/config.py", line 561, in set
await super().set(value)
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/redbot/core/config.py", line 257, in set
await self.driver.set(self.identifier_data, value=value)
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/redbot/core/drivers/json.py", line 146, in set
value_copy = json.loads(json.dumps(value))
File "/usr/lib/python3.8/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type ReactRules is not JSON serializable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/redbot/core/commands/commands.py", line 832, in invoke
await super().invoke(ctx)
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1340, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "/home/mkurisu069/redenv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/mkurisu069/redenv/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: Object of type ReactRules is not JSON serializable
For the Embedutils cog, it would be convenient to view the stored embeds format in a code block. Another very useful change would be to be able to send stored embeds to specified channels. I dont believe there is an option for that yet, there is only a show one which could do the same thing but its more useful if using it in larger servers.
Add tagscripting support for bump reminder messages
As u know , ur cog for prefix cmd manage ment is great but it needs to be fixed as people can abuse and cause errors to it , u can make a prefix how long u want (even 2000+ chars) which causes the prefix view command to bug and give a error ... the solution is to make the max prefix length to 10 character or so ... this applies for noumenon as well .. and also I pinged u in ur server to tell u but u banned as I felt it was important ..
This issue discusses the goals of the LinkQuoter rewrite.
New settings:
New code functions:
Webhooks can support multiple embeds in a single message, which is useful for servers that uses embeds for their rules and other server information. It would be nice if you could add a command that accepts JSON file uploads to create these multiple embed messages.
[p]webhook send <webhook_link> <message_or_file>
The example in the owner_guide is mis-indented and doesn't give the block a name. It should be:
[p]tagset block add duck
import aiohttp
class RandomDuck(tse.Block):
ACCEPTED_NAMES = ("duck",)
async def process(self, ctx: tse.Context):
async with aiohttp.ClientSession() as session:
async with session.get("https://random-d.uk/api/v2/random") as resp:
data = await resp.json()
return data["url"]
return RandomDuck
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.