mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +00:00
Merge branch 'dev'
This commit is contained in:
commit
a0b5210ab5
16 changed files with 15 additions and 13 deletions
|
@ -6,6 +6,7 @@ import discord as d
|
||||||
from discord import errors as err
|
from discord import errors as err
|
||||||
from discord.ext import commands as cmds
|
from discord.ext import commands as cmds
|
||||||
from discord.ext.commands import errors as errext
|
from discord.ext.commands import errors as errext
|
||||||
|
import gmusicapi as gpm
|
||||||
|
|
||||||
from misc import exceptions as exc
|
from misc import exceptions as exc
|
||||||
from misc import checks
|
from misc import checks
|
|
@ -81,7 +81,7 @@ async def on_ready():
|
||||||
await bot.change_presence(game=d.Game(name=u.config['playing']))
|
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))
|
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')
|
# u.notify('C O N N E C T E D')
|
||||||
|
|
||||||
if u.temp['startup']:
|
if u.temp['startup']:
|
|
@ -6,6 +6,7 @@ import subprocess
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from fractions import gcd
|
from fractions import gcd
|
||||||
import math
|
import math
|
||||||
|
import gmusicapi as gpm
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import discord as d
|
import discord as d
|
||||||
|
@ -68,7 +69,7 @@ def dump(obj, filename, *, json=False):
|
||||||
|
|
||||||
settings = setdefault('misc/settings.pkl', {'del_ctx': [], 'prefixes': {}})
|
settings = setdefault('misc/settings.pkl', {'del_ctx': [], 'prefixes': {}})
|
||||||
tasks = setdefault('cogs/tasks.pkl', {'auto_del': [], 'auto_rev': []})
|
tasks = setdefault('cogs/tasks.pkl', {'auto_del': [], 'auto_rev': []})
|
||||||
temp = setdefault('temp/temp.pkl', {})
|
temp = setdefault('temp/temp.pkl', {'startup': ()})
|
||||||
|
|
||||||
RATE_LIMIT = 2.2
|
RATE_LIMIT = 2.2
|
||||||
color = d.Color(0x1A1A1A)
|
color = d.Color(0x1A1A1A)
|
||||||
|
@ -76,6 +77,15 @@ session = aiohttp.ClientSession()
|
||||||
last_commands = {}
|
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):
|
# async def clear(obj, interval=10 * 60, replace=None):
|
||||||
# if replace is None:
|
# if replace is None:
|
||||||
# if type(obj) is list:
|
# if type(obj) is list:
|
||||||
|
@ -107,17 +117,8 @@ def close(loop):
|
||||||
print('Finished cancelling tasks.')
|
print('Finished cancelling tasks.')
|
||||||
|
|
||||||
|
|
||||||
async def fetch(url, *, params={}, json=False, response=False):
|
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=[]):
|
||||||
async with session.get(url, params=params, headers={'User-Agent': 'Myned/Modumind/dev'}) as r:
|
embed = d.Embed(title=title, type=kind, description=description, url=url, timestamp=timestamp, colour=colour if isinstance(ctx.channel, d.TextChannel) else color)
|
||||||
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)
|
|
||||||
|
|
||||||
if footer:
|
if footer:
|
||||||
embed.set_footer(text=footer.get('text', d.Embed.Empty), icon_url=footer.get('icon_url', d.Embed.Empty))
|
embed.set_footer(text=footer.get('text', d.Embed.Empty), icon_url=footer.get('icon_url', d.Embed.Empty))
|
Loading…
Reference in a new issue