diff --git a/src/main/__init__.py b/src/__init__.py similarity index 100% rename from src/main/__init__.py rename to src/__init__.py diff --git a/src/main/cogs/__init__.py b/src/cogs/__init__.py similarity index 100% rename from src/main/cogs/__init__.py rename to src/cogs/__init__.py diff --git a/src/main/cogs/booru.py b/src/cogs/booru.py similarity index 100% rename from src/main/cogs/booru.py rename to src/cogs/booru.py diff --git a/src/main/cogs/info.py b/src/cogs/info.py similarity index 100% rename from src/main/cogs/info.py rename to src/cogs/info.py diff --git a/src/main/cogs/management.py b/src/cogs/management.py similarity index 100% rename from src/main/cogs/management.py rename to src/cogs/management.py diff --git a/src/main/cogs/owner.py b/src/cogs/owner.py similarity index 100% rename from src/main/cogs/owner.py rename to src/cogs/owner.py diff --git a/src/main/cogs/periodic.py b/src/cogs/periodic.py similarity index 93% rename from src/main/cogs/periodic.py rename to src/cogs/periodic.py index f1dcb1e..76242d3 100644 --- a/src/main/cogs/periodic.py +++ b/src/cogs/periodic.py @@ -6,6 +6,7 @@ import discord as d from discord import errors as err from discord.ext import commands as cmds from discord.ext.commands import errors as errext +import gmusicapi as gpm from misc import exceptions as exc from misc import checks diff --git a/src/main/cogs/tools.py b/src/cogs/tools.py similarity index 100% rename from src/main/cogs/tools.py rename to src/cogs/tools.py diff --git a/src/main/misc/__init__.py b/src/misc/__init__.py similarity index 100% rename from src/main/misc/__init__.py rename to src/misc/__init__.py diff --git a/src/main/misc/checks.py b/src/misc/checks.py similarity index 100% rename from src/main/misc/checks.py rename to src/misc/checks.py diff --git a/src/main/misc/exceptions.py b/src/misc/exceptions.py similarity index 100% rename from src/main/misc/exceptions.py rename to src/misc/exceptions.py diff --git a/src/main/run.py b/src/run.py similarity index 97% rename from src/main/run.py rename to src/run.py index 094cb71..5051bec 100644 --- a/src/main/run.py +++ b/src/run.py @@ -81,7 +81,7 @@ async def on_ready(): await bot.change_presence(game=d.Game(name=u.config['playing'])) print('\n> > > > > > > > >\nC O N N E C T E D : {}\n> > > > > > > > >\n'.format(bot.user.name)) - await bot.get_channel(u.config['info_channel']).send('**Started** \N{BLACK SUN WITH RAYS} .') + await bot.get_channel(u.config['info_channel']).send(f'**Started** \N{BLACK SUN WITH RAYS} `{"` or `".join(u.settings["prefixes"][ctx.guild.id] if ctx.guild.id in u.settings["prefixes"] else u.config["prefix"])}`') # u.notify('C O N N E C T E D') if u.temp['startup']: diff --git a/src/main/utils/__init__.py b/src/utils/__init__.py similarity index 100% rename from src/main/utils/__init__.py rename to src/utils/__init__.py diff --git a/src/main/utils/formatter.py b/src/utils/formatter.py similarity index 100% rename from src/main/utils/formatter.py rename to src/utils/formatter.py diff --git a/src/main/utils/scraper.py b/src/utils/scraper.py similarity index 100% rename from src/main/utils/scraper.py rename to src/utils/scraper.py diff --git a/src/main/utils/utils.py b/src/utils/utils.py similarity index 95% rename from src/main/utils/utils.py rename to src/utils/utils.py index 57fca4e..791b274 100644 --- a/src/main/utils/utils.py +++ b/src/utils/utils.py @@ -6,6 +6,7 @@ import subprocess from contextlib import suppress from fractions import gcd import math +import gmusicapi as gpm import aiohttp import discord as d @@ -68,7 +69,7 @@ def dump(obj, filename, *, json=False): settings = setdefault('misc/settings.pkl', {'del_ctx': [], 'prefixes': {}}) tasks = setdefault('cogs/tasks.pkl', {'auto_del': [], 'auto_rev': []}) -temp = setdefault('temp/temp.pkl', {}) +temp = setdefault('temp/temp.pkl', {'startup': ()}) RATE_LIMIT = 2.2 color = d.Color(0x1A1A1A) @@ -76,6 +77,15 @@ session = aiohttp.ClientSession() last_commands = {} +async def fetch(url, *, params={}, json=False, response=False): + async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modumind'}) as r: + if response: + return r + elif json: + return await r.json() + return await r.read() + + # async def clear(obj, interval=10 * 60, replace=None): # if replace is None: # if type(obj) is list: @@ -107,17 +117,8 @@ def close(loop): print('Finished cancelling tasks.') -async def fetch(url, *, params={}, json=False, response=False): - async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modumind/dev'}) as r: - if response: - return r - elif json: - return await r.json() - return await r.read() - - -def generate_embed(ctx, *, title=d.Embed.Empty, type='rich', description=d.Embed.Empty, url=d.Embed.Empty, timestamp=d.Embed.Empty, colour=color, footer={}, image=d.Embed.Empty, thumbnail=d.Embed.Empty, author={}, fields=[]): - embed = d.Embed(title=title, type=type, description=description, url=url, timestamp=timestamp, colour=colour if isinstance(ctx.channel, d.TextChannel) else color) +def generate_embed(ctx, *, title=d.Embed.Empty, kind='rich', description=d.Embed.Empty, url=d.Embed.Empty, timestamp=d.Embed.Empty, colour=color, footer={}, image=d.Embed.Empty, thumbnail=d.Embed.Empty, author={}, fields=[]): + embed = d.Embed(title=title, type=kind, description=description, url=url, timestamp=timestamp, colour=colour if isinstance(ctx.channel, d.TextChannel) else color) if footer: embed.set_footer(text=footer.get('text', d.Embed.Empty), icon_url=footer.get('icon_url', d.Embed.Empty))