Cogs for Twentysix26's Red Discord bot.
To add this repository to your bot, use the following command:
[p]cog repo add tmerc-cogs https://github.com/tmercswims/tmerc-cogs
Gets random cat facts.
catfact [number]
- Getsnumber
random facts about cats.number
defaults to1
, and must be no greater than10
.
- None.
- Cog uses a small amount of network traffic to retrieve facts.
Plays user-customizable sounds when joining or leaving a voice channel.
Each user may set their own join/leave sounds. Bot admins may set or delete sounds for other people, and control whether sounds are played at all.
joinleaveset <command>
(Bot admin only) - Changes settings for the cog.togglejoin
- Toggles playing of custom join sounds on or off.toggleleave
- Toggles playing of custom leave sounds on or off.
setjoinsound [link]
- Sets the join sound for the calling user. Must be called either as the comment on an uploaded file (Discord attachment) or a direct link to a sound file must be provided.setleavesound [link]
- Sets the leave sound for the calling user. Must be called either as the comment on an uploaded file (Discord attachment) or a direct link to a sound file must be provided.deljoinsound
- Deletes the calling user's join sound.delleavesound
- Deletes the calling user's leave sound.setjoinsoundfor <user> [link]
(Bot admin only) - Sets the join sound for the specified user (must be an @mention). Same file rules apply as withsetjoinsound
.setleavesoundfor <user> [link]
(Bot admin only) - Sets the leave sound for the specified user (must be an @mention). Same file rules apply as withsetleavesound
.deljoinsoundfor <user>
(Bot admin only) - Deletes the join sound for the specified user (must be an @mention).delleavesoundfor <user>
(Bot admin only) - Deletes the leave sound for the specified user (must be an @mention).
- None.
- Cog can use quite a lot of disk space, depending on how many users set sounds, as the sound files must be saved. This is something to consider as a bot owner who plans to make the bot public.
- Cog uses network to retrieve sound files.
Get KZ (CS:GO Kreedz Mod) stats from a server (via FTP) and show them in Discord.
Note that commands which specify a player must be given the player's Steam Vanity URL, not their in-game name.
kzset <command>
(Bot admin only) - Changes settings for the cog.server
- Sets the hostname of the KZ server.username
- Sets the FTP username with which to log into the server.password
- Sets the FTP password with which to log into the server. The message containing the command (and password) is deleted immediately.dbpath
- Sets the path, from root, to the database file on the FTP server. Must include the file itself, e.g./path/to/db.sq3
not/path/to
.steamkey
- Sets the Steam API key, which is used to look up users' vanity URLs. It can be obtained from here. The message containing the command (and key) is deleted immediately.rcon_password
- Sets the RCON password for the server. The message containing the command (and password) is deleted immediately.mapcyclepath
- Sets the path, from root, to themapcycle.txt
file on the FTP server. Must include the file itself, e.g./path/to/mapcycle.txt
not/path/to
.
addmap <map_id_or_url>
(Bot admin only) - Adds the given map to the server. Must provide either a workshop ID (e.g.784686492
) or a full workshop link (e.g.https://steamcommunity.com/sharedfiles/filedetails/?id=784686492&searchtext=kz_minimalism
).recent [limit]
- Gets thelimit
most recent record-setting runs. Retrieves a maximum of one per map, per run type.limit
defaults to10
.playermap <player_url> <mapname>
- Gets the specified player's time(s) on the specified map.playerjumps <player_url>
- Gets the specified player's jump records.maptop <mapname> [runtype] [limit]
- Gets the toplimit
times on the specified map.runtype
specifies the type of run, one ofall
,tp
, orpro
, and defaults toall
.limit
defaults to10
.jumptop
- Gets the top stats for a jump type.all
- Gets the server record for each jump type.blocklj [limit]
- Gets the toplimit
block longjumps.limit
defaults to10
.lj [limit]
- Gets the toplimit
longjumps.limit
defaults to10
.bhop [limit]
- Gets the toplimit
bunnyhops.limit
defaults to10
.multibhop [limit]
- Gets the toplimit
multi-bunnyhops.limit
defaults to10
.dropbhop [limit]
- Gets the toplimit
drop-bunnyhops.limit
defaults to10
.wj [limit]
- Gets the toplimit
weirdjumps.limit
defaults to10
.laj [limit]
- Gets the toplimit
ladderjumps.limit
defaults to10
.cj [limit]
- Gets the toplimit
countjumps.limit
defaults to10
.
beautifulsoup4
python-valve
(from GitHub:git+git://github.com/Holiverh/python-valve.git
)rfc3987
tabulate
- Cog uses network to retrieve database from server.
- Cog runs semi-complex SQL queries on the retrieved database to get information, which can potentially be processor intensive.
Displays a random ASCII face.
lenny
- Sends a random ASCII face.
- None.
- None.
Send a personalizable DM to all members of a Role.
mdm <role> <message>
(Bot mod only) - Sendsmessage
to all members of the server that haverole
.message
is personalizable:{0}
is the member being messaged;{1}
is the role through which they are being messaged;{2}
is the person sending the message.
- None.
- None.
Announce membership-related events (join, leave, ban, unban) in chat.
All message format strings have the following personalizations available: {0}
is the member in question; {1}
is the server in question.
membershipset <command>
(Bot admin only) - Changes settings for the cog.toggle
- Toggles membership event announcement on or off.channel <channel>
- Sets the channel to which announcements are sent. If this is not set manually, the default text channel will be used.join <format_str>
- Sets the join message.leave <format_str>
- Sets the leave message.ban <format_str>
- Sets the ban message.unban <format_str>
- Sets the unban message.
- None.
- Cog adds listeners for the following events:
on_member_join
,on_member_remove
,on_member_ban
, andon_member_unban
.
THIS COG IS DEPRECATED AND NO LONGER MAINTAINED. Please use 'sfx' by FlapJack instead. Play sounds in voice channels.
playsound <soundname>
- Plays the specified sound in the voice channel in which the caller is currently.soundname
must be the case-accurate filename of a sound indata/playsound
, excluding the extension.allsounds
- Sends a DM to the caller with an alphabetical list of every sound.addsound [link]
(Bot mod only) - Adds the provided sound. Must be called either as the comment on an uploaded file (Discord attachment) or a direct link to a sound file must be provided.soundvol <soundname> [percent]
(Bot mod only) - Sets or gets the volume for the specified sound. Ifpercent
is given, the volume for the specified sound is set to it. If it is not, the current volume for the sound is returned. If a sound's volume is never explicitly set, it defaults to 25%.getsound <soundname>
- Sends the specified sound file as a Discord attachment.delsound <filename>
- Deletes the specified sound.
- None.
- Cog can use a lot of disk space, depending on how many sounds you have. Worth noting for bot owners.
- Cog uses network to retrieve new sounds.
Store quotes, and get back random ones.
addquote <new_quote>
- Adds a new quote to the list.delquote <number>
- Deletes the quote with the specified number.allquotes
- Sends a DM to the calling user with all the quotes in number order.quote [number]
- Sends a random quote ifnumber
is not specified, or the quote corresponding tonumber
if it is.
- None.
- None.
Cycles the bot's game randomly among a list at a regular interval.
randgame <command>
(Bot mod only) - Changes cog settings.delay <seconds>
- Sets the delay, in seconds, between game changes.add <game>
- Adds a new game to the list.del <game>
- Removes a game from the list.set <games...>
- Replaces the current game list with the specified one.get
- Shows the current list of games.cycle
- Forces choosing a new game, bypassing the delay.
- None.
- Adds a persistent event to the bot which is used to change the game at interval, but it spends the vast majority of its time asleep, so it will not have an impact on performance.
Gets a random image from a local directory.
randimage <category> [delete]
- Uploads a random image fromcategory
(and optionally deletes it).delete
defaults toFalse
.addcategory <new_category>
(Bot mod only) - Creates a new category.delcategory <category>
(Bot mod only) - Deletes a category and all images in it.allcategories
- Sends a DM to the calling user with a list of all the categories, and the number of images in each.addimage <category> [image_url]
(Bot mod only) - Adds a new image to the specified category. Must be called either as the comment on an uploaded file (Discord attachment) or a direct link to an image file must be provided.
- None.
- Cog can potentially use an enormous amount of disk space, depending on how many images are uploaded.
Shows random animals.
cat
- Shows a random cat.dog
- Shows a random dog.fox
- Shows a random fox.bird
- Shows a random bird.
- None.
- Cog uses network to retrieve images.
Allows for users to submit emoji, and then moderators to approve/reject them.
submitemoji <name> [img_url]
- Submits a new emoji for review. Must be called either as the comment on an uploaded image (Discord attachment) or a direct link to an image must be provided.checkemoji <submission_id>
- Checks the status of an emoji submission.reviewemoji
(Bot admin only) - Shows each submission, allowing the caller to approve or reject each.
python-dateutil
- Cog will only be able to add emojis if your bot is whitelisted for emoji creation. I was unable to get my own bot whitelisted, as Discord told me they don't actually do this anymore. So unless that changes, this cog will never actually be useful.
- Cog uses network to retrieve images for new emoji.
Assign a configurable role to anyone who is streaming.
streamroleset <command>
(Bot admin only) - Changes cog settings.toggle
- Turns role assignment for streamers on or off.role <role>
- Sets the role that should be assigned to members who are currently streaming.
- None.
- None.
Run surveys via Discord DMs, and display the results in a text channel. Can be used for surveys, polls, or signups for an event.
startsurvey <role> <channel> <question> <options> <deadline>
(Bot admin only) - Starts a new survey.closesurvey <survey_id>
(Bot admin only) - Closes the survey with the specified ID immediately.changeanswer <survey_id>
- Allows the calling user to answer the survey with the specified ID again, replacing their previous answer.
python-dateutil
pytz
tabulate
- The deadline for the survey specifies an absolute point in time at which the survey should automatically close. If a timezone is provided, that is taken into account. If one is not, UTC is assumed. If we say that it is currently 10:00AM PST on June 15, 2016, the rules for deadlines are the following:
- If a time of day is given, but a date is not, the deadline will be set to the next time the given time of day will occur. In our situation, if the deadline is set to
9:OOAM PST
, the deadline will be 9:00AM PST, June 16, 2016. If it is set to11:00AM PST
, it will be 11:00AM PST, June 16, 2016. 10:00AM PST
is18:00 UTC
. If the deadline is given without a timezone, such as6:00PM
, is assumed to be6:00PM UTC
.- If a date is given, but a time of day is not, the deadline will be 00:00 (12:00 midnight) on the given date.
- If both a time of day and date are given, the deadline will be set to that exact point in time.
- For any deadline that includes a date, if the absolute point in time is more than one day in the past, an error will occur.
- There is a situation where, if a given deadline has a date (and has or does not have a time of day), but is less than one day in the past, it will be pushed forward one day instead of erroring. This is a known issue.
- If a time of day is given, but a date is not, the deadline will be set to the next time the given time of day will occur. In our situation, if the deadline is set to
- There is currently a problem with deadlines that are too far in the future. This is a limitation of Python itself, and I can do nothing to get around it. The documentation states delays should not be over one day, but the actual limitation is integer overflow, so delays can be longer than that. See https://docs.python.org/3/library/asyncio-eventloop.html#delayed-calls and https://bugs.python.org/issue20493 for more information.
- Cog creates a lot of background tasks to listen for answers from people. Most of the time they are sleeping, so it should not affect performance.
If you find a reproducible bug with any of my cogs, or have a suggestion for an enhancement or new feature, please open an issue on GitHub and I will do my best to help you out.
If you are running into issues, please join my support channel in the Red-Cogs server and ask there.