Rename J.A.R.V.I.S. -> JARVIS

This commit is contained in:
Zeva Rose 2022-04-19 17:37:36 -06:00
parent f899174fa0
commit 820ff56255
27 changed files with 75 additions and 75 deletions

View file

@ -1,4 +1,4 @@
"""Main J.A.R.V.I.S. package.""" """Main JARVIS package."""
import logging import logging
from importlib.metadata import version as _v from importlib.metadata import version as _v
@ -36,7 +36,7 @@ jarvis = Jarvis(
async def run() -> None: async def run() -> None:
"""Run J.A.R.V.I.S.""" """Run JARVIS"""
logger.info("Starting JARVIS") logger.info("Starting JARVIS")
logger.debug("Connecting to database") logger.debug("Connecting to database")
connect(**jconfig.mongo["connect"], testing=jconfig.mongo["database"] != "jarvis") connect(**jconfig.mongo["connect"], testing=jconfig.mongo["database"] != "jarvis")

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Admin Cogs.""" """JARVIS Admin Cogs."""
import logging import logging
from dis_snek import Snake from dis_snek import Snake
@ -7,7 +7,7 @@ from jarvis.cogs.admin import ban, kick, lock, lockdown, mute, purge, roleping,
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add admin cogs to J.A.R.V.I.S.""" """Add admin cogs to JARVIS"""
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
msg = "Loaded jarvis.cogs.admin.{}" msg = "Loaded jarvis.cogs.admin.{}"
ban.BanCog(bot) ban.BanCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. BanCog.""" """JARVIS BanCog."""
import logging import logging
import re import re
@ -24,7 +24,7 @@ from jarvis.utils.permissions import admin_or_permissions
class BanCog(ModcaseCog): class BanCog(ModcaseCog):
"""J.A.R.V.I.S. BanCog.""" """JARVIS BanCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
super().__init__(bot) super().__init__(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. KickCog.""" """JARVIS KickCog."""
import logging import logging
from dis_snek import InteractionContext, Permissions, Snake from dis_snek import InteractionContext, Permissions, Snake
@ -18,7 +18,7 @@ from jarvis.utils.permissions import admin_or_permissions
class KickCog(ModcaseCog): class KickCog(ModcaseCog):
"""J.A.R.V.I.S. KickCog.""" """JARVIS KickCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
super().__init__(bot) super().__init__(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. LockCog.""" """JARVIS LockCog."""
import logging import logging
from typing import Union from typing import Union
@ -19,7 +19,7 @@ from jarvis.utils.permissions import admin_or_permissions
class LockCog(Scale): class LockCog(Scale):
"""J.A.R.V.I.S. LockCog.""" """JARVIS LockCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. LockdownCog.""" """JARVIS LockdownCog."""
import logging import logging
from dis_snek import InteractionContext, Scale, Snake from dis_snek import InteractionContext, Scale, Snake
@ -93,7 +93,7 @@ async def unlock_all(bot: Snake, guild: Guild, admin: Member) -> None:
class LockdownCog(Scale): class LockdownCog(Scale):
"""J.A.R.V.I.S. LockdownCog.""" """JARVIS LockdownCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. MuteCog.""" """JARVIS MuteCog."""
import asyncio import asyncio
import logging import logging
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
@ -26,7 +26,7 @@ from jarvis.utils.permissions import admin_or_permissions
class MuteCog(ModcaseCog): class MuteCog(ModcaseCog):
"""J.A.R.V.I.S. MuteCog.""" """JARVIS MuteCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
super().__init__(bot) super().__init__(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. PurgeCog.""" """JARVIS PurgeCog."""
import logging import logging
from dis_snek import InteractionContext, Permissions, Scale, Snake from dis_snek import InteractionContext, Permissions, Scale, Snake
@ -16,7 +16,7 @@ from jarvis.utils.permissions import admin_or_permissions
class PurgeCog(Scale): class PurgeCog(Scale):
"""J.A.R.V.I.S. PurgeCog.""" """JARVIS PurgeCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. RolepingCog.""" """JARVIS RolepingCog."""
import logging import logging
from dis_snek import InteractionContext, Permissions, Scale, Snake from dis_snek import InteractionContext, Permissions, Scale, Snake
@ -21,7 +21,7 @@ from jarvis.utils.permissions import admin_or_permissions
class RolepingCog(Scale): class RolepingCog(Scale):
"""J.A.R.V.I.S. RolepingCog.""" """JARVIS RolepingCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. WarningCog.""" """JARVIS WarningCog."""
import logging import logging
from dis_snek import InteractionContext, Permissions, Snake from dis_snek import InteractionContext, Permissions, Snake
@ -22,7 +22,7 @@ from jarvis.utils.permissions import admin_or_permissions
class WarningCog(ModcaseCog): class WarningCog(ModcaseCog):
"""J.A.R.V.I.S. WarningCog.""" """JARVIS WarningCog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
super().__init__(bot) super().__init__(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Autoreact Cog.""" """JARVIS Autoreact Cog."""
import logging import logging
import re import re
from typing import Optional, Tuple from typing import Optional, Tuple
@ -20,7 +20,7 @@ from jarvis.utils.permissions import admin_or_permissions
class AutoReactCog(Scale): class AutoReactCog(Scale):
"""J.A.R.V.I.S. Autoreact Cog.""" """JARVIS Autoreact Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -207,5 +207,5 @@ class AutoReactCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add AutoReactCog to J.A.R.V.I.S.""" """Add AutoReactCog to JARVIS"""
AutoReactCog(bot) AutoReactCog(bot)

View file

@ -50,5 +50,5 @@ class BotutilCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add BotutilCog to J.A.R.V.I.S.""" """Add BotutilCog to JARVIS"""
BotutilCog(bot) BotutilCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Complete the Code 2 Cog.""" """JARVIS Complete the Code 2 Cog."""
import logging import logging
import re import re
@ -30,7 +30,7 @@ invites = re.compile(
class CTCCog(Scale): class CTCCog(Scale):
"""J.A.R.V.I.S. Complete the Code 2 Cog.""" """JARVIS Complete the Code 2 Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -149,5 +149,5 @@ class CTCCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add CTCCog to J.A.R.V.I.S.""" """Add CTCCog to JARVIS"""
CTCCog(bot) CTCCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. dbrand cog.""" """JARVIS dbrand cog."""
import logging import logging
import re import re
@ -22,7 +22,7 @@ guild_ids = [862402786116763668] # [578757004059738142, 520021794380447745, 862
class DbrandCog(Scale): class DbrandCog(Scale):
""" """
dbrand functions for J.A.R.V.I.S. dbrand functions for JARVIS
Mostly support functions. Credit @cpixl for the shipping API Mostly support functions. Credit @cpixl for the shipping API
""" """
@ -198,5 +198,5 @@ class DbrandCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add dbrandcog to J.A.R.V.I.S.""" """Add dbrandcog to JARVIS"""
DbrandCog(bot) DbrandCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Developer Cog.""" """JARVIS Developer Cog."""
import base64 import base64
import hashlib import hashlib
import logging import logging
@ -46,7 +46,7 @@ MAX_FILESIZE = 5 * (1024**3) # 5GB
class DevCog(Scale): class DevCog(Scale):
"""J.A.R.V.I.S. Developer Cog.""" """JARVIS Developer Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -266,7 +266,7 @@ class DevCog(Scale):
embed = build_embed(title="Decoded Data", description="", fields=fields) embed = build_embed(title="Decoded Data", description="", fields=fields)
await ctx.send(embed=embed) await ctx.send(embed=embed)
@slash_command(name="cloc", description="Get J.A.R.V.I.S. lines of code") @slash_command(name="cloc", description="Get JARVIS lines of code")
@cooldown(bucket=Buckets.CHANNEL, rate=1, interval=30) @cooldown(bucket=Buckets.CHANNEL, rate=1, interval=30)
async def _cloc(self, ctx: InteractionContext) -> None: async def _cloc(self, ctx: InteractionContext) -> None:
output = subprocess.check_output( # noqa: S603, S607 output = subprocess.check_output( # noqa: S603, S607
@ -276,5 +276,5 @@ class DevCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add DevCog to J.A.R.V.I.S.""" """Add DevCog to JARVIS"""
DevCog(bot) DevCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. GitLab Cog.""" """JARVIS GitLab Cog."""
import asyncio import asyncio
import logging import logging
from datetime import datetime from datetime import datetime
@ -26,14 +26,14 @@ guild_ids = [862402786116763668]
class GitlabCog(Scale): class GitlabCog(Scale):
"""J.A.R.V.I.S. GitLab Cog.""" """JARVIS GitLab Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
config = JarvisConfig.from_yaml() config = JarvisConfig.from_yaml()
self._gitlab = gitlab.Gitlab("https://git.zevaryx.com", private_token=config.gitlab_token) self._gitlab = gitlab.Gitlab("https://git.zevaryx.com", private_token=config.gitlab_token)
# J.A.R.V.I.S. GitLab ID is 29 # JARVIS GitLab ID is 29
self.project = self._gitlab.projects.get(29) self.project = self._gitlab.projects.get(29)
gl = SlashCommand(name="gl", description="Get GitLab info", scopes=guild_ids) gl = SlashCommand(name="gl", description="Get GitLab info", scopes=guild_ids)
@ -149,7 +149,7 @@ class GitlabCog(Scale):
url=milestone.web_url, url=milestone.web_url,
) )
embed.set_author( embed.set_author(
name="J.A.R.V.I.S.", name="JARVIS",
url="https://git.zevaryx.com/jarvis", url="https://git.zevaryx.com/jarvis",
icon_url="https://git.zevaryx.com/uploads/-/system/user/avatar/11/avatar.png", icon_url="https://git.zevaryx.com/uploads/-/system/user/avatar/11/avatar.png",
) )
@ -240,7 +240,7 @@ class GitlabCog(Scale):
title = "" title = ""
if t_state: if t_state:
title = f"{t_state} " title = f"{t_state} "
title += f"J.A.R.V.I.S. {name}s" title += f"JARVIS {name}s"
fields = [] fields = []
for item in api_list: for item in api_list:
description = item.description or "No description" description = item.description or "No description"
@ -256,10 +256,10 @@ class GitlabCog(Scale):
title=title, title=title,
description="", description="",
fields=fields, fields=fields,
url=f"https://git.zevaryx.com/stark-industries/j.a.r.v.i.s./{name.replace(' ', '_')}s", url=f"https://git.zevaryx.com/stark-industries/JARVIS/{name.replace(' ', '_')}s",
) )
embed.set_author( embed.set_author(
name="J.A.R.V.I.S.", name="JARVIS",
url="https://git.zevaryx.com/jarvis", url="https://git.zevaryx.com/jarvis",
icon_url="https://git.zevaryx.com/uploads/-/system/user/avatar/11/avatar.png", icon_url="https://git.zevaryx.com/uploads/-/system/user/avatar/11/avatar.png",
) )
@ -464,6 +464,6 @@ class GitlabCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add GitlabCog to J.A.R.V.I.S. if Gitlab token exists.""" """Add GitlabCog to JARVIS if Gitlab token exists."""
if JarvisConfig.from_yaml().gitlab_token: if JarvisConfig.from_yaml().gitlab_token:
GitlabCog(bot) GitlabCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. image processing cog.""" """JARVIS image processing cog."""
import logging import logging
import re import re
from io import BytesIO from io import BytesIO
@ -22,7 +22,7 @@ MIN_ACCURACY = 0.80
class ImageCog(Scale): class ImageCog(Scale):
""" """
Image processing functions for J.A.R.V.I.S. Image processing functions for JARVIS
May be categorized under util later May be categorized under util later
""" """
@ -152,5 +152,5 @@ class ImageCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add ImageCog to J.A.R.V.I.S.""" """Add ImageCog to JARVIS"""
ImageCog(bot) ImageCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Remind Me Cog.""" """JARVIS Remind Me Cog."""
import asyncio import asyncio
import logging import logging
import re import re
@ -34,7 +34,7 @@ invites = re.compile(
class RemindmeCog(Scale): class RemindmeCog(Scale):
"""J.A.R.V.I.S. Remind Me Cog.""" """JARVIS Remind Me Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -337,5 +337,5 @@ class RemindmeCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add RemindmeCog to J.A.R.V.I.S.""" """Add RemindmeCog to JARVIS"""
RemindmeCog(bot) RemindmeCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Role Giver Cog.""" """JARVIS Role Giver Cog."""
import asyncio import asyncio
import logging import logging
@ -22,7 +22,7 @@ from jarvis.utils.permissions import admin_or_permissions
class RolegiverCog(Scale): class RolegiverCog(Scale):
"""J.A.R.V.I.S. Role Giver Cog.""" """JARVIS Role Giver Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -379,5 +379,5 @@ class RolegiverCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add RolegiverCog to J.A.R.V.I.S.""" """Add RolegiverCog to JARVIS"""
RolegiverCog(bot) RolegiverCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Settings Management Cog.""" """JARVIS Settings Management Cog."""
import asyncio import asyncio
import logging import logging
from typing import Any from typing import Any
@ -23,7 +23,7 @@ from jarvis.utils.permissions import admin_or_permissions
class SettingsCog(Scale): class SettingsCog(Scale):
"""J.A.R.V.I.S. Settings Management Cog.""" """JARVIS Settings Management Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -270,5 +270,5 @@ class SettingsCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add SettingsCog to J.A.R.V.I.S.""" """Add SettingsCog to JARVIS"""
SettingsCog(bot) SettingsCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Starboard Cog.""" """JARVIS Starboard Cog."""
import logging import logging
from dis_snek import InteractionContext, Permissions, Scale, Snake from dis_snek import InteractionContext, Permissions, Scale, Snake
@ -29,7 +29,7 @@ supported_images = [
class StarboardCog(Scale): class StarboardCog(Scale):
"""J.A.R.V.I.S. Starboard Cog.""" """JARVIS Starboard Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -319,5 +319,5 @@ class StarboardCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add StarboardCog to J.A.R.V.I.S.""" """Add StarboardCog to JARVIS"""
StarboardCog(bot) StarboardCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Twitter Cog.""" """JARVIS Twitter Cog."""
import asyncio import asyncio
import logging import logging
@ -21,7 +21,7 @@ from jarvis.utils.permissions import admin_or_permissions
class TwitterCog(Scale): class TwitterCog(Scale):
"""J.A.R.V.I.S. Twitter Cog.""" """JARVIS Twitter Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -244,5 +244,5 @@ class TwitterCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add TwitterCog to J.A.R.V.I.S.""" """Add TwitterCog to JARVIS"""
TwitterCog(bot) TwitterCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Utility Cog.""" """JARVIS Utility Cog."""
import logging import logging
import platform import platform
import re import re
@ -39,7 +39,7 @@ JARVIS_LOGO = Image.open("jarvis_small.png").convert("RGBA")
class UtilCog(Scale): class UtilCog(Scale):
""" """
Utility functions for J.A.R.V.I.S. Utility functions for JARVIS
Mostly system utility functions, but may change over time Mostly system utility functions, but may change over time
""" """
@ -48,10 +48,10 @@ class UtilCog(Scale):
self.bot = bot self.bot = bot
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
@slash_command(name="status", description="Retrieve J.A.R.V.I.S. status") @slash_command(name="status", description="Retrieve JARVIS status")
@cooldown(bucket=Buckets.CHANNEL, rate=1, interval=30) @cooldown(bucket=Buckets.CHANNEL, rate=1, interval=30)
async def _status(self, ctx: InteractionContext) -> None: async def _status(self, ctx: InteractionContext) -> None:
title = "J.A.R.V.I.S. Status" title = "JARVIS Status"
desc = f"All systems online\nConnected to **{len(self.bot.guilds)}** guilds" desc = f"All systems online\nConnected to **{len(self.bot.guilds)}** guilds"
color = "#3498db" color = "#3498db"
fields = [] fields = []
@ -376,5 +376,5 @@ class UtilCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add UtilCog to J.A.R.V.I.S.""" """Add UtilCog to JARVIS"""
UtilCog(bot) UtilCog(bot)

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Verify Cog.""" """JARVIS Verify Cog."""
import asyncio import asyncio
import logging import logging
from random import randint from random import randint
@ -31,7 +31,7 @@ def create_layout() -> list:
class VerifyCog(Scale): class VerifyCog(Scale):
"""J.A.R.V.I.S. Verify Cog.""" """JARVIS Verify Cog."""
def __init__(self, bot: Snake): def __init__(self, bot: Snake):
self.bot = bot self.bot = bot
@ -95,5 +95,5 @@ class VerifyCog(Scale):
def setup(bot: Snake) -> None: def setup(bot: Snake) -> None:
"""Add VerifyCog to J.A.R.V.I.S.""" """Add VerifyCog to JARVIS"""
VerifyCog(bot) VerifyCog(bot)

View file

@ -1,4 +1,4 @@
"""Load the config for J.A.R.V.I.S.""" """Load the config for JARVIS"""
import os import os
from jarvis_core.config import Config as CConfig from jarvis_core.config import Config as CConfig
@ -25,7 +25,7 @@ class JarvisConfig(CConfig):
class Config(object): class Config(object):
"""Config singleton object for J.A.R.V.I.S.""" """Config singleton object for JARVIS"""
def __new__(cls, *args: list, **kwargs: dict): def __new__(cls, *args: list, **kwargs: dict):
"""Get the singleton config, or creates a new one.""" """Get the singleton config, or creates a new one."""

View file

@ -1,4 +1,4 @@
"""J.A.R.V.I.S. Utility Functions.""" """JARVIS Utility Functions."""
from datetime import datetime, timezone from datetime import datetime, timezone
from pkgutil import iter_modules from pkgutil import iter_modules
@ -65,14 +65,14 @@ def modlog_embed(
def get_extensions(path: str = jarvis.cogs.__path__) -> list: def get_extensions(path: str = jarvis.cogs.__path__) -> list:
"""Get J.A.R.V.I.S. cogs.""" """Get JARVIS cogs."""
config = get_config() config = get_config()
vals = config.cogs or [x.name for x in iter_modules(path)] vals = config.cogs or [x.name for x in iter_modules(path)]
return ["jarvis.cogs.{}".format(x) for x in vals] return ["jarvis.cogs.{}".format(x) for x in vals]
def update() -> int: def update() -> int:
"""J.A.R.V.I.S. update utility.""" """JARVIS update utility."""
repo = git.Repo(".") repo = git.Repo(".")
dirty = repo.is_dirty() dirty = repo.is_dirty()
current_hash = repo.head.object.hexsha current_hash = repo.head.object.hexsha
@ -87,6 +87,6 @@ def update() -> int:
def get_repo_hash() -> str: def get_repo_hash() -> str:
"""J.A.R.V.I.S. current branch hash.""" """JARVIS current branch hash."""
repo = git.Repo(".") repo = git.Repo(".")
return repo.head.object.hexsha return repo.head.object.hexsha

View file

@ -5,7 +5,7 @@ from jarvis.config import get_config
def user_is_bot_admin() -> bool: def user_is_bot_admin() -> bool:
"""Check if a user is a J.A.R.V.I.S. admin.""" """Check if a user is a JARVIS admin."""
async def predicate(ctx: InteractionContext) -> bool: async def predicate(ctx: InteractionContext) -> bool:
"""Command check predicate.""" """Command check predicate."""