当前位置: 首页>>代码示例>>Python>>正文


Python Language.get方法代码示例

本文整理汇总了Python中utils.language.Language.get方法的典型用法代码示例。如果您正苦于以下问题:Python Language.get方法的具体用法?Python Language.get怎么用?Python Language.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.language.Language的用法示例。


在下文中一共展示了Language.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: showjoinleaveconfig

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def showjoinleaveconfig(self, ctx):
     """Shows the on user join and leave config"""
     await ctx.channel.trigger_typing()
     join_message = read_data_entry(ctx.guild.id, "join-message")
     if join_message is not None:
         join_message = join_message.replace("%user%", "@{}".format(ctx.author.name)).replace("%server%", ctx.guild.name)
     leave_message = read_data_entry(ctx.guild.id, "leave-message")
     if leave_message is not None:
         leave_message = leave_message.replace("%user%", "@{}".format(ctx.author.name)).replace("%server%", ctx.guild.name)
     join_leave_channel_id = read_data_entry(ctx.guild.id, "join-leave-channel")
     if join_leave_channel_id is not None:
         join_leave_channel = discord.utils.get(ctx.guild.channels, id=join_leave_channel_id).mention
         if join_leave_channel is None:
             update_data_entry(ctx.guild.id, "join-leave-channel", None)
     else:
         join_leave_channel = None
     join_role_id = read_data_entry(ctx.guild.id, "join-role")
     if join_role_id is not None:
         join_role = discord.utils.get(ctx.guild.roles, id=join_role_id).name
         if join_role is None:
             update_data_entry(ctx.guild.id, "join-role", None)
     else:
         join_role = None
     fields = {Language.get("configuration.join_message", ctx):join_message, Language.get("configuration.leave_message", ctx):leave_message, Language.get("configuration.channel", ctx):join_leave_channel, Language.get("configuration.join_role", ctx):join_role}
     embed = make_list_embed(fields)
     embed.title = Language.get("configuration.showjoinleaveconfig_title", ctx)
     embed.color = 0xFF0000
     await ctx.send(embed=embed)
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:30,代码来源:configuration.py

示例2: createrole

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def createrole(self, ctx, *, name:str):
     """Creates a role with the specified name"""
     try:
         await ctx.guild.create_role(name=name, reason=Language.get("createrole_reason", ctx).format(ctx.author), permissions=ctx.guild.default_role.permissions)
         await ctx.send(Language.get("createrole_success", ctx).format(name))
     except discord.errors.Forbidden:
         await ctx.send(Language.get("moderation.no_manage_role_perms", ctx))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:9,代码来源:moderation.py

示例3: emoteinfo

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def emoteinfo(self, ctx, *, emote:discord.Emoji):
     """Gets information on a custom emote (Only works for servers the bot is on)"""
     fields = {Language.get("information.name", ctx):emote.name, Language.get("information.id", ctx):emote.id, Language.get("information.server_origin", ctx):emote.guild.name, Language.get("information.created_on", ctx):format_time(emote.created_at), Language.get("information.colons_required", ctx):emote.require_colons, Language.get("information.managed_by_twitch", ctx):emote.managed}
     embed = make_list_embed(fields)
     embed.title = ":{}:".format(emote.name)
     embed.color = 0xFF0000
     embed.set_thumbnail(url=emote.url)
     await ctx.send(embed=embed)
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:10,代码来源:information.py

示例4: rate

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def rate(self, ctx, user:discord.User=None):
     """Have the bot rate yourself or another user (rigged af)"""
     if user is None or user.id == ctx.author.id:
         await ctx.send(Language.get("fun.rate_author", ctx))
     elif user == self.bot.user:
         await ctx.send(Language.get("fun.rate_self", ctx))
     else:
         await ctx.send(Language.get("fun.rate_user", ctx).format(user.name, random.randint(0, 10)))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:10,代码来源:fun.py

示例5: config

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def config(self, ctx, type:str, *, value:str):
     """Modifies the server's local config"""
     await ctx.channel.trigger_typing()
     if type == "mod-role" or type == "mute-role":
         update_data_entry(ctx.guild.id, type, value)
         await ctx.send(Language.get("configuration.set_success", ctx).format(type, value))
     else:
         await ctx.send(Language.get("configuration.invalid_set_type", ctx).format(type))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:10,代码来源:configuration.py

示例6: stream

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
async def stream(ctx, *, name:str):
    """Sets the streaming status with the specified name"""
    if lock_status:
        if not ctx.author.id == config.owner_id and not ctx.author.id in config.dev_ids:
            await ctx.send(Language.get("bot.status_locked", ctx))
            return
    await bot.change_presence(activity=discord.Activity(name=name, type=discord.ActivityType.streaming, url="https://www.twitch.tv/ZeroEpoch1969"))
    await ctx.send(Language.get("bot.now_streaming", ctx).format(name))
    await channel_logger.log_to_channel(":information_source: `{}`/`{}` has changed the streaming status to `{}`".format(ctx.author.id, ctx.author, name))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:11,代码来源:bot.py

示例7: showconfig

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def showconfig(self, ctx):
     """Shows the server's configuration"""
     await ctx.channel.trigger_typing()
     mod_role_name = read_data_entry(ctx.guild.id, "mod-role")
     mute_role_name = read_data_entry(ctx.guild.id, "mute-role")
     fields = {Language.get("configuration.mod_role", ctx):mod_role_name, Language.get("configuration.mute_role", ctx):mute_role_name}
     embed = make_list_embed(fields)
     embed.title = Language.get("configuration.server_configuration", ctx)
     embed.color = 0xFF0000
     await ctx.send(embed=embed)
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:12,代码来源:configuration.py

示例8: joinleave

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def joinleave(self, ctx, type:str, *, value:str):
     """Configures on user join and leave settings"""
     await ctx.channel.trigger_typing()
     if type == "join-message":
         update_data_entry(ctx.guild.id, type, value)
         await ctx.send(Language.get("configuration.join_message_set_success", ctx).format(value.replace("%user%", "@{}".format(ctx.author.name)).replace("%server%", ctx.guild.name)))
     elif type == "leave-message":
         update_data_entry(ctx.guild.id, type, value)
         await ctx.send(Language.get("configuration.leave_message_set_success", ctx).format(value.replace("%user%", "@{}".format(ctx.author.name)).replace("%server%", ctx.guild.name)))
     elif type == "channel":
         if value == "remove":
             update_data_entry(ctx.guild.id, "join-leave-channel", None)
             await ctx.send(Language.get("configuration.join-leave_disabled", ctx))
             return
         channel = discord.utils.get(ctx.guild.channels, name=value)
         if channel is None:
             await ctx.send(Language.get("configuration.channel_not_found", ctx).format(value))
             return
         update_data_entry(ctx.guild.id, "join-leave-channel", channel.id)
         await ctx.send(Language.get("configuration.join-leave_channel_set_success", ctx).format(channel.mention))
     elif type == "join-role":
         if value == "remove":
             update_data_entry(ctx.guild.id, type, None)
             await ctx.send(Language.get("configuration.join-leave_role_disabled", ctx))
             return
         role = discord.utils.get(ctx.guild.roles, name=value)
         if role is None:
             await ctx.send(Language.get("configuration.role_not_found", ctx).format(value))
             return
         update_data_entry(ctx.guild.id, type, role.id)
         await ctx.send(Language.get("configuration.join-role_set_success", ctx).format(role.name))
     else:
         await ctx.send(Language.get("configuration.join_settings_invalid_type", ctx).format(type))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:35,代码来源:configuration.py

示例9: pin

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def pin(self, ctx, id:int):
     """Pins the message with the specified ID to the channel"""
     try:
         message = await ctx.channel.fetch_message(id)
     except discord.errors.NotFound:
         await ctx.send(Language.get("bot.no_message_found", ctx).format(id))
         return
     try:
         await message.pin()
     except discord.errors.Forbidden:
         await ctx.send(Language.get("moderation.no_manage_messages_perms", ctx))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:13,代码来源:moderation.py

示例10: unpin

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def unpin(self, ctx, id:int):
     """Unpins the message with the specified ID from the channel"""
     pinned_messages = await ctx.channel.pins()
     message = discord.utils.get(pinned_messages, id=id)
     if message is None:
         await ctx.send(Language.get("moderation.no_pinned_message_found", ctx).format(id))
         return
     try:
         await message.unpin()
         await ctx.send(Language.get("moderation.unpin_success", ctx))
     except discord.errors.Forbidden:
         await ctx.send(Language.get("moderation.no_manage_messages_perms", ctx))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:14,代码来源:moderation.py

示例11: kick

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def kick(self, ctx, user:discord.Member):
     """Kicks the specified user from the server"""
     try:
         await ctx.guild.kick(user)
     except discord.errors.Forbidden:
         if user.top_role.position == ctx.me.top_role.position:
             await ctx.send(Language.get("moderation.no_kick_highest_role", ctx))
         elif user.top_role.position > ctx.me.top_role.position:
             await ctx.send(Language.get("moderation.no_kick_higher_role", ctx))
         else:
             await ctx.send(Language.get("moderation.no_kick_perms", ctx))
     await ctx.send(Language.get("moderation.kick_success", ctx).format(user))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:14,代码来源:moderation.py

示例12: removereactions

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def removereactions(self, ctx, id:int):
     """Clear reactions from a message"""
     try:
         message = await ctx.channel.fetch_message(id)
     except discord.errors.NotFound:
         await ctx.send(Language.get("bot.no_message_found", ctx).format(id))
         return
     try:
         await message.clear_reactions()
         await ctx.send(Language.get("moderation.removereactions_success", ctx))
     except discord.errors.Forbidden:
         await ctx.send(Language.get("moderation.no_manage_messages_perms", ctx))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:14,代码来源:moderation.py

示例13: serverinfo

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def serverinfo(self, ctx):
     """Gets information on the current server"""
     guild = ctx.guild
     human_count = len([member for member in guild.members if not member.bot])
     bot_count = len(([member for member in guild.members if member.bot]))
     timeout_times = {60:Language.get("information.timeout_times.60", ctx), 300:Language.get("information.timeout_times.300", ctx), 900:Language.get("information.timeout_times.900", ctx), 1800:Language.get("information.timeout_times.1800", ctx), 3600:Language.get("information.timeout_times.3600", ctx)}
     fields = {Language.get("information.id", ctx):guild.id, Language.get("information.created_on", ctx):format_time(guild.created_at), Language.get("information.region", ctx):guild.region, Language.get("information.member_count_title", ctx).format(len(guild.members)):Language.get("information.member_count", ctx).format(human_count, bot_count), Language.get("information.channel_count_title", ctx).format(len(guild.channels)):Language.get("information.channel_count", ctx).format(len(guild.text_channels), len(guild.voice_channels)), Language.get("information.role_count", ctx):len(guild.roles), Language.get("information.owner", ctx):guild.owner, Language.get("information.owner_id", ctx):guild.owner_id, Language.get("information.afk_channel", ctx):guild.afk_channel, Language.get("information.afk_timeout", ctx):timeout_times[guild.afk_timeout], Language.get("information.verification_level", ctx):str(ctx.guild.verification_level).capitalize().replace("High", tableflip).replace("Extreme", doubleflip), Language.get("information.2fa_enabled", ctx):convert_to_bool(guild.mfa_level)}
     embed = make_list_embed(fields)
     embed.title = guild.name
     embed.color = 0xFF0000
     if guild.icon_url:
         embed.set_thumbnail(url=guild.icon_url)
     await ctx.send(embed=embed)
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:15,代码来源:information.py

示例14: isitdown

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def isitdown(self, ctx, *, url:str):
     """Checks to see if a website is online or not"""
     await ctx.channel.trigger_typing()
     url = url.strip("<>")
     if not url.startswith("http://") and not url.startswith("https://"):
         url = "http://{}".format(url)
     try:
         starttime = time.time()
         requests.get(url, timeout=3)
         ping = Language.get("information.ping_time", ctx) % (time.time() - starttime)
         await ctx.send(Language.get("information.online_ping", ctx).format(url, ping))
     except:
         await ctx.send(Language.get("information.offline_ping", ctx).format(url))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:15,代码来源:information.py

示例15: getuserbyid

# 需要导入模块: from utils.language import Language [as 别名]
# 或者: from utils.language.Language import get [as 别名]
 async def getuserbyid(self, ctx, id:int):
     """Gets a user by id"""
     user = discord.utils.get(list(self.bot.get_all_members()), id=id)
     if not user:
         await ctx.send(Language.get("information.no_mutual_servers", ctx).format(id))
         return
     if user.game:
         game = user.game.name
     fields = {Language.get("information.name", ctx):user.name, Language.get("information.discriminator", ctx):user.discriminator, Language.get("information.id", ctx):user.id, Language.get("information.statud", ctx):str(user.status).replace("dnd", "do not disturb"), Language.get("information.game", ctx):game, Language.get("information.boot", ctx):user.bot}
     embed = make_list_embed(fields)
     embed.title = str(user)
     embed.color = 0xFF0000
     embed.set_thumbnail(url=get_avatar(user))
     await ctx.send(embed=embed)
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:16,代码来源:information.py


注:本文中的utils.language.Language.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。