[V3] Mod.py guild -> server (#1522)

* mod guild->server naming

* typo
This commit is contained in:
bobloy 2018-04-16 04:13:26 -04:00 committed by Kowlin
parent 580aeea4e2
commit 1bc650b0f9

View File

@ -141,7 +141,7 @@ class Mod:
"name": "smute", "name": "smute",
"default_setting": True, "default_setting": True,
"image": "\N{SPEAKER WITH CANCELLATION STROKE}", "image": "\N{SPEAKER WITH CANCELLATION STROKE}",
"case_str": "Guild Mute", "case_str": "Server Mute",
"audit_type": "overwrite_update" "audit_type": "overwrite_update"
}, },
{ {
@ -162,7 +162,7 @@ class Mod:
"name": "sunmute", "name": "sunmute",
"default_setting": True, "default_setting": True,
"image": "\N{SPEAKER}", "image": "\N{SPEAKER}",
"case_str": "Guild Unmute", "case_str": "Server Unmute",
"audit_type": "overwrite_update" "audit_type": "overwrite_update"
} }
] ]
@ -175,7 +175,7 @@ class Mod:
@commands.guild_only() @commands.guild_only()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def modset(self, ctx: RedContext): async def modset(self, ctx: RedContext):
"""Manages guild administration settings.""" """Manages server administration settings."""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
guild = ctx.guild guild = ctx.guild
await ctx.send_help() await ctx.send_help()
@ -399,7 +399,7 @@ class Mod:
@commands.guild_only() @commands.guild_only()
@checks.admin_or_permissions(ban_members=True) @checks.admin_or_permissions(ban_members=True)
async def hackban(self, ctx: RedContext, user_id: int, *, reason: str = None): async def hackban(self, ctx: RedContext, user_id: int, *, reason: str = None):
"""Preemptively bans user from the guild """Preemptively bans user from the server
A user ID needs to be provided in order to ban A user ID needs to be provided in order to ban
using this command""" using this command"""
@ -437,7 +437,7 @@ class Mod:
await ctx.send(_("I lack the permissions to do this.")) await ctx.send(_("I lack the permissions to do this."))
else: else:
await ctx.send(_("Done. The user will not be able to join this " await ctx.send(_("Done. The user will not be able to join this "
"guild.")) "server."))
user_info = await self.bot.get_user_info(user_id) user_info = await self.bot.get_user_info(user_id)
try: try:
@ -528,7 +528,7 @@ class Mod:
msg = await user.send( msg = await user.send(
_("You have been banned and " _("You have been banned and "
"then unbanned as a quick way to delete your messages.\n" "then unbanned as a quick way to delete your messages.\n"
"You can now join the guild again. {}").format(invite)) "You can now join the server again. {}").format(invite))
except discord.HTTPException: except discord.HTTPException:
msg = None msg = None
self.ban_queue.append(queue_entry) self.ban_queue.append(queue_entry)
@ -606,7 +606,7 @@ class Mod:
await ctx.send(_("Something went wrong while attempting to unban that user")) await ctx.send(_("Something went wrong while attempting to unban that user"))
return return
else: else:
await ctx.send(_("Unbanned that user from this guild")) await ctx.send(_("Unbanned that user from this server"))
try: try:
await modlog.create_case( await modlog.create_case(
@ -622,7 +622,7 @@ class Mod:
try: try:
user.send( user.send(
_("You've been unbanned from {}.\n" _("You've been unbanned from {}.\n"
"Here is an invite for that guild: {}").format(guild.name, invite.url)) "Here is an invite for that server: {}").format(guild.name, invite.url))
except discord.Forbidden: except discord.Forbidden:
await ctx.send( await ctx.send(
_("I failed to send an invite to that user. " _("I failed to send an invite to that user. "
@ -672,7 +672,7 @@ class Mod:
@admin_or_voice_permissions(mute_members=True, deafen_members=True) @admin_or_voice_permissions(mute_members=True, deafen_members=True)
@bot_has_voice_permissions(mute_members=True, deafen_members=True) @bot_has_voice_permissions(mute_members=True, deafen_members=True)
async def voiceban(self, ctx: RedContext, user: discord.Member, *, reason: str=None): async def voiceban(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
"""Bans the target user from speaking and listening in voice channels in the guild""" """Bans the target user from speaking and listening in voice channels in the server"""
user_voice_state = user.voice user_voice_state = user.voice
if user_voice_state is None: if user_voice_state is None:
await ctx.send(_("No voice state for that user!")) await ctx.send(_("No voice state for that user!"))
@ -689,7 +689,7 @@ class Mod:
elif needs_deafen: elif needs_deafen:
await user.edit(deafen=True, reason=audit_reason) await user.edit(deafen=True, reason=audit_reason)
else: else:
await ctx.send(_("That user is already muted and deafened guild-wide!")) await ctx.send(_("That user is already muted and deafened server-wide!"))
return return
await ctx.send( await ctx.send(
_("User has been banned from speaking or " _("User has been banned from speaking or "
@ -709,7 +709,7 @@ class Mod:
@admin_or_voice_permissions(mute_members=True, deafen_members=True) @admin_or_voice_permissions(mute_members=True, deafen_members=True)
@bot_has_voice_permissions(mute_members=True, deafen_members=True) @bot_has_voice_permissions(mute_members=True, deafen_members=True)
async def voiceunban(self, ctx: RedContext, user: discord.Member, *, reason: str=None): async def voiceunban(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
"""Unbans the user from speaking/listening in the guild's voice channels""" """Unbans the user from speaking/listening in the server's voice channels"""
user_voice_state = user.voice user_voice_state = user.voice
if user_voice_state is None: if user_voice_state is None:
await ctx.send(_("No voice state for that user!")) await ctx.send(_("No voice state for that user!"))
@ -724,7 +724,7 @@ class Mod:
elif needs_undeafen: elif needs_undeafen:
await user.edit(deafen=False, reason=audit_reason) await user.edit(deafen=False, reason=audit_reason)
else: else:
await ctx.send(_("That user isn't muted or deafened by the guild!")) await ctx.send(_("That user isn't muted or deafened by the server!"))
return return
await ctx.send( await ctx.send(
_("User is now allowed to speak and listen in voice channels") _("User is now allowed to speak and listen in voice channels")
@ -763,7 +763,7 @@ class Mod:
@commands.guild_only() @commands.guild_only()
@checks.mod_or_permissions(manage_channel=True) @checks.mod_or_permissions(manage_channel=True)
async def mute(self, ctx: RedContext): async def mute(self, ctx: RedContext):
"""Mutes user in the channel/guild""" """Mutes user in the channel/server"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help() await ctx.send_help()
@ -836,17 +836,17 @@ class Mod:
await channel.send(issue) await channel.send(issue)
@checks.mod_or_permissions(administrator=True) @checks.mod_or_permissions(administrator=True)
@mute.command(name="guild") @mute.command(name="server", aliases=["guild"])
@commands.guild_only() @commands.guild_only()
async def guild_mute(self, ctx: RedContext, user: discord.Member, *, reason: str = None): async def guild_mute(self, ctx: RedContext, user: discord.Member, *, reason: str = None):
"""Mutes user in the guild""" """Mutes user in the server"""
author = ctx.message.author author = ctx.message.author
guild = ctx.guild guild = ctx.guild
user_voice_state = user.voice user_voice_state = user.voice
if reason is None: if reason is None:
audit_reason = "guild mute requested by {} (ID {})".format(author, author.id) audit_reason = "server mute requested by {} (ID {})".format(author, author.id)
else: else:
audit_reason = "guild mute requested by {} (ID {}). Reason: {}".format(author, author.id, reason) audit_reason = "server mute requested by {} (ID {}). Reason: {}".format(author, author.id, reason)
mute_success = [] mute_success = []
for channel in guild.channels: for channel in guild.channels:
@ -860,7 +860,7 @@ class Mod:
success, issue = await self.mute_user(guild, channel, author, user, audit_reason) success, issue = await self.mute_user(guild, channel, author, user, audit_reason)
mute_success.append((success, issue)) mute_success.append((success, issue))
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
await ctx.send(_("User has been muted in this guild.")) await ctx.send(_("User has been muted in this server."))
try: try:
await modlog.create_case( await modlog.create_case(
self.bot, guild, ctx.message.created_at, "smute", self.bot, guild, ctx.message.created_at, "smute",
@ -898,7 +898,7 @@ class Mod:
@commands.guild_only() @commands.guild_only()
@checks.mod_or_permissions(manage_channel=True) @checks.mod_or_permissions(manage_channel=True)
async def unmute(self, ctx: RedContext): async def unmute(self, ctx: RedContext):
"""Unmutes user in the channel/guild """Unmutes user in the channel/server
Defaults to channel""" Defaults to channel"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
@ -963,10 +963,10 @@ class Mod:
await ctx.send(_("Unmute failed. Reason: {}").format(message)) await ctx.send(_("Unmute failed. Reason: {}").format(message))
@checks.mod_or_permissions(administrator=True) @checks.mod_or_permissions(administrator=True)
@unmute.command(name="guild") @unmute.command(name="server", aliases=["guild"])
@commands.guild_only() @commands.guild_only()
async def guild_unmute(self, ctx: RedContext, user: discord.Member, *, reason: str=None): async def guild_unmute(self, ctx: RedContext, user: discord.Member, *, reason: str=None):
"""Unmutes user in the guild""" """Unmutes user in the server"""
guild = ctx.guild guild = ctx.guild
author = ctx.author author = ctx.author
channel = ctx.channel channel = ctx.channel
@ -983,7 +983,7 @@ class Mod:
success, message = await self.unmute_user(guild, channel, author, user) success, message = await self.unmute_user(guild, channel, author, user)
unmute_success.append((success, message)) unmute_success.append((success, message))
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
await ctx.send(_("User has been unmuted in this guild.")) await ctx.send(_("User has been unmuted in this server."))
try: try:
await modlog.create_case( await modlog.create_case(
self.bot, guild, ctx.message.created_at, "sunmute", self.bot, guild, ctx.message.created_at, "sunmute",
@ -1033,7 +1033,7 @@ class Mod:
@commands.guild_only() @commands.guild_only()
@checks.admin_or_permissions(manage_channels=True) @checks.admin_or_permissions(manage_channels=True)
async def ignore(self, ctx: RedContext): async def ignore(self, ctx: RedContext):
"""Adds guilds/channels to ignorelist""" """Adds servers/channels to ignorelist"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help() await ctx.send_help()
await ctx.send(await self.count_ignored()) await ctx.send(await self.count_ignored())
@ -1051,21 +1051,21 @@ class Mod:
else: else:
await ctx.send(_("Channel already in ignore list.")) await ctx.send(_("Channel already in ignore list."))
@ignore.command(name="guild", aliases=["server"]) @ignore.command(name="server", aliases=["guild"])
async def ignore_guild(self, ctx: RedContext): async def ignore_guild(self, ctx: RedContext):
"""Ignores current guild""" """Ignores current server"""
guild = ctx.guild guild = ctx.guild
if not await self.settings.guild(guild).ignored(): if not await self.settings.guild(guild).ignored():
await self.settings.guild(guild).ignored.set(True) await self.settings.guild(guild).ignored.set(True)
await ctx.send(_("This guild has been added to the ignore list.")) await ctx.send(_("This server has been added to the ignore list."))
else: else:
await ctx.send(_("This guild is already being ignored.")) await ctx.send(_("This server is already being ignored."))
@commands.group() @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.admin_or_permissions(manage_channels=True) @checks.admin_or_permissions(manage_channels=True)
async def unignore(self, ctx: RedContext): async def unignore(self, ctx: RedContext):
"""Removes guilds/channels from ignorelist""" """Removes servers/channels from ignorelist"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await ctx.send_help() await ctx.send_help()
await ctx.send(await self.count_ignored()) await ctx.send(await self.count_ignored())
@ -1084,15 +1084,15 @@ class Mod:
else: else:
await ctx.send(_("That channel is not in the ignore list.")) await ctx.send(_("That channel is not in the ignore list."))
@unignore.command(name="guild", aliases=["server"]) @unignore.command(name="server", aliases=["guild"])
async def unignore_guild(self, ctx: RedContext): async def unignore_guild(self, ctx: RedContext):
"""Removes current guild from ignore list""" """Removes current guild from ignore list"""
guild = ctx.message.guild guild = ctx.message.guild
if await self.settings.guild(guild).ignored(): if await self.settings.guild(guild).ignored():
await self.settings.guild(guild).ignored.set(False) await self.settings.guild(guild).ignored.set(False)
await ctx.send(_("This guild has been removed from the ignore list.")) await ctx.send(_("This server has been removed from the ignore list."))
else: else:
await ctx.send(_("This guild is not in the ignore list.")) await ctx.send(_("This server is not in the ignore list."))
async def count_ignored(self): async def count_ignored(self):
ch_count = 0 ch_count = 0
@ -1108,7 +1108,7 @@ class Mod:
return box(msg) return box(msg)
async def __global_check(self, ctx): async def __global_check(self, ctx):
"""Global check to see if a channel or guild is ignored. """Global check to see if a channel or server is ignored.
Any users who have permission to use the `ignore` or `unignore` commands Any users who have permission to use the `ignore` or `unignore` commands
surpass the check.""" surpass the check."""
@ -1206,7 +1206,7 @@ class Mod:
await guild.ban(author, reason="Mention spam (Autoban)") await guild.ban(author, reason="Mention spam (Autoban)")
except discord.HTTPException: except discord.HTTPException:
log.info("Failed to ban member for mention spam in " log.info("Failed to ban member for mention spam in "
"guild {}.".format(guild.id)) "server {}.".format(guild.id))
else: else:
try: try:
case = await modlog.create_case( case = await modlog.create_case(