tmercswims / tmerc-cogs Goto Github PK
View Code? Open in Web Editor NEWCogs for the Red Discord bot.
License: GNU General Public License v3.0
Cogs for the Red Discord bot.
License: GNU General Public License v3.0
Hi,
I have been using your custom join/leave sounds cog for a little while now and I am having a problem with it when the bot is playing audio already in the server.
The audio goes all weird (I assume as it is trying to play two audio sources at once) and then disconnects after the join/leave sound has finished, without letting it finish the music.
I've tried to change a few parts of the code, but as a Programming newbie, I am struggling.
Any help is hugely appreciated.
Jake
[โ] Bug report
[ ] Feature request or improvement for an existing cog
randimals
shibe.online seems to be having problems with HTTPS, and while the code uses https the cog isn't able to retrieve a random bird or cat from shibe.online. I was unable to get a bird picture.
I believe this is a problem in shibe.online's end because browser yells about the unsafe cert too.
Using http instead of https fixes this and the images can be retrieved again: url = 'http://shibe.online/api/birds?count=1'
[p]cat
or [p]bird
(Additional info: Debian 8 Jessie, Red - Version 3.0.0b14, Python 3.5.3+)
[x] Bug report
[ ] Feature request or improvement for an existing cog
Survey
Trying to send a survey to a server with almost 300 people. The bot just throws an exception
Send command .startsurvey @shimin #surveys "How do you rate your current experience in Phantom? On a scale of 1 to 5. Just respond back to glitch with the number representing your experience." 1;2;3;4;5 8/29/2017 13:00 CST
Watch as bot throws an error trying to PM 280 People
Exception in command 'startsurvey'
Traceback (most recent call last):
File "lib/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "/root/glitch/Red-DiscordBot/cogs/survey.py", line 527, in _startsurvey
await self._update_answers_message(server.id, new_survey_id)
File "/root/glitch/Red-DiscordBot/cogs/survey.py", line 301, in _update_answers_message
"{}\n{}".format("Awaiting answers from:", cf.box(waiting)))
File "red.py", line 92, in send_message
return await super().send_message(*args, **kwargs)
File "lib/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "lib/discord/http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "lib/discord/ext/commands/bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "lib/discord/ext/commands/core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "lib/discord/ext/commands/core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)
Cog in question
Which cog is having an issue? NestedCommands
Describe the bug
A clear and concise description of what the problem is.
NestedCommands conflicts with Crier because both use say
as one of their commands. Please consider changing your say
to repeat
instead as I feel that it fits your action more than say
compared to Crier.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
[ ] Bug report
[ x ] Feature request or improvement for an existing cog
survey
An option so it just shows the number of people who voted for it which choice instead of their usernames.
This would be better for people with large servers or if you want to make the vote anonymous.
[*] Bug report
[ ] Feature request or improvement for an existing cog
Reviewemoji
Aiohttp no attribute get
Screenshot : https://preview.ibb.co/kPvvuf/Screenshot-20181114-100901.jpg
Paste it here.
Welcome
More bot messages.
currently you can only set a custom bot message when a bot joins id love to be able to set a message for when a bot leaves too ex: "welp {bot.mention} looks like you've been replaced.."
[X] Bug report
[ ] Feature request or improvement for an existing cog
Welcomer for V3
After a installation of the welcomer and after a setup welcomer stops posting welcome messages after a random time. Reinstall/Reload will not solve the problem.
No changes in permissions of the bot and/or channel.
Posting the example will work fine.
N/A
[ ] Bug report
[X] Feature request or improvement for an existing cog
Welcome
Running [p]welcomeset with a whisper messages > 1024 characters, an exception is thrown. Whisper message should be clipped if its too long, as an example here:
format(j['enabled'], j['delete'], jw['state'], jw['message'] if len(jw['message']) <= 50 else jw['message'][:50] + "...", len(j['messages']), j['bot'],
prefix=ctx.prefix))
[ X ] Bug report
[ ] Feature request or improvement for an existing cog
retakechannels
Everything from the cog seems to work fine but will fail at the RCON part due to "sm_player_teams" not being a recognised command. Is that something private you have or is it part of a public addon? Couldn't find anything by googling the command
Unknown command "sm_player_teams"
[ ] Bug report
[X] Feature request or improvement for an existing cog
Welcome
I've added a new welcome join whisper type: Fallback. It tries to send the whisper message to the user in a DM, if it fails (for whatever reason, normally if the user has DM from server members turned off), it will send the whisper message to the channel set for Welcomes.
This is good so that those with that setting turned off they can still get the welcome message, and not miss out on important info.
Relevant code:
enums.py:
class WhisperType(Enum):
OFF = 'off'
ONLY = 'only'
BOTH = 'both'
FALLBACK = 'fall'
welcome.py:
Exception to throw if whisper fails
class WhisperError(Exception):
pass
class WelcomeCustom(getattr(commands, "Cog", object)):
"""Announce when users join or leave a server."""
@commands.Cog.listener()
async def on_member_join(self, member: discord.Member):
"""Listens for member joins."""
guild = member.guild
guild_settings = self.config.guild(guild)
if await guild_settings.enabled() and await guild_settings.join.enabled():
# join notice should be sent
message_format = None
if member.bot:
# bot
message_format = await guild_settings.join.bot()
else:
# only increment when it isn't a bot
await self.__increment_count(guild, 'join')
whisper_type = await guild_settings.join.whisper.state()
if whisper_type != 'off':
try:
await self.__dm_user(member)
except:
if whisper_type == 'fall':
message_format = await self.config.guild(member.guild).join.whisper.message()
await self.__handle_event(guild, member, 'join', message_format=message_format)
return
if whisper_type == 'only' or whisper_type == 'fall':
# we're done here
return
await self.__handle_event(guild, member, 'join', message_format=message_format)
async def __dm_user(self, member: discord.Member):
"""Sends a DM to the user with a filled-in message_format."""
message_format = await self.config.guild(member.guild).join.whisper.message()
try:
await member.send(message_format.format(member=member, server=member.guild))
except discord.Forbidden:
log.error(
("Failed to send DM to member ID {0.id} (server ID {1.id}): insufficient permissions"
"").format(member, member.guild)
)
raise WhisperError("Error.")
except:
log.error(
("Failed to send DM to member ID {0.id} (server ID {1.id})"
"").format(member, member.guild)
)
raise WhisperError("Error.")
@welcomeset_join_whisper.command(name='type')
async def welcomeset_join_whisper_type(self, ctx: commands.Context, choice: WhisperType):
"""Set if a DM is sent to the new member.
Options:
off - no DM is sent
only - only send a DM to the member, do not send a message to the channel
both - send a DM to the member and a message to the channel
fall - send a DM to the member, if it fails send the whisper message to the channel instead
"""
guild = ctx.guild
whisper_type = choice.value
channel = await self.__get_channel(ctx.guild)
await self.config.guild(guild).join.whisper.state.set(whisper_type)
if choice == WhisperType.OFF:
await ctx.send(
("I will no longer DM new members, and will send a notice to {0.mention}."
"").format(channel)
)
elif choice == WhisperType.ONLY:
await ctx.send(
("I will now only DM new members, and will not send a notice to {0.mention}."
"").format(channel)
)
elif choice == WhisperType.BOTH:
await ctx.send(
("I will now send a DM to new members, as well as send a notice to {0.mention}."
"").format(channel)
)
elif choice == WhisperType.FALLBACK:
await ctx.send(
("I will now send a DM to new members, and if that fails I will send the message to {0.mention}."
"").format(channel)
)
[ ] Bug report
[x] Feature request or improvement for an existing cog
Quotes
A command to post a random quote using all of the servers indexes, like a global version of [p]quote
Paste it here.
randimals
I was disappointed to see, there is no command for ducks and bunnies
I found an API for duck images and bunny images
Ducks: https://random-d.uk/api/random
Bunnies: https://api.bunnies.io/v2/loop/random/?media=gif
Survey
Receive the following error message when trying to close a survey:
Error in command 'closesurvey' - KeyError: 'closed'
[27/10/2016 06:22] ERROR red on_command_error 88: Exception in command 'closesurvey'
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "/home/kinshikuma/Red-DiscordBot/cogs/survey.py", line 524, in _closesurvey
if survey_id in self.surveys["closed"]:
KeyError: 'closed'
Enhancement Request:
The ability to use variables for guild count, user count etc. would be nice.
Store sounds per server, instead of globally.
Store in json settings, based on filename.
Things to consider:
I usually use the massdm cog and it was working just fine but today I tried to use it (nothing wrong with the process) and I faced this issue. i tried it in both python versions ( 3.5 and 3.6 ) but still the same error
#Here is the error I see in the console:
Traceback (most recent call last):
File "/root/Red-DiscordBot/cogs/owner.py", line 64, in load
self._load_cog(module)
File "/root/Red-DiscordBot/cogs/owner.py", line 945, in _load_cog
mod_obj = importlib.import_module(cogname)
File "/usr/lib64/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 985, in _gcd_import
File "", line 968, in _find_and_load
File "", line 957, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 697, in exec_module
File "", line 222, in _call_with_frames_removed
File "/root/Red-DiscordBot/cogs/massdm.py", line 4, in
from redbot.core import commands, checks
ImportError: No module named 'redbot'
#Here is the error I see on discord:
Cog was found and possibly loaded but something went wrong. Check your console or logs for more information.
As of last week, I attempted to use the MassDM command to let people know regarding a few things. However, at some point the bot was blocked from sending DM's as it was triggered by Discord's anti-spam system which prevented the bot to send further DM's.
Your bot has been flagged by our anti-spam system for abusive behavior. While your bot is quarantined, it is unable to join any more guilds, or send any direct messages to users it has not messaged before. If you believe this to be in error, click here and select "Appeal an Action Trust and Safety took on my bot" as the Report Type to submit an appeal.
I believe this particular discord feature was added as of late last year.
Add another field to each option, alias
, which one can set to have an alias for the option when answering.
For example:
yes:y;no:n;maybe:m;
Or with all the other options as well:
yes:y:10;no:n;maybe:m::30:yes
Useful for situations where each option is a link (to a video, or whatever) and you want people to be able to just say 1
instead of 1. https://...
Cog in question
randimals
Describe the bug
When using the fox
command, sometimes the random fox is too large and the user sees a generic error message:
Error in command 'fox'. Check your console or logs for details.
To Reproduce
Steps to reproduce the behavior:
Unfortunately, since the images are random, it's hard to come up with a reproducible case.
Expected behavior
We expected to see a fox image.
Additional context
Traceback:
[2020-01-13 19:02:14] [ERROR] red: Exception in command 'fox'
Traceback (most recent call last):
File "/home/synrg/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "/home/synrg/.local/share/Dumbo/cogs/CogManager/cogs/randimals/randimals.py", line 76, in fox
await ctx.send(file=discord.File(io.BytesIO(await image.read()), filename=filename))
File "/home/synrg/.local/lib/python3.8/site-packages/redbot/core/commands/context.py", line 82, in send
return await super().send(content=content, **kwargs)
File "/home/synrg/.local/lib/python3.8/site-packages/discord/abc.py", line 805, in send
data = await state.http.send_files(channel.id, files=[file],
File "/home/synrg/.local/lib/python3.8/site-packages/discord/http.py", line 222, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 413 REQUEST ENTITY TOO LARGE (error code: 40005): Request entity too large
Replies to messages which have basic grammatical errors, correcting them.
Examples:
hi mom
[ ] Bug report
[X ] Feature request or improvement for an existing cog
I got pictures in a folder. Is it possible to make the cog pick a random image (like it do) but when it picks the next random image it makes sures it picks a new one and not the same. Also that it does not post the picture(s) again before all the pictures in that folder have been posted.
Currently you can only add directories or pictures by having direct access to the bot. That's silly.
As a side-effect, make categories (directories) per-server instead of global.
User A: has a join sound, but no leave sound
User B: has both a join and leave sound
B's leave sound should be played in channel X.
Hello, i'm getting error on any kinda of command i try to use:
Exception in command 'r6s profile'
Traceback (most recent call last):
File "lib/discord/ext/commands/core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "/cogs/rainbow6siege.py", line 117, in _profile
p = await self.get_player(player, platform)
File "/cogs/rainbow6siege.py", line 59, in get_player
).get_player(player, plat)
File "lib/r6sapi/r6sapi.py", line 441, in get_player
results = yield from self.get_players(term, platform)
File "lib/r6sapi/r6sapi.py", line 413, in get_players
data = yield from self.get("https://public-ubiservices.ubi.com/v2/profiles?nameOnPlatform=%s&platformType=%s" % (parse.quote(term), parse.quote(platform)))
File "lib/r6sapi/r6sapi.py", line 374, in get
yield from self.connect()
File "lib/r6sapi/r6sapi.py", line 351, in connect
raise FailedToConnect
r6sapi.r6sapi.FailedToConnect
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "lib/discord/ext/commands/bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "lib/discord/ext/commands/core.py", line 634, in invoke
yield from ctx.invoked_subcommand.invoke(ctx)
File "lib/discord/ext/commands/core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "lib/discord/ext/commands/core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: FailedToConnect:
streamrole
Currently I have a role that yag is set to ignore the problem is its not so much as a ignore as a don't let this user have this role this seems to be the same case with this cog thus causing a feedback loop where the cog gives me the role and yag removes it.
Something that detects this spam and prevents it this is a issue with both yag and this cog and both would have to change for the issue to be resolved completely
[X ] Bug report
[X ] Feature request or improvement for an existing cog
CustomJoinLeave
I am struggling to lower the volume of the sound it plays. I changed the "volume=volume=1" to "volume=volume=0.1" but it hasn't made a difference. Is this configured somewhere else?
To add to it, maybe a command to set the volume of the join/leave sounds might be a good idea. Maybe on a per-user basis?
welcome
When adding a role ping <@&[Role ID]> it doesn't ping the role.
Screenshot_20210924-195151_Discord-Beta
(And yes I have the role that's being pinged)
If you try to play mp3\m4a while youtube is playing it will crash but with this msg.
http://i.imgur.com/hV17QUt.png
If you try to play wav file while youtube is playing it will start switching back and forth each buffer amount of time in ffmpeg? between two streams, can record audio of that if needed.
Then it will give up on producing sound and print this error message repeatedly.
http://pastebin.com/ggCmVtB1
It does works as intended with all 3 formats mentioned when youtube is not playing.
[ ] Bug report
[ X ] Feature request or improvement for an existing cog
massdm
The cog can't handle roles which use more than one word
[ ] Bug report
[ x ] Feature request or improvement for an existing cog
survey
Ability for the cog to add members who get the role after the survey has started.
[ ] Bug report
[ x ] Feature request or improvement for an existing cog
streamrole
I want to give roles, if someone is playing game right now and take it back, if he stop playing it.
[ ] Bug report
[x] Feature request or improvement for an existing cog
Randimals
I would like an option for bunnies, owls, and bat random images, please? Bunnies always make everyone feel better<3
Paste it here.
customjoinleave starts unloaded and never loads unless it's loaded by an admin.
Is this a bug only affecting me?
takes ages settings everyones sound, wish there was an option to change whole groups. primarily leave sounds.
so if an admin leaves a chat everyone hears admin.mp3, if a standard member they'l hear member.mp3, and so on. with more people joining discord its hard settings sounds for each members.
[x] Bug report
[ ] Feature request or improvement for an existing cog
rainbow6siege
Usage of "stats" command for newer players causes a divide by 0 error because the Ubisoft API stopped tracking shots fired (but not shots landed) at some point. Consequently, the bot tries to p.bullets_hit / p.bullets_fired
when bullets_fired is 0.
[I already dirty-fixed this locally with the below code, so I no longer have a stack trace available, but it clearly indicated there was a divide by 0 error]
Add a check of "if 0, substitute with 1" to the shots fired count in the "Shots" field, e.g.
(p.bullets_hit / p.bullets_fired if
p.bullets_fired > 0 else 1) * 100),
p.headshots)
(I'd put in a pr but I've honestly forgotten how to do that since the last time I had to use git)
Instead, the deadline is pushed forward one day (as if it was given as just a time).
[X] Bug report
[ ] Feature request or improvement for an existing cog
Streamrole V3 version
When a user stops streaming, bot almost never removes the role. And gives the exception link below. It is not a permission error as the bot has full administrator power and is higher on the role hierarchy, if it was a permission error I would have received the forbidden trace.
According to d.py rewrite docs only other exception that can be thrown is a HTTPException.
https://github.com/tmercswims/tmerc-cogs/blob/v3/streamrole/streamrole.py#L221
Right now there is only one audio player total, which makes playing sounds simultaneously in more than one server not really work.
[ 1 ] Bug report
Customjoinleave
The cog wont load onto the bots files or work at all
Paste it here.
Its to long i cant copy it
[ ] Bug report
[ x] Feature request or improvement for an existing cog
welcome
Optional embed for welcome/leave messages
Survey
On two bots, once a survey is started, it ends immediately. No matter the "Time" or "Time Zone"
I have reinstalled the cog many times, both by commands and serverside.
survey
I had a hard time figuring out the timezone setting. Is it counting towards the bot time or Discord server time or end user time?
My bot is on CET, I have tried setting a 5 minutes deadline (without specifying timezone) but survey still accepting data'
Paste it here.
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.