Cogs¶
Important
There is full documentation available for all of these cogs, but I can’t get them to import through Sphinx. I have spent too much time trying to learn about decorators and docstrings with no avail.
Please check the source files for the full documentation. If you can help with this, please reach out to me.
Admin¶
This cog provides administrative commands to Discord users with elevated privileges.
-
class
cogs.admin.
Admin
(bot)[source]¶ The Admin cog class.
-
add_discord_command
= <discord.ext.commands.core.Command object>¶
-
delete_messages
= <discord.ext.commands.core.Command object>¶
-
delete_spam_messages
= <discord.ext.commands.core.Command object>¶
-
mute_member
= <discord.ext.commands.core.Command object>¶
-
repeat_message
= <discord.ext.commands.core.Command object>¶
-
unmute_member
= <discord.ext.commands.core.Command object>¶
-
update_discord_command
= <discord.ext.commands.core.Command object>¶
-
update_guild_prefix
= <discord.ext.commands.core.Command object>¶
-
update_presence_listening
= <discord.ext.commands.core.Command object>¶
-
update_presence_playing
= <discord.ext.commands.core.Command object>¶
-
update_presence_streaming
= <discord.ext.commands.core.Command object>¶
-
update_presence_watching
= <discord.ext.commands.core.Command object>¶
-
Chatango¶
This cog allows Chatango users to interact with their Matches account.
-
class
cogs.chatango.
Chatango
(bot)[source]¶ The Chatango cog class.
-
class
ChBot
(name=None, password=None, pm=True)[source]¶ The Chatango bot. A hacky way of having the Discord bot interact with a different website.
-
bet_match
(user, args=[])[source]¶ Submits a bet for a Match.
Parameters: - user – The user submitting the command.
- args – The list of arguments received. None are used.
Returns: The response message for the user.
-
command_handler
(user, cmd, args=[])[source]¶ Checks the command and sends it for final processing. A response is sent back to the user.
Parameters: - user – The user submitting the command.
- cmd – The command to look for.
- args – The parameters for the command.
-
join_rumble
(user, args=[])[source]¶ Provides a quick login link to the website’s Royal Rumble page.
Parameters: - user – The user submitting the command.
- args – The list of arguments received. None are used.
Returns: The response message for the user.
-
login_link
(user)[source]¶ Sends a quick login link to the Matches website.
Parameters: user – The user submitting the command. Returns: The response message for the user.
-
message_handler
(author, message)[source]¶ Reads through the original message and checks to see if a command is requested.
Parameters: - author – The author of the message.
- message – The message to handle.
-
onFloodBan
(room)[source]¶ Called when the bot receives a ban. Message is logged.
Parameters: room – The room the ban was received in.
-
onFloodWarning
(room)[source]¶ Called when the bot receives a warning. Message is logged.
Parameters: room – The room the warning was received in.
-
onMessage
(room, author, message)[source]¶ Called when the bot receives a message in a room. Message is logged and handled.
Parameters: - room – The room the message was sent in.
- author – The author of the message.
- message – The message received.
-
onPMMessage
(pm, author, message)[source]¶ Called when the bot receives a private message. Message is logged and handled.
Parameters: - pm – The room the message was sent in.
- author – The author of the message.
- message – The message received.
-
open_matches
(user)[source]¶ Sends a list of open-bet Matches.
Note
A short-view in plain text is sent, as Chatango does not support rich text.
Parameters: user – The user submitting the command. Returns: The response message for the user.
-
rate_match
(user, args=[])[source]¶ Adds the user’s rating to the most recently closed Match.
Parameters: - user – The user submitting the command.
- args – The list of arguments received. Only the first value is checked. Must cast to type float.
Returns: The response message for the user.
-
register
(user)[source]¶ Registers the user.
Note
The user is registered using their Chatango name. If a user already exists with the same name, the registration will fail. This would have to be resolved manually.
Parameters: user – The user to register. Returns: The response message for the user.
-
reset_pw
(user)[source]¶ Sends a quick reset password link for the Matches website.
Parameters: user – The user submitting the command. Returns: The response message for the user.
-
-
chatango_bot_task
()[source]¶ Creates a separate thread for the Chatango bot.
Note
A thread is required as the Chatango bot is not asynchronous.
-
chatango_log_task
()[source]¶ Cycles through the Chatango bot’s message buffer and sends content to a defined Discord channel.
-
display_users
= <discord.ext.commands.core.Command object>¶
-
send_message
= <discord.ext.commands.core.Command object>¶
-
class
FJBucks¶
This cog provides a useless economy.
Matches¶
This cog allows users to interact with their Matches account.
-
class
cogs.matches.
Matches
(bot)[source]¶ The Matches cog class.
-
current_champions
= <discord.ext.commands.core.Command object>¶
-
current_match_info
= <discord.ext.commands.core.Command object>¶
-
leaderboard_season1
= <discord.ext.commands.core.Command object>¶
-
leaderboard_season2
= <discord.ext.commands.core.Command object>¶
-
leaderboard_season3
= <discord.ext.commands.core.Command object>¶
-
match_info
= <discord.ext.commands.core.Command object>¶
-
open_matches
= <discord.ext.commands.core.Command object>¶
-
place_match_bet
= <discord.ext.commands.core.Command object>¶
-
rate_match
= <discord.ext.commands.core.Command object>¶
-
recent_match_info
= <discord.ext.commands.core.Command object>¶
-
royalrumble_info
= <discord.ext.commands.core.Command object>¶
-
superstar_birthdays
= <discord.ext.commands.core.Command object>¶
-
superstar_info
= <discord.ext.commands.core.Command object>¶
-
upcoming_events
= <discord.ext.commands.core.Command object>¶
-
user_current_bets
= <discord.ext.commands.core.Command object>¶
-
user_join_royalrumble
= <discord.ext.commands.core.Command object>¶
-
user_stats_season1
= <discord.ext.commands.core.Command object>¶
-
user_stats_season2
= <discord.ext.commands.core.Command object>¶
-
user_stats_season3
= <discord.ext.commands.core.Command object>¶
-
Member¶
This cog provides basic bot interactions to Discord members.
-
class
cogs.member.
Member
(bot)[source]¶ The Member class for the cog.
-
countdown
= <discord.ext.commands.core.Command object>¶
-
flip_coin
= <discord.ext.commands.core.Command object>¶
-
hug_member
= <discord.ext.commands.core.Command object>¶
-
invite
= <discord.ext.commands.core.Command object>¶
-
joined
= <discord.ext.commands.core.Command object>¶
-
member_roles
= <discord.ext.commands.core.Command object>¶
-
misc_commands
= <discord.ext.commands.core.Command object>¶
-
mock_member
= <discord.ext.commands.core.Command object>¶
-
punch_member
= <discord.ext.commands.core.Command object>¶
-
register_user
= <discord.ext.commands.core.Command object>¶
-
report
= <discord.ext.commands.core.Command object>¶
-
roll_dice
= <discord.ext.commands.core.Command object>¶
-
send_discord_id
= <discord.ext.commands.core.Command object>¶
-
slap_member
= <discord.ext.commands.core.Command object>¶
-
tickle_member
= <discord.ext.commands.core.Command object>¶
-
uptime
= <discord.ext.commands.core.Command object>¶
-
user_login_link
= <discord.ext.commands.core.Command object>¶
-
user_reset_password_link
= <discord.ext.commands.core.Command object>¶
-
Scheduler¶
This cog handles scheduled messages to a channel.
-
class
cogs.scheduler.
Scheduler
(bot)[source]¶ The Scheduler cog class.
-
check_scheduler
¶ A background task helper that abstracts the loop and reconnection logic for you.
The main interface to create this is through
loop()
.
-
scheduler_pending
= <discord.ext.commands.core.Command object>¶
-
scheduler_task
(payload)[source]¶ Handles a single weekly scheduled message by creating the message and sleeping until the appropriate time defined in the message.
Important
The channel the message is sent to is defined in
config
. Modify where appropriate for your own Discord server.Parameters: payload – The event details to deliver. See utils.fjclasses.DbHelper.chatroom_scheduler_list()
.
-
Twitter¶
This cog communicates with Twitter.
-
class
cogs.twitter.
Twitter
(bot)[source]¶ The Twitter cog class.
-
class
MyStreamListener
(api=None)[source]¶ A streaming class that listens to live Twitter activity.
Important
This is a work in progress. Twitter has updated their API and Tweepy support hasn’t caught up.
-
latest_tweets
(twitter_id, count=1)[source]¶ Fetches the latest tweets from a Twitter user’s timeline.
Parameters: - twitter_id – The Twitter account’s id to get the timeline from.
- count – The amount of tweets to get from the timeline. Default is 1.
Returns: A list of tweets.
-
live_tweet
(msg)[source]¶ Tweets out a message.
Parameters: msg – The message to tweet out. Returns: A hyperlink to the tweet after it’s posted.
-
send_tweet
= <discord.ext.commands.core.Command object>¶
-
superstar_tweets
= <discord.ext.commands.core.Command object>¶
-
class
Voice¶
This cog plays audio in voice channels on request.
-
class
cogs.voice.
YTDLSource
(source, *, data, volume=0.5)[source]¶ Creates a player from a YouTube URL.
Note
Based off the discord voice example.
-
classmethod
from_url
(url, *, loop=None, stream=False)[source]¶ Prepares the audio from the URL.
Note
If the URL points to a playlist, it takes the first item from the list.
Parameters: - url – The YouTube URL for the audio to play.
- loop – The event loop to use. Default is None.
- stream – Whether to download or stream the source. Default is False.
Returns: The audio player.
-
classmethod
-
class
cogs.voice.
Voice
(bot)[source]¶ The Voice cog class.
-
change_volume
= <discord.ext.commands.core.Command object>¶
-
ensure_voice
(ctx)[source]¶ Checks if the voice channel can be started.
Note
- The requester must be in a voice channel.
- Stops a current player if it currently exists.
Parameters: ctx – The invocation context.
-
join
= <discord.ext.commands.core.Command object>¶
-
pause_audio
= <discord.ext.commands.core.Command object>¶
-
play_local
= <discord.ext.commands.core.Command object>¶
-
play_yt
= <discord.ext.commands.core.Command object>¶
-
resume_audio
= <discord.ext.commands.core.Command object>¶
-
stop_audio
= <discord.ext.commands.core.Command object>¶
-
stream_yt
= <discord.ext.commands.core.Command object>¶
-