## v2.1.3 | |||||
**BEFORE UPDATING, UPDATE ALL DEPENDANCIES USING** `python3 -m pip install -Ur requirements.txt` **IN YOUR VENV** | |||||
- Moved over cogs to use new method introduced in the rewrite of discord.py | |||||
- Changed wording of the role not found errors. | |||||
## v2.1.2 | ## v2.1.2 | ||||
- Fixed bug where Roxbot's delete function would delete itself. | - Fixed bug where Roxbot's delete function would delete itself. | ||||
- Fixed more trivia error handling | - Fixed more trivia error handling |
__author__ = "Roxanne Gibson" | __author__ = "Roxanne Gibson" | ||||
__license__ = "MIT" | __license__ = "MIT" | ||||
__copyright__ = "Copyright 2015-2017 Roxanne Gibson <me@roxxers.xyz>" | __copyright__ = "Copyright 2015-2017 Roxanne Gibson <me@roxxers.xyz>" | ||||
__version__ = "2.1.2" | |||||
__version__ = "2.1.3" | |||||
__description__ = """Roxbot: An inclusive modular multi-purpose Discord bot. Built with love (and discord.py) by Roxxers#7443. | __description__ = """Roxbot: An inclusive modular multi-purpose Discord bot. Built with love (and discord.py) by Roxxers#7443. | ||||
Roxbot is designed be a multi-purpose bot and provide many different services for users and moderators alike with a focus on customisability. | Roxbot is designed be a multi-purpose bot and provide many different services for users and moderators alike with a focus on customisability. |
guild_id = Required(int, size=64) | guild_id = Required(int, size=64) | ||||
class Admin: | |||||
class Admin(commands.Cog): | |||||
""" | """ | ||||
Admin Commands for those admins | Admin Commands for those admins | ||||
""" | """ |
return await roxbot.http.api_request(url, headers={"Authorization": tat_token}) | return await roxbot.http.api_request(url, headers={"Authorization": tat_token}) | ||||
class AssortedGenderSounds: | |||||
class AssortedGenderSounds(commands.Cog): | |||||
"""Custom Cog for the AssortedGenderSounds Discord Server.""" | """Custom Cog for the AssortedGenderSounds Discord Server.""" | ||||
def __init__(self, bot_client): | def __init__(self, bot_client): | ||||
self.bot = bot_client | self.bot = bot_client | ||||
} | } | ||||
} | } | ||||
@commands.Cog.listener() | |||||
async def on_member_join(self, member): | async def on_member_join(self, member): | ||||
if member.guild.id == ags_id: | if member.guild.id == ags_id: | ||||
role = member.guild.get_role(newbie) | role = member.guild.get_role(newbie) |
hash = Required(str, unique=True) | hash = Required(str, unique=True) | ||||
class CustomCommands: | |||||
class CustomCommands(commands.Cog): | |||||
"""The Custom Commands cog allows moderators to add custom commands for their Discord server to Roxbot. Allowing custom outputs predefined by the moderators. | """The Custom Commands cog allows moderators to add custom commands for their Discord server to Roxbot. Allowing custom outputs predefined by the moderators. | ||||
For example, we can set a command to require a prefix and call it "roxbot" and configure an output. Then if a user does `;roxbot` roxbot will output the configured output. | For example, we can set a command to require a prefix and call it "roxbot" and configure an output. Then if a user does `;roxbot` roxbot will output the configured output. | ||||
output.pop("color") | output.pop("color") | ||||
return output | return output | ||||
@commands.Cog.listener() | |||||
async def on_message(self, message): | async def on_message(self, message): | ||||
""" | """ | ||||
""" | """ |
import roxbot | import roxbot | ||||
class Fun: | |||||
class Fun(commands.Cog): | |||||
"""The Fun cog provides many commands just meant to be fun. Full of a lot of misc commands as well that might provide a few laughs or be entertaining.""" | """The Fun cog provides many commands just meant to be fun. Full of a lot of misc commands as well that might provide a few laughs or be entertaining.""" | ||||
def __init__(self, bot_client): | def __init__(self, bot_client): | ||||
self.bot = bot_client | self.bot = bot_client |
return cls(rows=rows, colours=colours) | return cls(rows=rows, colours=colours) | ||||
class ImageEditor: | |||||
class ImageEditor(commands.Cog): | |||||
"""The ImageEditor cog is a cog with multiple commands to manipulate images provided by the user.""" | """The ImageEditor cog is a cog with multiple commands to manipulate images provided by the user.""" | ||||
def __init__(self, bot_client): | def __init__(self, bot_client): |
guild_id = Required(int, size=64, unique=True) | guild_id = Required(int, size=64, unique=True) | ||||
class JoinLeave: | |||||
class JoinLeave(commands.Cog): | |||||
"""JoinLeave is a cog that allows you to create custom welcome and goodbye messages for your Discord server. """ | """JoinLeave is a cog that allows you to create custom welcome and goodbye messages for your Discord server. """ | ||||
DEFAULT_MESSAGE = "Be sure to read the rules." | DEFAULT_MESSAGE = "Be sure to read the rules." | ||||
self.bot = bot_client | self.bot = bot_client | ||||
self.autogen_db = JoinLeaveSingle | self.autogen_db = JoinLeaveSingle | ||||
@commands.Cog.listener() | |||||
async def on_member_join(self, member): | async def on_member_join(self, member): | ||||
""" | """ | ||||
Greets users when they join a server. | Greets users when they join a server. | ||||
channel = member.guild.get_channel(settings.greets_channel_id) | channel = member.guild.get_channel(settings.greets_channel_id) | ||||
return await channel.send(embed=em) | return await channel.send(embed=em) | ||||
@commands.Cog.listener() | |||||
async def on_member_remove(self, member): | async def on_member_remove(self, member): | ||||
""" | """ | ||||
The same but the opposite | The same but the opposite | ||||
except AttributeError: | except AttributeError: | ||||
pass | pass | ||||
@commands.Cog.listener() | |||||
async def on_guild_channel_delete(self, channel): | async def on_guild_channel_delete(self, channel): | ||||
"""Cleans up settings on removal of stored IDs.""" | """Cleans up settings on removal of stored IDs.""" | ||||
with db_session: | with db_session: |
guild_id = Required(int, unique=True, size=64) | guild_id = Required(int, unique=True, size=64) | ||||
class NSFW: | |||||
class NSFW(commands.Cog): | |||||
"""The NSFW cog is a collection of commands that post images from popular NSFW sites. """ | """The NSFW cog is a collection of commands that post images from popular NSFW sites. """ | ||||
def __init__(self, bot_client): | def __init__(self, bot_client): | ||||
self.bot = bot_client | self.bot = bot_client |
return choice["data"] | return choice["data"] | ||||
class Reddit: | |||||
class Reddit(commands.Cog): | |||||
"""The Reddit cog is a cog that allows users to get images and videos from their favourite subreddits.""" | """The Reddit cog is a cog that allows users to get images and videos from their favourite subreddits.""" | ||||
SUB_NOT_FOUND = "Error ;-; That subreddit probably doesn't exist. Please check your spelling" | SUB_NOT_FOUND = "Error ;-; That subreddit probably doesn't exist. Please check your spelling" |
guild_id = Required(int, unique=True, size=64) | guild_id = Required(int, unique=True, size=64) | ||||
class SelfAssign(): | |||||
class SelfAssign(commands.Cog): | |||||
"""The SelfAssign cog allows guild's to mark roles as 'self assignable'. This allows users to give themselves these roles and to see all the roles marked as 'self assignable'.""" | """The SelfAssign cog allows guild's to mark roles as 'self assignable'. This allows users to give themselves these roles and to see all the roles marked as 'self assignable'.""" | ||||
def __init__(self, Bot): | def __init__(self, Bot): | ||||
self.bot = Bot | self.bot = Bot | ||||
self.autogen_db = SelfAssignSingle | self.autogen_db = SelfAssignSingle | ||||
@commands.Cog.listener() | |||||
async def on_guild_role_delete(self, role): | async def on_guild_role_delete(self, role): | ||||
"""Cleans up settings on removal of stored IDs.""" | """Cleans up settings on removal of stored IDs.""" | ||||
with db_session: | with db_session: |
# Then I can refactor the game into its own lib and then make a cli version. | # Then I can refactor the game into its own lib and then make a cli version. | ||||
class Trivia: | |||||
class Trivia(commands.Cog): | |||||
""" | """ | ||||
Roxbot Trivia is a trivia game in *your* discord server. It's heavily inspired by Tower Unite's Trivia mini-game. Uses the [Open Trivia Database](https://opentdb.com) made by PixelTail Games. | Roxbot Trivia is a trivia game in *your* discord server. It's heavily inspired by Tower Unite's Trivia mini-game. Uses the [Open Trivia Database](https://opentdb.com) made by PixelTail Games. | ||||
import roxbot | import roxbot | ||||
class Util: | |||||
class Util(commands.Cog): | |||||
""" | """ | ||||
The Util cog is a cog filled with a number of utility commands to help more advanced users of Discord. | The Util cog is a cog filled with a number of utility commands to help more advanced users of Discord. | ||||
""" | """ |
return cls(ModifiedFFmpegPMCAudio(filename, ffmpeg_options), data=data, volume=volume) | return cls(ModifiedFFmpegPMCAudio(filename, ffmpeg_options), data=data, volume=volume) | ||||
class Voice: | |||||
class Voice(commands.Cog): | |||||
"""The Voice cog is a cog that adds and manages a fully-functional music bot for Roxbot.""" | """The Voice cog is a cog that adds and manages a fully-functional music bot for Roxbot.""" | ||||
# TODO: Add voting to many of the commands. | # TODO: Add voting to many of the commands. | ||||
def __init__(self, bot): | def __init__(self, bot): |
return await channel.send(embed=embed) | return await channel.send(embed=embed) | ||||
class ErrorHandling: | |||||
class ErrorHandling(commands.Cog): | |||||
COMMANDONCOOLDOWN = "This command is on cooldown, please wait {:.2f} seconds before trying again." | COMMANDONCOOLDOWN = "This command is on cooldown, please wait {:.2f} seconds before trying again." | ||||
CHECKFAILURE = "You do not have permission to do this. Back off, thot!" | CHECKFAILURE = "You do not have permission to do this. Back off, thot!" | ||||
TOOMANYARGS = "Too many arguments given." | TOOMANYARGS = "Too many arguments given." | ||||
except AttributeError: | except AttributeError: | ||||
return "" | return "" | ||||
@commands.Cog.listener() | |||||
async def on_command_error(self, ctx, error): | async def on_command_error(self, ctx, error): | ||||
if self.dev: | if self.dev: | ||||
raise error | raise error |