Browse Source

updated cogs to new method

tags/v2.2.0
Roxie Gibson 5 years ago
parent
commit
73657b6679
15 changed files with 28 additions and 14 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +1
    -1
      roxbot/__init__.py
  3. +1
    -1
      roxbot/cogs/admin.py
  4. +2
    -1
      roxbot/cogs/ags.py
  5. +2
    -1
      roxbot/cogs/customcommands.py
  6. +1
    -1
      roxbot/cogs/fun.py
  7. +1
    -1
      roxbot/cogs/image.py
  8. +4
    -1
      roxbot/cogs/joinleave.py
  9. +1
    -1
      roxbot/cogs/nsfw.py
  10. +1
    -1
      roxbot/cogs/reddit.py
  11. +2
    -1
      roxbot/cogs/selfassign.py
  12. +1
    -1
      roxbot/cogs/trivia.py
  13. +1
    -1
      roxbot/cogs/util.py
  14. +1
    -1
      roxbot/cogs/voice.py
  15. +4
    -1
      roxbot/core.py

+ 5
- 0
CHANGELOG.md View File

@@ -1,3 +1,8 @@
## 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
- Fixed bug where Roxbot's delete function would delete itself.
- Fixed more trivia error handling

+ 1
- 1
roxbot/__init__.py View File

@@ -12,7 +12,7 @@ __title__ = "roxbot"
__author__ = "Roxanne Gibson"
__license__ = "MIT"
__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.

Roxbot is designed be a multi-purpose bot and provide many different services for users and moderators alike with a focus on customisability.

+ 1
- 1
roxbot/cogs/admin.py View File

@@ -45,7 +45,7 @@ class AdminWarnings(db.Entity):
guild_id = Required(int, size=64)


class Admin:
class Admin(commands.Cog):
"""
Admin Commands for those admins
"""

+ 2
- 1
roxbot/cogs/ags.py View File

@@ -48,7 +48,7 @@ async def tatsumaki_api_call(member, guild):
return await roxbot.http.api_request(url, headers={"Authorization": tat_token})


class AssortedGenderSounds:
class AssortedGenderSounds(commands.Cog):
"""Custom Cog for the AssortedGenderSounds Discord Server."""
def __init__(self, bot_client):
self.bot = bot_client
@@ -62,6 +62,7 @@ class AssortedGenderSounds:
}
}

@commands.Cog.listener()
async def on_member_join(self, member):
if member.guild.id == ags_id:
role = member.guild.get_role(newbie)

+ 2
- 1
roxbot/cogs/customcommands.py View File

@@ -42,7 +42,7 @@ class CCCommands(db.Entity):
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.

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.
@@ -108,6 +108,7 @@ class CustomCommands:
output.pop("color")
return output

@commands.Cog.listener()
async def on_message(self, message):
"""
"""

+ 1
- 1
roxbot/cogs/fun.py View File

@@ -34,7 +34,7 @@ from discord.ext import commands
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."""
def __init__(self, bot_client):
self.bot = bot_client

+ 1
- 1
roxbot/cogs/image.py View File

@@ -133,7 +133,7 @@ class PrideFlags:
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."""

def __init__(self, bot_client):

+ 4
- 1
roxbot/cogs/joinleave.py View File

@@ -41,7 +41,7 @@ class JoinLeaveSingle(db.Entity):
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. """

DEFAULT_MESSAGE = "Be sure to read the rules."
@@ -50,6 +50,7 @@ class JoinLeave:
self.bot = bot_client
self.autogen_db = JoinLeaveSingle

@commands.Cog.listener()
async def on_member_join(self, member):
"""
Greets users when they join a server.
@@ -73,6 +74,7 @@ class JoinLeave:
channel = member.guild.get_channel(settings.greets_channel_id)
return await channel.send(embed=em)

@commands.Cog.listener()
async def on_member_remove(self, member):
"""
The same but the opposite
@@ -89,6 +91,7 @@ class JoinLeave:
except AttributeError:
pass

@commands.Cog.listener()
async def on_guild_channel_delete(self, channel):
"""Cleans up settings on removal of stored IDs."""
with db_session:

+ 1
- 1
roxbot/cogs/nsfw.py View File

@@ -36,7 +36,7 @@ class NSFWSingle(db.Entity):
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. """
def __init__(self, bot_client):
self.bot = bot_client

+ 1
- 1
roxbot/cogs/reddit.py View File

@@ -167,7 +167,7 @@ class Scrapper:
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."""

SUB_NOT_FOUND = "Error ;-; That subreddit probably doesn't exist. Please check your spelling"

+ 2
- 1
roxbot/cogs/selfassign.py View File

@@ -40,12 +40,13 @@ class SelfAssignSingle(db.Entity):
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'."""
def __init__(self, Bot):
self.bot = Bot
self.autogen_db = SelfAssignSingle

@commands.Cog.listener()
async def on_guild_role_delete(self, role):
"""Cleans up settings on removal of stored IDs."""
with db_session:

+ 1
- 1
roxbot/cogs/trivia.py View File

@@ -40,7 +40,7 @@ import roxbot
# 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.


+ 1
- 1
roxbot/cogs/util.py View File

@@ -32,7 +32,7 @@ from discord.ext import commands
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.
"""

+ 1
- 1
roxbot/cogs/voice.py View File

@@ -167,7 +167,7 @@ class YTDLSource(discord.PCMVolumeTransformer):
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."""
# TODO: Add voting to many of the commands.
def __init__(self, bot):

+ 4
- 1
roxbot/core.py View File

@@ -125,7 +125,9 @@ class Roxbot(commands.Bot):
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."
CHECKFAILURE = "You do not have permission to do this. Back off, thot!"
TOOMANYARGS = "Too many arguments given."
@@ -163,6 +165,7 @@ class ErrorHandling:
except AttributeError:
return ""

@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if self.dev:
raise error

Loading…
Cancel
Save