[V3 Travis] Update travis to not skip pipfile lock... (#1678)

* Update travis to not sip pipfile lock

update pipfile dependencies

additional black formatting pass to conform to black 18.5b

* .

* pin async timeout until further discussion of 3.5 support

* .
This commit is contained in:
Michael H
2018-05-18 21:48:22 -04:00
committed by palmtree5
parent 55afc7eb33
commit d3f406a34a
35 changed files with 214 additions and 297 deletions

View File

@@ -151,7 +151,7 @@ class Alias:
return
try:
potential_alias = message.content[len(prefix):].split(" ")[0]
potential_alias = message.content[len(prefix) :].split(" ")[0]
except IndexError:
return False
@@ -199,9 +199,7 @@ class Alias:
"You attempted to create a new alias"
" with the name {} but that"
" name is already a command on this bot."
).format(
alias_name
)
).format(alias_name)
)
return
@@ -212,9 +210,7 @@ class Alias:
"You attempted to create a new alias"
" with the name {} but that"
" alias already exists on this server."
).format(
alias_name
)
).format(alias_name)
)
return
@@ -226,9 +222,7 @@ class Alias:
" with the name {} but that"
" name is an invalid alias name. Alias"
" names may not contain spaces."
).format(
alias_name
)
).format(alias_name)
)
return
# endregion
@@ -255,9 +249,7 @@ class Alias:
"You attempted to create a new global alias"
" with the name {} but that"
" name is already a command on this bot."
).format(
alias_name
)
).format(alias_name)
)
return
@@ -268,9 +260,7 @@ class Alias:
"You attempted to create a new global alias"
" with the name {} but that"
" alias already exists on this server."
).format(
alias_name
)
).format(alias_name)
)
return
@@ -282,9 +272,7 @@ class Alias:
" with the name {} but that"
" name is an invalid alias name. Alias"
" names may not contain spaces."
).format(
alias_name
)
).format(alias_name)
)
return
# endregion

View File

@@ -10,9 +10,7 @@ import redbot.core
LAVALINK_DOWNLOAD_URL = (
"https://github.com/Cog-Creators/Red-DiscordBot/" "releases/download/{}/Lavalink.jar"
).format(
redbot.core.__version__
)
).format(redbot.core.__version__)
LAVALINK_DOWNLOAD_DIR = cog_data_path(raw_name="Audio")
LAVALINK_JAR_FILE = LAVALINK_DOWNLOAD_DIR / "Lavalink.jar"

View File

@@ -247,7 +247,7 @@ class Audio:
jarbuild = redbot.core.__version__
vote_percent = data["vote_percent"]
msg = ("```ini\n" "----Server Settings----\n")
msg = "```ini\n" "----Server Settings----\n"
if dj_enabled:
msg += "DJ Role: [{}]\n".format(dj_role_obj.name)
if jukebox:
@@ -262,17 +262,13 @@ class Audio:
if vote_percent > 0:
msg += (
"Vote skip: [{vote_enabled}]\n" "Skip percentage: [{vote_percent}%]\n"
).format(
**data
)
).format(**data)
msg += (
"---Lavalink Settings---\n"
"Cog version: [{}]\n"
"Jar build: [{}]\n"
"External server: [{use_external_lavalink}]```"
).format(
__version__, jarbuild, **global_data
)
).format(__version__, jarbuild, **global_data)
embed = discord.Embed(colour=ctx.guild.me.top_role.colour, description=msg)
return await ctx.send(embed=embed)
@@ -347,9 +343,8 @@ class Audio:
return await self._embed_msg(ctx, "Nothing playing.")
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You must be in the voice channel to bump a song.")
if dj_enabled:
if not await self._can_instaskip(ctx, ctx.author):
@@ -373,9 +368,8 @@ class Audio:
if dj_enabled:
if not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You need the DJ role to disconnect.")
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._is_alone(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._is_alone(
ctx, ctx.author
):
return await self._embed_msg(ctx, "There are other people listening to music.")
else:
@@ -418,9 +412,8 @@ class Audio:
dj_enabled = await self.config.guild(ctx.guild).dj_enabled()
vote_enabled = await self.config.guild(ctx.guild).vote_enabled()
if dj_enabled or vote_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._is_alone(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._is_alone(
ctx, ctx.author
):
return
@@ -458,16 +451,14 @@ class Audio:
return await self._embed_msg(ctx, "Nothing playing.")
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to pause the music."
)
if dj_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._is_alone(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._is_alone(
ctx, ctx.author
):
return await self._embed_msg(ctx, "You need the DJ role to pause songs.")
@@ -572,9 +563,8 @@ class Audio:
player.store("guild", ctx.guild.id)
await self._data_check(ctx)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to use the play command."
)
@@ -645,10 +635,9 @@ class Audio:
return
async with self.config.guild(ctx.guild).playlists() as playlists:
try:
if (
playlists[playlist_name]["author"] != ctx.author.id
and not await self._can_instaskip(ctx, ctx.author)
):
if playlists[playlist_name][
"author"
] != ctx.author.id and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You are not the author of that playlist.")
player = lavalink.get_player(ctx.guild.id)
to_append = await self._playlist_tracks(ctx, player, url)
@@ -693,10 +682,9 @@ class Audio:
"""Delete a saved playlist."""
async with self.config.guild(ctx.guild).playlists() as playlists:
try:
if (
playlists[playlist_name]["author"] != ctx.author.id
and not await self._can_instaskip(ctx, ctx.author)
):
if playlists[playlist_name][
"author"
] != ctx.author.id and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You are not the author of that playlist.")
del playlists[playlist_name]
except KeyError:
@@ -799,10 +787,9 @@ class Audio:
"""Remove a song from a playlist by url."""
async with self.config.guild(ctx.guild).playlists() as playlists:
try:
if (
playlists[playlist_name]["author"] != ctx.author.id
and not await self._can_instaskip(ctx, ctx.author)
):
if playlists[playlist_name][
"author"
] != ctx.author.id and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You are not the author of that playlist.")
except KeyError:
return await self._embed_msg(ctx, "No playlist with that name.")
@@ -977,9 +964,8 @@ class Audio:
player.store("channel", ctx.channel.id)
player.store("guild", ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
await self._embed_msg(
ctx, "You must be in the voice channel to use the playlist command."
)
@@ -1019,15 +1005,13 @@ class Audio:
player = lavalink.get_player(ctx.guild.id)
shuffle = await self.config.guild(ctx.guild).shuffle()
if dj_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._is_alone(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._is_alone(
ctx, ctx.author
):
return await self._embed_msg(ctx, "You need the DJ role to skip songs.")
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to skip the music."
)
@@ -1130,9 +1114,8 @@ class Audio:
"""Toggles repeat."""
dj_enabled = await self.config.guild(ctx.guild).dj_enabled()
if dj_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._has_dj_role(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._has_dj_role(
ctx, ctx.author
):
return await self._embed_msg(ctx, "You need the DJ role to toggle repeat.")
repeat = await self.config.guild(ctx.guild).repeat()
@@ -1142,9 +1125,8 @@ class Audio:
await self._data_check(ctx)
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to toggle repeat."
)
@@ -1163,9 +1145,8 @@ class Audio:
if not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You need the DJ role to remove songs.")
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to manage the queue."
)
@@ -1195,9 +1176,8 @@ class Audio:
player.store("channel", ctx.channel.id)
player.store("guild", ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You must be in the voice channel to enqueue songs.")
await self._data_check(ctx)
@@ -1341,14 +1321,12 @@ class Audio:
return await self._embed_msg(ctx, "Nothing playing.")
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(ctx, "You must be in the voice channel to use seek.")
if dj_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._is_alone(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._is_alone(
ctx, ctx.author
):
return await self._embed_msg(ctx, "You need the DJ role to use seek.")
if player.current:
@@ -1381,9 +1359,8 @@ class Audio:
await self._data_check(ctx)
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to toggle shuffle."
)
@@ -1396,9 +1373,8 @@ class Audio:
return await self._embed_msg(ctx, "Nothing playing.")
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to skip the music."
)
@@ -1450,13 +1426,21 @@ class Audio:
is_owner = member.id == self.bot.owner_id
is_server_owner = member.id == ctx.guild.owner_id
is_coowner = any(x == member.id for x in self.bot._co_owners)
is_admin = discord.utils.get(
ctx.guild.get_member(member.id).roles, id=admin_role
) is not None
is_admin = (
discord.utils.get(ctx.guild.get_member(member.id).roles, id=admin_role) is not None
)
is_mod = discord.utils.get(ctx.guild.get_member(member.id).roles, id=mod_role) is not None
is_bot = member.bot is True
return is_active_dj or is_owner or is_server_owner or is_coowner or is_admin or is_mod or is_bot
return (
is_active_dj
or is_owner
or is_server_owner
or is_coowner
or is_admin
or is_mod
or is_bot
)
async def _is_alone(self, ctx, member):
try:
@@ -1521,16 +1505,14 @@ class Audio:
return await self._embed_msg(ctx, "Nothing playing.")
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to stop the music."
)
if vote_enabled or vote_enabled and dj_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._is_alone(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._is_alone(
ctx, ctx.author
):
return await self._embed_msg(
ctx, "There are other people listening - vote to skip instead."
@@ -1563,16 +1545,14 @@ class Audio:
if self._player_check(ctx):
player = lavalink.get_player(ctx.guild.id)
if (
(not ctx.author.voice or ctx.author.voice.channel != player.channel)
and not await self._can_instaskip(ctx, ctx.author)
):
not ctx.author.voice or ctx.author.voice.channel != player.channel
) and not await self._can_instaskip(ctx, ctx.author):
return await self._embed_msg(
ctx, "You must be in the voice channel to change the volume."
)
if dj_enabled:
if (
not await self._can_instaskip(ctx, ctx.author)
and not await self._has_dj_role(ctx, ctx.author)
if not await self._can_instaskip(ctx, ctx.author) and not await self._has_dj_role(
ctx, ctx.author
):
return await self._embed_msg(ctx, "You need the DJ role to change the volume.")
if vol > 150:

View File

@@ -56,7 +56,7 @@ async def get_java_version(loop):
version_line = version_info.split("\n")[0]
version_start = version_line.find('"')
version_string = version_line[version_start + 1:-1]
version_string = version_line[version_start + 1 : -1]
major, minor = version_string.split(".")[:2]
return int(major), int(minor)

View File

@@ -75,17 +75,9 @@ class Bank:
currency_name = await bank._conf.guild(ctx.guild).currency()
default_balance = await bank._conf.guild(ctx.guild).default_balance()
settings = (
_(
"Bank settings:\n\n"
"Bank name: {}\n"
"Currency: {}\n"
"Default balance: {}"
""
).format(
bank_name, currency_name, default_balance
)
)
settings = _(
"Bank settings:\n\n" "Bank name: {}\n" "Currency: {}\n" "Default balance: {}" ""
).format(bank_name, currency_name, default_balance)
await ctx.send(box(settings))
await ctx.send_help()
@@ -103,9 +95,7 @@ class Bank:
_(
"This will toggle the bank to be {}, deleting all accounts "
"in the process! If you're sure, type `{}`"
).format(
word, "{}bankset toggleglobal yes".format(ctx.prefix)
)
).format(word, "{}bankset toggleglobal yes".format(ctx.prefix))
)
else:
await bank.set_global(not cur_setting)

View File

@@ -198,8 +198,10 @@ class Cleanup:
before=ctx.message,
delete_pinned=delete_pinned,
)
reason = "{}({}) deleted {} messages " " made by {}({}) in channel {}." "".format(
author.name, author.id, len(to_delete), member or "???", _id, channel.name
reason = (
"{}({}) deleted {} messages "
" made by {}({}) in channel {}."
"".format(author.name, author.id, len(to_delete), member or "???", _id, channel.name)
)
log.info(reason)
@@ -311,7 +313,7 @@ class Cleanup:
return True
p = discord.utils.find(m.content.startswith, prefixes)
if p and len(p) > 0:
cmd_name = m.content[len(p):].split(" ")[0]
cmd_name = m.content[len(p) :].split(" ")[0]
return bool(self.bot.get_command(cmd_name))
return False
@@ -326,8 +328,10 @@ class Cleanup:
)
to_delete.append(ctx.message)
reason = "{}({}) deleted {} " " command messages in channel {}." "".format(
author.name, author.id, len(to_delete), channel.name
reason = (
"{}({}) deleted {} "
" command messages in channel {}."
"".format(author.name, author.id, len(to_delete), channel.name)
)
log.info(reason)
@@ -369,7 +373,7 @@ class Cleanup:
me = ctx.guild.me
can_mass_purge = channel.permissions_for(me).manage_messages
use_re = (match_pattern and match_pattern.startswith("r(") and match_pattern.endswith(")"))
use_re = match_pattern and match_pattern.startswith("r(") and match_pattern.endswith(")")
if use_re:
match_pattern = match_pattern[1:] # strip 'r'
@@ -414,8 +418,10 @@ class Cleanup:
else:
channel_name = str(channel)
reason = "{}({}) deleted {} messages " "sent by the bot in {}." "".format(
author.name, author.id, len(to_delete), channel_name
reason = (
"{}({}) deleted {} messages "
"sent by the bot in {}."
"".format(author.name, author.id, len(to_delete), channel_name)
)
log.info(reason)

View File

@@ -40,16 +40,12 @@ class CommandObj:
return customcommands
async def get_responses(self, ctx):
intro = (
_(
"Welcome to the interactive random {} maker!\n"
"Every message you send will be added as one of the random "
"response to choose from once this {} is "
"triggered. To exit this interactive menu, type `{}`"
).format(
"customcommand", "customcommand", "exit()"
)
)
intro = _(
"Welcome to the interactive random {} maker!\n"
"Every message you send will be added as one of the random "
"response to choose from once this {} is "
"triggered. To exit this interactive menu, type `{}`"
).format("customcommand", "customcommand", "exit()")
await ctx.send(intro)
def check(m):
@@ -263,9 +259,7 @@ class CustomCommands:
_(
"There are no custom commands in this server."
" Use `{}` to start adding some."
).format(
"{}customcom add".format(ctx.prefix)
)
).format("{}customcom add".format(ctx.prefix))
)
return
@@ -314,7 +308,7 @@ class CustomCommands:
return
if user_allowed:
cmd = message.content[len(prefix):]
cmd = message.content[len(prefix) :]
try:
c = await self.commandobj.get(message=message, command=cmd)
if isinstance(c, list):

View File

@@ -28,7 +28,11 @@ def install_agreement():
return True
def does_agree(msg: discord.Message):
return ctx.author == msg.author and ctx.channel == msg.channel and msg.content == "I agree"
return (
ctx.author == msg.author
and ctx.channel == msg.channel
and msg.content == "I agree"
)
await ctx.send(REPO_INSTALL_MSG)

View File

@@ -30,7 +30,7 @@ class Repo(RepoJSONMixin):
GIT_DIFF_FILE_STATUS = (
"git -C {path} diff --no-commit-id --name-status" " {old_hash} {new_hash}"
)
GIT_LOG = ("git -C {path} log --relative-date --reverse {old_hash}.." " {relative_file_path}")
GIT_LOG = "git -C {path} log --relative-date --reverse {old_hash}.." " {relative_file_path}"
GIT_DISCOVER_REMOTE_URL = "git -C {path} config --get remote.origin.url"
PIP_INSTALL = "{python} -m pip install -U -t {target_dir} {reqs}"

View File

@@ -39,13 +39,16 @@ PAYOUTS = {
"phrase": _("JACKPOT! 226! Your bid has been multiplied * 2500!"),
},
(SMReel.flc, SMReel.flc, SMReel.flc): {
"payout": lambda x: x + 1000, "phrase": _("4LC! +1000!")
"payout": lambda x: x + 1000,
"phrase": _("4LC! +1000!"),
},
(SMReel.cherries, SMReel.cherries, SMReel.cherries): {
"payout": lambda x: x + 800, "phrase": _("Three cherries! +800!")
"payout": lambda x: x + 800,
"phrase": _("Three cherries! +800!"),
},
(SMReel.two, SMReel.six): {
"payout": lambda x: x * 4 + x, "phrase": _("2 6! Your bid has been multiplied * 4!")
"payout": lambda x: x * 4 + x,
"phrase": _("2 6! Your bid has been multiplied * 4!"),
},
(SMReel.cherries, SMReel.cherries): {
"payout": lambda x: x * 3 + x,
@@ -67,9 +70,7 @@ SLOT_PAYOUTS_MSG = _(
"{cherries.value} {cherries.value} Bet * 3\n\n"
"Three symbols: +500\n"
"Two symbols: Bet * 2"
).format(
**SMReel.__dict__
)
).format(**SMReel.__dict__)
def guild_only_check():
@@ -362,11 +363,11 @@ class Economy:
slot_time = await self.config.SLOT_TIME()
last_slot = await self.config.user(author).last_slot()
else:
valid_bid = await self.config.guild(
guild
).SLOT_MIN() <= bid <= await self.config.guild(
guild
).SLOT_MAX()
valid_bid = (
await self.config.guild(guild).SLOT_MIN()
<= bid
<= await self.config.guild(guild).SLOT_MAX()
)
slot_time = await self.config.guild(guild).SLOT_TIME()
last_slot = await self.config.member(author).last_slot()
now = calendar.timegm(ctx.message.created_at.utctimetuple())

View File

@@ -199,7 +199,7 @@ class General:
# A special case for a special someone :^)
special_date = datetime.datetime(2016, 1, 10, 6, 8, 4, 443000)
is_special = (user.id == 96130341705637888 and guild.id == 133049272517001216)
is_special = user.id == 96130341705637888 and guild.id == 133049272517001216
roles = sorted(user.roles)[1:]
@@ -268,10 +268,8 @@ class General:
text_channels = len(guild.text_channels)
voice_channels = len(guild.voice_channels)
passed = (ctx.message.created_at - guild.created_at).days
created_at = (
_("Since {}. That's over {} days ago!" "").format(
guild.created_at.strftime("%d %b %Y %H:%M"), passed
)
created_at = _("Since {}. That's over {} days ago!" "").format(
guild.created_at.strftime("%d %b %Y %H:%M"), passed
)
colour = "".join([choice("0123456789ABCDEF") for x in range(6)])
@@ -332,9 +330,8 @@ class General:
definition = item_list[pos]["definition"]
example = item_list[pos]["example"]
defs = len(item_list)
msg = (
"**Definition #{} out of {}:\n**{}\n\n"
"**Example:\n**{}".format(pos + 1, defs, definition, example)
msg = "**Definition #{} out of {}:\n**{}\n\n" "**Example:\n**{}".format(
pos + 1, defs, definition, example
)
msg = pagify(msg, ["\n"])
for page in msg:

View File

@@ -143,9 +143,8 @@ class Image:
await ctx.send_help()
return
url = (
"http://api.giphy.com/v1/gifs/search?&api_key={}&q={}"
"".format(GIPHY_API_KEY, keywords)
url = "http://api.giphy.com/v1/gifs/search?&api_key={}&q={}" "".format(
GIPHY_API_KEY, keywords
)
async with self.session.get(url) as r:
@@ -167,9 +166,8 @@ class Image:
await ctx.send_help()
return
url = (
"http://api.giphy.com/v1/gifs/random?&api_key={}&tag={}"
"".format(GIPHY_API_KEY, keywords)
url = "http://api.giphy.com/v1/gifs/random?&api_key={}&tag={}" "".format(
GIPHY_API_KEY, keywords
)
async with self.session.get(url) as r:

View File

@@ -223,9 +223,7 @@ class Mod:
"Autoban for mention spam enabled. "
"Anyone mentioning {} or more different people "
"in a single message will be autobanned."
).format(
max_mentions
)
).format(max_mentions)
)
else:
cur_setting = await self.settings.guild(guild).ban_mention_spam()
@@ -272,9 +270,7 @@ class Mod:
"Bot will delete command messages after"
" {} seconds. Set this value to -1 to"
" stop deleting messages"
).format(
delay
)
).format(delay)
)
else:
await ctx.send(_("I will not delete command messages."))
@@ -511,9 +507,7 @@ class Mod:
_(
"You have been temporarily banned from {} until {}. "
"Here is an invite for when your ban expires: {}"
).format(
guild.name, unban_time.strftime("%m-%d-%Y %H:%M:%S"), invite
)
).format(guild.name, unban_time.strftime("%m-%d-%Y %H:%M:%S"), invite)
)
except discord.HTTPException:
msg = None
@@ -580,9 +574,7 @@ class Mod:
"You have been banned and "
"then unbanned as a quick way to delete your messages.\n"
"You can now join the server again. {}"
).format(
invite
)
).format(invite)
)
except discord.HTTPException:
msg = None
@@ -686,9 +678,7 @@ class Mod:
_(
"You've been unbanned from {}.\n"
"Here is an invite for that server: {}"
).format(
guild.name, invite.url
)
).format(guild.name, invite.url)
)
except discord.Forbidden:
await ctx.send(
@@ -696,18 +686,14 @@ class Mod:
"I failed to send an invite to that user. "
"Perhaps you may be able to send it for me?\n"
"Here's the invite link: {}"
).format(
invite.url
)
).format(invite.url)
)
except discord.HTTPException:
await ctx.send(
_(
"Something went wrong when attempting to send that user"
"an invite. Here's the link so you can try: {}"
).format(
invite.url
)
).format(invite.url)
)
@staticmethod
@@ -997,7 +983,8 @@ class Mod:
return False, mute_unmute_issues["hierarchy_problem"]
perms_cache[str(channel.id)] = {
"send_messages": overwrites.send_messages, "add_reactions": overwrites.add_reactions
"send_messages": overwrites.send_messages,
"add_reactions": overwrites.add_reactions,
}
overwrites.update(send_messages=False, add_reactions=False)
try:

View File

@@ -75,10 +75,8 @@ class ModLog:
enabled = await casetype.is_enabled()
await casetype.set_enabled(True if not enabled else False)
msg = (
_("Case creation for {} actions is now {}.").format(
action, "enabled" if not enabled else "disabled"
)
msg = _("Case creation for {} actions is now {}.").format(
action, "enabled" if not enabled else "disabled"
)
await ctx.send(msg)

View File

@@ -252,9 +252,7 @@ class Streams:
await ctx.send(
_(
"The Youtube API key is either invalid or has not been set. " "See {}."
).format(
"`{}streamset youtubekey`".format(ctx.prefix)
)
).format("`{}streamset youtubekey`".format(ctx.prefix))
)
return
except APIError:
@@ -362,9 +360,7 @@ class Streams:
_(
"When a stream configured for stream alerts "
"comes online, {} will be mentioned"
).format(
"@\u200beveryone"
)
).format("@\u200beveryone")
)
@mention.command(aliases=["here"])
@@ -384,9 +380,7 @@ class Streams:
_(
"When a stream configured for stream alerts "
"comes online, {} will be mentioned"
).format(
"@\u200bhere"
)
).format("@\u200bhere")
)
@mention.command()
@@ -411,9 +405,7 @@ class Streams:
"When a stream configured for stream alerts "
"comes online, {} will be mentioned"
""
).format(
"@\u200b{}".format(role.name)
)
).format("@\u200b{}".format(role.name))
)
@streamset.command()
@@ -458,9 +450,7 @@ class Streams:
"I'll send a notification in this channel when a "
"channel is streaming to the {} community"
""
).format(
community.name
)
).format(community.name)
)
else:
community.channels.remove(ctx.channel.id)
@@ -471,9 +461,7 @@ class Streams:
"I won't send notifications about channels streaming "
"to the {} community in this channel anymore"
""
).format(
community.name
)
).format(community.name)
)
await self.save_communities()

View File

@@ -266,7 +266,7 @@ class TwitchStream(Stream):
url = channel["url"]
logo = channel["logo"]
if logo is None:
logo = ("https://static-cdn.jtvnw.net/" "jtv_user_pictures/xarth/404_user_70x70.png")
logo = "https://static-cdn.jtvnw.net/" "jtv_user_pictures/xarth/404_user_70x70.png"
status = channel["status"]
if not status:
status = "Untitled broadcast"
@@ -348,7 +348,7 @@ class MixerStream(Stream):
raise APIError()
def make_embed(self, data):
default_avatar = ("https://mixer.com/_latest/assets/images/main/" "avatars/default.jpg")
default_avatar = "https://mixer.com/_latest/assets/images/main/" "avatars/default.jpg"
user = data["user"]
url = "https://mixer.com/" + data["token"]
embed = discord.Embed(title=data["name"], url=url)

View File

@@ -19,7 +19,7 @@ _FAIL_MESSAGES = (
)
class TriviaSession():
class TriviaSession:
"""Class to run a session of trivia with the user.
To run the trivia session immediately, use `TriviaSession.start` instead of
@@ -127,7 +127,7 @@ class TriviaSession():
num_lists = len(list_names)
if num_lists > 2:
# at least 3 lists, join all but last with comma
msg = ", ".join(list_names[:num_lists - 1])
msg = ", ".join(list_names[: num_lists - 1])
# join onto last with "and"
msg = " and ".join((msg, list_names[num_lists - 1]))
else:
@@ -216,9 +216,7 @@ class TriviaSession():
answers = tuple(s.lower() for s in answers)
def _pred(message: discord.Message):
early_exit = (
message.channel != self.ctx.channel or message.author == self.ctx.guild.me
)
early_exit = message.channel != self.ctx.channel or message.author == self.ctx.guild.me
if early_exit:
return False

View File

@@ -228,9 +228,7 @@ class Warnings:
_(
"Custom reasons are not allowed! Please see {} for "
"a complete list of valid reasons"
).format(
"`{}reasonlist`".format(ctx.prefix)
)
).format("`{}reasonlist`".format(ctx.prefix))
)
return
reason_type = await self.custom_warning_reason(ctx)