Remove commands.Cog backwards compatibility, and reformatting (#98)
* Unneeded requirements * No need for lambda or function * Remove Cog backwards compatibility, and reformatting
This commit is contained in:
parent
6cc5162f56
commit
9af8601124
@ -1,21 +1,19 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import random
|
import random
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
from redbot.core.utils.chat_formatting import pagify, box
|
from redbot.core.utils.chat_formatting import box, pagify
|
||||||
|
|
||||||
DEFAULT_MESSAGES = [
|
DEFAULT_MESSAGES = [
|
||||||
# "Example message. Uncomment and overwrite to use",
|
# "Example message. Uncomment and overwrite to use",
|
||||||
# "Example message 2. Each message is in quotes and separated by a comma"
|
# "Example message 2. Each message is in quotes and separated by a comma"
|
||||||
]
|
]
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class AnnounceDaily(Cog):
|
class AnnounceDaily(Cog):
|
||||||
"""
|
"""
|
||||||
|
@ -10,10 +10,8 @@ from redbot.core import commands
|
|||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.utils.chat_formatting import pagify, box
|
from redbot.core.utils.chat_formatting import pagify, box
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
class CCRole(commands.Cog):
|
||||||
class CCRole(Cog):
|
|
||||||
"""
|
"""
|
||||||
Custom commands
|
Custom commands
|
||||||
Creates commands used to display text and adjust roles
|
Creates commands used to display text and adjust roles
|
||||||
|
@ -3,17 +3,14 @@ import pathlib
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config
|
from redbot.core import Config, commands
|
||||||
from redbot.core import commands
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
|
|
||||||
from .chatterbot import ChatBot
|
from .chatterbot import ChatBot
|
||||||
from .chatterbot.comparisons import levenshtein_distance
|
from .chatterbot.comparisons import levenshtein_distance
|
||||||
from .chatterbot.response_selection import get_first_response
|
from .chatterbot.response_selection import get_first_response
|
||||||
from .chatterbot.trainers import ListTrainer
|
from .chatterbot.trainers import ListTrainer
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Chatter(Cog):
|
class Chatter(Cog):
|
||||||
@ -152,9 +149,11 @@ class Chatter(Cog):
|
|||||||
Trains the bot based on language in this guild
|
Trains the bot based on language in this guild
|
||||||
"""
|
"""
|
||||||
|
|
||||||
await ctx.send("Warning: The cog may use significant RAM or CPU if trained on large data sets.\n"
|
await ctx.send(
|
||||||
"Additionally, large sets will use more disk space to save the trained data.\n\n"
|
"Warning: The cog may use significant RAM or CPU if trained on large data sets.\n"
|
||||||
"If you experience issues, clear your trained data and train again on a smaller scope.")
|
"Additionally, large sets will use more disk space to save the trained data.\n\n"
|
||||||
|
"If you experience issues, clear your trained data and train again on a smaller scope."
|
||||||
|
)
|
||||||
|
|
||||||
conversation = await self._get_conversation(ctx, channel)
|
conversation = await self._get_conversation(ctx, channel)
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
import discord
|
import discord
|
||||||
from pylint import epylint as lint
|
from pylint import epylint as lint
|
||||||
from redbot.core import Config
|
from redbot.core import Config, commands
|
||||||
from redbot.core import commands
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class CogLint(Cog):
|
class CogLint(Cog):
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core import commands
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
async def fetch_url(session, url):
|
async def fetch_url(session, url):
|
||||||
|
@ -2,9 +2,7 @@ import asyncio
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
from typing import Any
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class ExclusiveRole(Cog):
|
class ExclusiveRole(Cog):
|
||||||
|
@ -3,10 +3,8 @@ from datetime import date, timedelta
|
|||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.utils.chat_formatting import pagify
|
from redbot.core.utils.chat_formatting import pagify
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Flag(Cog):
|
class Flag(Cog):
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
from discord.utils import get
|
|
||||||
|
|
||||||
from redbot import VersionInfo, version_info
|
|
||||||
from redbot.core import Config, checks, commands
|
|
||||||
|
|
||||||
from redbot.core.bot import Red
|
|
||||||
from typing import Any
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
from discord.utils import get
|
||||||
|
from redbot import VersionInfo, version_info
|
||||||
|
from redbot.core import Config, checks, commands
|
||||||
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
if version_info < VersionInfo.from_str("3.4.0"):
|
if version_info < VersionInfo.from_str("3.4.0"):
|
||||||
SANITIZE_ROLES_KWARG = {}
|
SANITIZE_ROLES_KWARG = {}
|
||||||
else:
|
else:
|
||||||
SANITIZE_ROLES_KWARG = {"sanitize_roles": False}
|
SANITIZE_ROLES_KWARG = {"sanitize_roles": False}
|
||||||
|
|
||||||
|
|
||||||
class ForceMention(Cog):
|
class ForceMention(Cog):
|
||||||
"""
|
"""
|
||||||
Mention the unmentionables
|
Mention the unmentionables
|
||||||
|
@ -3,10 +3,8 @@ from random import randint
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.data_manager import bundled_data_path
|
from redbot.core.data_manager import bundled_data_path
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Hangman(Cog):
|
class Hangman(Cog):
|
||||||
@ -31,9 +29,9 @@ class Hangman(Cog):
|
|||||||
"answer": "",
|
"answer": "",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# self.path = str(cog_data_path(self)).replace("\\", "/")
|
# self.path = str(cog_data_path(self)).replace("\\", "/")
|
||||||
|
|
||||||
# self.answer_path = self.path + "/bundled_data/hanganswers.txt"
|
# self.answer_path = self.path + "/bundled_data/hanganswers.txt"
|
||||||
|
|
||||||
self.answer_path = bundled_data_path(self) / "hanganswers.txt"
|
self.answer_path = bundled_data_path(self) / "hanganswers.txt"
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
from typing import Any
|
|
||||||
import discord
|
import discord
|
||||||
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core import Config, commands, checks
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad
|
|
||||||
if listener is None:
|
|
||||||
|
|
||||||
def listener(name=None):
|
# Cog: Any = getattr(commands, "Cog", object)
|
||||||
return lambda x: x
|
# listener = getattr(commands.Cog, "listener", None) # Trusty + Sinbad
|
||||||
|
# if listener is None:
|
||||||
|
# def listener(name=None):
|
||||||
|
# return lambda x: x
|
||||||
|
|
||||||
|
|
||||||
class InfoChannel(Cog):
|
class InfoChannel(Cog):
|
||||||
@ -160,8 +159,10 @@ class InfoChannel(Cog):
|
|||||||
onlinecount = guild_data["online_count"]
|
onlinecount = guild_data["online_count"]
|
||||||
|
|
||||||
# Gets count of bots
|
# Gets count of bots
|
||||||
bots = lambda x: x.bot
|
# bots = lambda x: x.bot
|
||||||
num = len([m for m in guild.members if bots(m)])
|
# def bots(x): return x.bot
|
||||||
|
|
||||||
|
num = len([m for m in guild.members if m.bot])
|
||||||
bot_msg = f"Bots: {num}"
|
bot_msg = f"Bots: {num}"
|
||||||
|
|
||||||
# Gets count of online users
|
# Gets count of online users
|
||||||
@ -188,8 +189,7 @@ class InfoChannel(Cog):
|
|||||||
|
|
||||||
if guild_data["member_count"]:
|
if guild_data["member_count"]:
|
||||||
name = "{} ".format(human_msg)
|
name = "{} ".format(human_msg)
|
||||||
|
await channel.edit(reason="InfoChannel update", name=name)
|
||||||
await channel.edit(reason="InfoChannel update", name=name)
|
|
||||||
|
|
||||||
if botcount:
|
if botcount:
|
||||||
name = "{} ".format(bot_msg)
|
name = "{} ".format(bot_msg)
|
||||||
@ -199,15 +199,15 @@ class InfoChannel(Cog):
|
|||||||
name = "{} ".format(online_msg)
|
name = "{} ".format(online_msg)
|
||||||
await onlinechannel.edit(reason="InfoChannel update", name=name)
|
await onlinechannel.edit(reason="InfoChannel update", name=name)
|
||||||
|
|
||||||
@listener()
|
@Cog.listener()
|
||||||
async def on_member_join(self, member: discord.Member):
|
async def on_member_join(self, member: discord.Member):
|
||||||
await self.update_infochannel(member.guild)
|
await self.update_infochannel(member.guild)
|
||||||
|
|
||||||
@listener()
|
@Cog.listener()
|
||||||
async def on_member_remove(self, member: discord.Member):
|
async def on_member_remove(self, member: discord.Member):
|
||||||
await self.update_infochannel(member.guild)
|
await self.update_infochannel(member.guild)
|
||||||
|
|
||||||
@listener()
|
@Cog.listener()
|
||||||
async def on_member_update(self, before: discord.Member, after: discord.Member):
|
async def on_member_update(self, before: discord.Member, after: discord.Member):
|
||||||
onlinecount = await self.config.guild(after.guild).online_count()
|
onlinecount = await self.config.guild(after.guild).online_count()
|
||||||
if onlinecount:
|
if onlinecount:
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
|
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.commands import Context
|
from redbot.core.commands import Cog, Context
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Leaver(Cog):
|
class Leaver(Cog):
|
||||||
@ -15,9 +11,7 @@ class Leaver(Cog):
|
|||||||
|
|
||||||
def __init__(self, bot: Red):
|
def __init__(self, bot: Red):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.config = Config.get_conf(
|
self.config = Config.get_conf(self, identifier=9811198108111121, force_registration=True)
|
||||||
self, identifier=9811198108111121, force_registration=True
|
|
||||||
)
|
|
||||||
default_guild = {"channel": ""}
|
default_guild = {"channel": ""}
|
||||||
|
|
||||||
self.config.register_guild(**default_guild)
|
self.config.register_guild(**default_guild)
|
||||||
|
@ -2,9 +2,7 @@ import aiohttp
|
|||||||
import discord
|
import discord
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from typing import Any
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class LoveCalculator(Cog):
|
class LoveCalculator(Cog):
|
||||||
@ -15,7 +13,7 @@ class LoveCalculator(Cog):
|
|||||||
|
|
||||||
@commands.command(aliases=["lovecalc"])
|
@commands.command(aliases=["lovecalc"])
|
||||||
async def lovecalculator(
|
async def lovecalculator(
|
||||||
self, ctx: commands.Context, lover: discord.Member, loved: discord.Member
|
self, ctx: commands.Context, lover: discord.Member, loved: discord.Member
|
||||||
):
|
):
|
||||||
"""Calculate the love percentage!"""
|
"""Calculate the love percentage!"""
|
||||||
|
|
||||||
@ -30,7 +28,9 @@ class LoveCalculator(Cog):
|
|||||||
soup_object = BeautifulSoup(await response.text(), "html.parser")
|
soup_object = BeautifulSoup(await response.text(), "html.parser")
|
||||||
try:
|
try:
|
||||||
description = (
|
description = (
|
||||||
soup_object.find("div", attrs={"class": "result__score"}).get_text().strip()
|
soup_object.find("div", attrs={"class": "result__score"})
|
||||||
|
.get_text()
|
||||||
|
.strip()
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
description = "Dr. Love is busy right now"
|
description = "Dr. Love is busy right now"
|
||||||
|
@ -2,13 +2,9 @@ from datetime import datetime
|
|||||||
|
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
import discord
|
import discord
|
||||||
|
from redbot.core import Config, commands
|
||||||
from redbot.core import Config
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core import commands
|
from redbot.core.commands import Cog
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class LastSeen(Cog):
|
class LastSeen(Cog):
|
||||||
|
@ -5,15 +5,14 @@ import datetime
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
from random import choice
|
from random import choice
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands, Config, bank
|
from redbot.core import Config, bank, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.data_manager import bundled_data_path
|
from redbot.core.data_manager import bundled_data_path
|
||||||
|
|
||||||
|
|
||||||
class Gardener:
|
class Gardener(commands.Cog):
|
||||||
"""Gardener class"""
|
"""Gardener class"""
|
||||||
|
|
||||||
def __init__(self, user: discord.User, config: Config):
|
def __init__(self, user: discord.User, config: Config):
|
||||||
@ -30,9 +29,7 @@ class Gardener:
|
|||||||
"Badges: {}\n"
|
"Badges: {}\n"
|
||||||
"Points: {}\n"
|
"Points: {}\n"
|
||||||
"Products: {}\n"
|
"Products: {}\n"
|
||||||
"Current: {}".format(
|
"Current: {}".format(self.user, self.badges, self.points, self.products, self.current)
|
||||||
self.user, self.badges, self.points, self.products, self.current
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
@ -246,17 +243,12 @@ class PlantTycoon(commands.Cog):
|
|||||||
degradation = (
|
degradation = (
|
||||||
100
|
100
|
||||||
/ (gardener.current["time"] / 60)
|
/ (gardener.current["time"] / 60)
|
||||||
* (
|
* (self.defaults["degradation"]["base_degradation"] + gardener.current["degradation"])
|
||||||
self.defaults["degradation"]["base_degradation"]
|
|
||||||
+ gardener.current["degradation"]
|
|
||||||
)
|
|
||||||
) + modifiers
|
) + modifiers
|
||||||
|
|
||||||
d = collections.namedtuple("degradation", "degradation time modifiers")
|
d = collections.namedtuple("degradation", "degradation time modifiers")
|
||||||
|
|
||||||
return d(
|
return d(degradation=degradation, time=gardener.current["time"], modifiers=modifiers)
|
||||||
degradation=degradation, time=gardener.current["time"], modifiers=modifiers
|
|
||||||
)
|
|
||||||
|
|
||||||
# async def _get_member(self, user_id):
|
# async def _get_member(self, user_id):
|
||||||
#
|
#
|
||||||
@ -285,10 +277,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
await self._load_plants_products()
|
await self._load_plants_products()
|
||||||
product = product.lower()
|
product = product.lower()
|
||||||
product_category = product_category.lower()
|
product_category = product_category.lower()
|
||||||
if (
|
if product in self.products and self.products[product]["category"] == product_category:
|
||||||
product in self.products
|
|
||||||
and self.products[product]["category"] == product_category
|
|
||||||
):
|
|
||||||
if product in gardener.products:
|
if product in gardener.products:
|
||||||
if gardener.products[product] > 0:
|
if gardener.products[product] > 0:
|
||||||
gardener.current["health"] += self.products[product]["health"]
|
gardener.current["health"] += self.products[product]["health"]
|
||||||
@ -359,13 +348,9 @@ class PlantTycoon(commands.Cog):
|
|||||||
``{0}prune``: Prune your plant.\n"""
|
``{0}prune``: Prune your plant.\n"""
|
||||||
|
|
||||||
em = discord.Embed(
|
em = discord.Embed(
|
||||||
title=title,
|
title=title, description=description.format(prefix), color=discord.Color.green(),
|
||||||
description=description.format(prefix),
|
|
||||||
color=discord.Color.green(),
|
|
||||||
)
|
|
||||||
em.set_thumbnail(
|
|
||||||
url="https://image.prntscr.com/image/AW7GuFIBSeyEgkR2W3SeiQ.png"
|
|
||||||
)
|
)
|
||||||
|
em.set_thumbnail(url="https://image.prntscr.com/image/AW7GuFIBSeyEgkR2W3SeiQ.png")
|
||||||
em.set_footer(
|
em.set_footer(
|
||||||
text="This cog was made by SnappyDragon18 and PaddoInWonderland. Inspired by The Lorax (2012)."
|
text="This cog was made by SnappyDragon18 and PaddoInWonderland. Inspired by The Lorax (2012)."
|
||||||
)
|
)
|
||||||
@ -439,9 +424,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
|
|
||||||
em = discord.Embed(color=discord.Color.green()) # , description='\a\n')
|
em = discord.Embed(color=discord.Color.green()) # , description='\a\n')
|
||||||
avatar = author.avatar_url if author.avatar else author.default_avatar_url
|
avatar = author.avatar_url if author.avatar else author.default_avatar_url
|
||||||
em.set_author(
|
em.set_author(name="Gardening profile of {}".format(author.name), icon_url=avatar)
|
||||||
name="Gardening profile of {}".format(author.name), icon_url=avatar
|
|
||||||
)
|
|
||||||
em.add_field(name="**Thneeds**", value=str(gardener.points))
|
em.add_field(name="**Thneeds**", value=str(gardener.points))
|
||||||
if not gardener.current:
|
if not gardener.current:
|
||||||
em.add_field(name="**Currently growing**", value="None")
|
em.add_field(name="**Currently growing**", value="None")
|
||||||
@ -508,9 +491,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
tock += "**{}**\n".format(plant["name"])
|
tock += "**{}**\n".format(plant["name"])
|
||||||
tick_tock = 0
|
tick_tock = 0
|
||||||
em = discord.Embed(
|
em = discord.Embed(title="All plants that are growable", color=discord.Color.green())
|
||||||
title="All plants that are growable", color=discord.Color.green()
|
|
||||||
)
|
|
||||||
em.add_field(name="\a", value=tick)
|
em.add_field(name="\a", value=tick)
|
||||||
em.add_field(name="\a", value=tock)
|
em.add_field(name="\a", value=tock)
|
||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
@ -532,18 +513,13 @@ class PlantTycoon(commands.Cog):
|
|||||||
|
|
||||||
if t:
|
if t:
|
||||||
em = discord.Embed(
|
em = discord.Embed(
|
||||||
title="Plant statistics of {}".format(plant["name"]),
|
title="Plant statistics of {}".format(plant["name"]), color=discord.Color.green(),
|
||||||
color=discord.Color.green(),
|
|
||||||
)
|
)
|
||||||
em.set_thumbnail(url=plant["image"])
|
em.set_thumbnail(url=plant["image"])
|
||||||
em.add_field(name="**Name**", value=plant["name"])
|
em.add_field(name="**Name**", value=plant["name"])
|
||||||
em.add_field(name="**Rarity**", value=plant["rarity"].capitalize())
|
em.add_field(name="**Rarity**", value=plant["rarity"].capitalize())
|
||||||
em.add_field(
|
em.add_field(name="**Grow Time**", value="{0:.1f} minutes".format(plant["time"] / 60))
|
||||||
name="**Grow Time**", value="{0:.1f} minutes".format(plant["time"] / 60)
|
em.add_field(name="**Damage Threshold**", value="{}%".format(plant["threshold"]))
|
||||||
)
|
|
||||||
em.add_field(
|
|
||||||
name="**Damage Threshold**", value="{}%".format(plant["threshold"])
|
|
||||||
)
|
|
||||||
em.add_field(name="**Badge**", value=plant["badge"])
|
em.add_field(name="**Badge**", value=plant["badge"])
|
||||||
em.add_field(name="**Reward**", value="{} τ".format(plant["reward"]))
|
em.add_field(name="**Reward**", value="{} τ".format(plant["reward"]))
|
||||||
else:
|
else:
|
||||||
@ -595,8 +571,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
author = ctx.author
|
author = ctx.author
|
||||||
if product is None:
|
if product is None:
|
||||||
em = discord.Embed(
|
em = discord.Embed(
|
||||||
title="All gardening supplies that you can buy:",
|
title="All gardening supplies that you can buy:", color=discord.Color.green(),
|
||||||
color=discord.Color.green(),
|
|
||||||
)
|
)
|
||||||
for pd in self.products:
|
for pd in self.products:
|
||||||
em.add_field(
|
em.add_field(
|
||||||
@ -630,8 +605,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
message = "You bought {}.".format(product.lower())
|
message = "You bought {}.".format(product.lower())
|
||||||
else:
|
else:
|
||||||
message = "You don't have enough Thneeds. You have {}, but need {}.".format(
|
message = "You don't have enough Thneeds. You have {}, but need {}.".format(
|
||||||
gardener.points,
|
gardener.points, self.products[product.lower()]["cost"] * amount,
|
||||||
self.products[product.lower()]["cost"] * amount,
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
message = "I don't have this product."
|
message = "I don't have this product."
|
||||||
@ -650,14 +624,11 @@ class PlantTycoon(commands.Cog):
|
|||||||
plural = "s"
|
plural = "s"
|
||||||
if withdraw_points:
|
if withdraw_points:
|
||||||
await bank.deposit_credits(author, amount)
|
await bank.deposit_credits(author, amount)
|
||||||
message = "{} Thneed{} successfully exchanged for credits.".format(
|
message = "{} Thneed{} successfully exchanged for credits.".format(amount, plural)
|
||||||
amount, plural
|
|
||||||
)
|
|
||||||
await gardener.save_gardener()
|
await gardener.save_gardener()
|
||||||
else:
|
else:
|
||||||
message = (
|
message = "You don't have enough Thneed{}. " "You have {}, but need {}.".format(
|
||||||
"You don't have enough Thneed{}. "
|
plural, gardener.points, amount
|
||||||
"You have {}, but need {}.".format(plural, gardener.points, amount)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
em = discord.Embed(description=message, color=discord.Color.green())
|
em = discord.Embed(description=message, color=discord.Color.green())
|
||||||
@ -749,9 +720,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
degradation = await self._degradation(gardener)
|
degradation = await self._degradation(gardener)
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
timestamp = gardener.current["timestamp"]
|
timestamp = gardener.current["timestamp"]
|
||||||
degradation_count = (now - timestamp) // (
|
degradation_count = (now - timestamp) // (self.defaults["timers"]["degradation"] * 60)
|
||||||
self.defaults["timers"]["degradation"] * 60
|
|
||||||
)
|
|
||||||
degradation_count -= gardener.current["degrade_count"]
|
degradation_count -= gardener.current["degrade_count"]
|
||||||
gardener.current["health"] -= degradation.degradation * degradation_count
|
gardener.current["health"] -= degradation.degradation * degradation_count
|
||||||
gardener.points += self.defaults["points"]["growing"] * degradation_count
|
gardener.points += self.defaults["points"]["growing"] * degradation_count
|
||||||
|
@ -6,10 +6,8 @@ from MyQR import myqr
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.data_manager import cog_data_path
|
from redbot.core.data_manager import cog_data_path
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class QRInvite(Cog):
|
class QRInvite(Cog):
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config
|
from redbot.core import Config, commands
|
||||||
from redbot.core import commands
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from typing import Any
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class ReactRestrictCombo:
|
class ReactRestrictCombo:
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from redbot.core import bank, commands
|
from redbot.core import bank, commands
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.data_manager import bundled_data_path
|
from redbot.core.data_manager import bundled_data_path
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class RecyclingPlant(Cog):
|
class RecyclingPlant(Cog):
|
||||||
"""Apply for a job at the recycling plant!"""
|
"""Apply for a job at the recycling plant!"""
|
||||||
|
@ -3,9 +3,7 @@ import random
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from typing import Any
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class RPSLS(Cog):
|
class RPSLS(Cog):
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import html2text
|
import html2text
|
||||||
|
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.utils.chat_formatting import pagify
|
from redbot.core.utils.chat_formatting import pagify
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
async def fetch_url(session, url):
|
async def fetch_url(session, url):
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
|
|
||||||
class SCP(Cog):
|
class SCP(Cog):
|
||||||
|
@ -4,9 +4,8 @@ import discord
|
|||||||
|
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
|
|
||||||
async def fetch_img(session, url):
|
async def fetch_img(session, url):
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from datetime import timedelta, datetime
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import Config, checks, commands
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
from redbot.core.commands import Cog
|
||||||
from redbot.core.utils.chat_formatting import pagify
|
from redbot.core.utils.chat_formatting import pagify
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Timerole(Cog):
|
class Timerole(Cog):
|
||||||
|
@ -4,9 +4,7 @@ import discord
|
|||||||
from gtts import gTTS
|
from gtts import gTTS
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from typing import Any
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class TTS(Cog):
|
class TTS(Cog):
|
||||||
|
@ -2,9 +2,7 @@ import codecs as c
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from typing import Any
|
from redbot.core.commands import Cog
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Unicode(Cog):
|
class Unicode(Cog):
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
import discord
|
import discord
|
||||||
|
from redbot.core import Config, checks, commands
|
||||||
from redbot.core import Config, checks
|
|
||||||
|
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core import commands
|
from redbot.core.commands import Cog
|
||||||
|
from redbot.core.utils.menus import DEFAULT_CONTROLS, menu
|
||||||
|
|
||||||
from .builder import GameBuilder, role_from_name, role_from_alignment, role_from_category, role_from_id
|
from .builder import (
|
||||||
|
GameBuilder,
|
||||||
|
role_from_alignment,
|
||||||
|
role_from_category,
|
||||||
|
role_from_id,
|
||||||
|
role_from_name,
|
||||||
|
)
|
||||||
from .game import Game
|
from .game import Game
|
||||||
from redbot.core.utils.menus import menu, DEFAULT_CONTROLS
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
Cog: Any = getattr(commands, "Cog", object)
|
|
||||||
|
|
||||||
|
|
||||||
class Werewolf(Cog):
|
class Werewolf(Cog):
|
||||||
@ -20,13 +21,15 @@ class Werewolf(Cog):
|
|||||||
|
|
||||||
def __init__(self, bot: Red):
|
def __init__(self, bot: Red):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.config = Config.get_conf(self, identifier=87101114101119111108102, force_registration=True)
|
self.config = Config.get_conf(
|
||||||
|
self, identifier=87101114101119111108102, force_registration=True
|
||||||
|
)
|
||||||
default_global = {}
|
default_global = {}
|
||||||
default_guild = {
|
default_guild = {
|
||||||
"role_id": None,
|
"role_id": None,
|
||||||
"category_id": None,
|
"category_id": None,
|
||||||
"channel_id": None,
|
"channel_id": None,
|
||||||
"log_channel_id": None
|
"log_channel_id": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.config.register_global(**default_global)
|
self.config.register_global(**default_global)
|
||||||
@ -83,7 +86,7 @@ class Werewolf(Cog):
|
|||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@wwset.command(name="role")
|
@wwset.command(name="role")
|
||||||
async def wwset_role(self, ctx: commands.Context, role: discord.Role=None):
|
async def wwset_role(self, ctx: commands.Context, role: discord.Role = None):
|
||||||
"""
|
"""
|
||||||
Assign the game role
|
Assign the game role
|
||||||
This role should not be manually assigned
|
This role should not be manually assigned
|
||||||
@ -97,7 +100,7 @@ class Werewolf(Cog):
|
|||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@wwset.command(name="category")
|
@wwset.command(name="category")
|
||||||
async def wwset_category(self, ctx: commands.Context, category_id: int=None):
|
async def wwset_category(self, ctx: commands.Context, category_id: int = None):
|
||||||
"""
|
"""
|
||||||
Assign the channel category
|
Assign the channel category
|
||||||
"""
|
"""
|
||||||
@ -114,7 +117,7 @@ class Werewolf(Cog):
|
|||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@wwset.command(name="channel")
|
@wwset.command(name="channel")
|
||||||
async def wwset_channel(self, ctx: commands.Context, channel: discord.TextChannel=None):
|
async def wwset_channel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
||||||
"""
|
"""
|
||||||
Assign the village channel
|
Assign the village channel
|
||||||
"""
|
"""
|
||||||
@ -127,7 +130,7 @@ class Werewolf(Cog):
|
|||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@wwset.command(name="logchannel")
|
@wwset.command(name="logchannel")
|
||||||
async def wwset_log_channel(self, ctx: commands.Context, channel: discord.TextChannel=None):
|
async def wwset_log_channel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
||||||
"""
|
"""
|
||||||
Assign the log channel
|
Assign the log channel
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user