From 0810c98cc6911285e9d52a450d5120b1cb687fc1 Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 5 Dec 2017 01:48:44 -0500 Subject: [PATCH 1/6] Changed import alias to gpm --- src/main/cogs/periodic.py | 1 + src/main/utils/utils.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/cogs/periodic.py b/src/main/cogs/periodic.py index f1dcb1e..76242d3 100644 --- a/src/main/cogs/periodic.py +++ b/src/main/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/utils/utils.py b/src/main/utils/utils.py index 57fca4e..8bc0529 100644 --- a/src/main/utils/utils.py +++ b/src/main/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 From 3b4d5257fe02664d1216ece164f8fea5a8b2651a Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 5 Dec 2017 01:49:16 -0500 Subject: [PATCH 2/6] Added default startup value to temp.pkl --- src/main/utils/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/utils/utils.py b/src/main/utils/utils.py index 8bc0529..d636abd 100644 --- a/src/main/utils/utils.py +++ b/src/main/utils/utils.py @@ -69,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) From c288adcfe6a37e0eae148cf414b83a40d4d0fc39 Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 5 Dec 2017 01:49:47 -0500 Subject: [PATCH 3/6] Removed branch identifier for UA header --- src/main/utils/utils.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/utils/utils.py b/src/main/utils/utils.py index d636abd..5cf3f1e 100644 --- a/src/main/utils/utils.py +++ b/src/main/utils/utils.py @@ -77,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: @@ -108,15 +117,6 @@ 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) From 8c377d6a201aa46a8b41c90c636f536f5a40e6ec Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 5 Dec 2017 01:50:44 -0500 Subject: [PATCH 4/6] Changed type parameter to kind to avoid conflicts --- src/main/utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/utils/utils.py b/src/main/utils/utils.py index 5cf3f1e..791b274 100644 --- a/src/main/utils/utils.py +++ b/src/main/utils/utils.py @@ -117,8 +117,8 @@ def close(loop): print('Finished cancelling tasks.') -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)) From 22c235386fd62b8e7018dd33b1e2482b6afedcce Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 5 Dec 2017 01:51:22 -0500 Subject: [PATCH 5/6] Changed bot startup channel message to include contextual prefixes --- src/main/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/run.py b/src/main/run.py index 094cb71..5051bec 100644 --- a/src/main/run.py +++ b/src/main/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']: From 186bb0f68f8eb16ff6006bd93af8043b61baf19a Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 5 Dec 2017 06:34:43 -0500 Subject: [PATCH 6/6] Removed unneeded main folder --- src/{main => }/__init__.py | 0 src/{main => }/cogs/__init__.py | 0 src/{main => }/cogs/booru.py | 0 src/{main => }/cogs/info.py | 0 src/{main => }/cogs/management.py | 0 src/{main => }/cogs/owner.py | 0 src/{main => }/cogs/periodic.py | 0 src/{main => }/cogs/tools.py | 0 src/{main => }/misc/__init__.py | 0 src/{main => }/misc/checks.py | 0 src/{main => }/misc/exceptions.py | 0 src/{main => }/run.py | 0 src/{main => }/utils/__init__.py | 0 src/{main => }/utils/formatter.py | 0 src/{main => }/utils/scraper.py | 0 src/{main => }/utils/utils.py | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename src/{main => }/__init__.py (100%) rename src/{main => }/cogs/__init__.py (100%) rename src/{main => }/cogs/booru.py (100%) rename src/{main => }/cogs/info.py (100%) rename src/{main => }/cogs/management.py (100%) rename src/{main => }/cogs/owner.py (100%) rename src/{main => }/cogs/periodic.py (100%) rename src/{main => }/cogs/tools.py (100%) rename src/{main => }/misc/__init__.py (100%) rename src/{main => }/misc/checks.py (100%) rename src/{main => }/misc/exceptions.py (100%) rename src/{main => }/run.py (100%) rename src/{main => }/utils/__init__.py (100%) rename src/{main => }/utils/formatter.py (100%) rename src/{main => }/utils/scraper.py (100%) rename src/{main => }/utils/utils.py (100%) 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 100% rename from src/main/cogs/periodic.py rename to src/cogs/periodic.py 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 100% rename from src/main/run.py rename to src/run.py 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 100% rename from src/main/utils/utils.py rename to src/utils/utils.py