• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python language.Language类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: showjoinleaveconfig

 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,代码行数:28,代码来源:configuration.py


示例2: createrole

 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,代码行数:7,代码来源:moderation.py


示例3: emoteinfo

 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,代码行数:8,代码来源:information.py


示例4: rate

 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,代码行数:8,代码来源:fun.py


示例5: config

 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,代码行数:8,代码来源:configuration.py


示例6: stream

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,代码行数:9,代码来源:bot.py


示例7: showconfig

 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,代码行数:10,代码来源:configuration.py


示例8: joinleave

 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,代码行数:33,代码来源:configuration.py


示例9: pin

 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,代码行数:11,代码来源:moderation.py


示例10: unpin

 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,代码行数:12,代码来源:moderation.py


示例11: kick

 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,代码行数:12,代码来源:moderation.py


示例12: removereactions

 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,代码行数:12,代码来源:moderation.py


示例13: serverinfo

 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,代码行数:13,代码来源:information.py


示例14: isitdown

 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,代码行数:13,代码来源:information.py


示例15: getuserbyid

 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,代码行数:14,代码来源:information.py


示例16: osu

 async def osu(self, ctx, *, username:str):
     """Gets an osu! profile stats with the specified name"""
     if not config.enableOsu:
         await ctx.send(Language.get("information.osu_command_disabled", ctx))
         return
     try:
         import osuapi
     except ImportError:
         log.critical("The osu api is enabled, but the osuapi module was not found! Please run \"pip install osuapi\"")
         await ctx.send(Language.get("osu_import_fail", ctx))
         return
     await ctx.channel.trigger_typing()
     api = osuapi.OsuApi(config._osuKey, connector=osuapi.AHConnector())
     try:
         user = await api.get_user(username)
     except osuapi.HTTPError as e:
         if e.code == 401:
             log.critical("An invalid osu! api key was set, please check the config for instructions on how to get a proper api key!")
             await ctx.send(Language.get("information.osu_invalid_key", ctx))
             return
         else:
             log.critical("An unknown error occured while trying to get an osu! profile.")
             await ctx.send(Language.get("information.osu_unknown_error", ctx))
             return
     try:
         user = user[0]
     except IndexError:
         await ctx.send(Language.get("information.no_osu_profile_found", ctx).format(username))
         return
     fields = {Language.get("information.id", ctx):user.user_id, Language.get("information.country", ctx):user.country, Language.get("information.level", ctx):int(user.level), Language.get("information.hits", ctx):user.total_hits, Language.get("information.score", ctx):user.total_score, Language.get("information.accuracy", ctx):"{0:.2f}%".format(user.accuracy), Language.get("information.play_count", ctx):user.playcount, Language.get("information.ranked_score", ctx):user.ranked_score, Language.get("information.a_rank", ctx):user.count_rank_a, Language.get("information.s_rank", ctx):user.count_rank_s, Language.get("information.ss_rank", ctx):user.count_rank_ss}
     embed = make_list_embed(fields)
     embed.title = Language.get("information.osu_stats_title", ctx).format(user.username)
     embed.color = 0xFF00FF
     embed.set_thumbnail(url="http://s.ppy.sh/a/{}".format(user.user_id))
     await ctx.send(embed=embed)
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:35,代码来源:information.py


示例17: prune

 async def prune(self, ctx, amount:int):
     """Prunes the specified amount of messages (you can also prune messages from a specific user too)"""
     try:
         await ctx.message.delete()
     except discord.errors.Forbidden:
         await ctx.send(Language.get("moderation.no_manage_messages_perms", ctx))
         return
     deleted = await ctx.channel.purge(limit=amount)
     deleted_message = await ctx.send(Language.get("moderation.pruned", ctx).format(ctx.author.mention, len(deleted)))
     await asyncio.sleep(10)
     # The try and except pass is so in the event a user prunes again or deletes the prune notification before the bot automatically does it, it will not raise an error
     try:
         await deleted_message.delete()
     except:
         pass
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:15,代码来源:moderation.py


示例18: massban

 async def massban(self, ctx, *, ids:str):
     """Mass bans users by ids (separate ids with spaces)"""
     await ctx.channel.trigger_typing()
     ids = ids.split(" ")
     failed_ids = []
     success = 0
     for id in ids:
         try:
             await self.bot.http.ban(int(id), ctx.guild.id, delete_message_days=0)
             success += 1
         except:
             failed_ids.append("`{}`".format(id))
     if len(failed_ids) != 0:
         await ctx.send(Language.get("moderation.massban_failed_ids", ctx).format(", ".join(ids)))
     await ctx.send(Language.get("moderation.massban_success", ctx).format(success, len(ids)))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:15,代码来源:moderation.py


示例19: unban

 async def unban(self, ctx, *, username:str):
     """Unbans the user with the specifed name from the server"""
     try:
         banlist = await ctx.guild.bans()
     except discord.errors.Forbidden:
         await ctx.send(Language.get("moderation.no_ban_perms", ctx))
         return
     user = None
     for ban in banlist:
         if ban.user.name == username:
             user = ban.user
     if user is None:
         await ctx.send(Language.get("moderation.user_not_banned", ctx).format(username))
         return
     await ctx.guild.unban(user)
     await ctx.send(Language.get("moderation.unban_success", ctx).format(user))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:16,代码来源:moderation.py


示例20: uptime

async def uptime(ctx):
    """Displays how long the bot has been online for"""
    second = time.time() - start_time
    minute, second = divmod(second, 60)
    hour, minute = divmod(minute, 60)
    day, hour = divmod(hour, 24)
    week, day = divmod(day, 7)
    await ctx.send(Language.get("bot.uptime", ctx) % (week, day, hour, minute, second))
开发者ID:CreeperSeth,项目名称:RubyRoseBot,代码行数:8,代码来源:bot.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.audit_log函数代码示例发布时间:2022-05-26
下一篇:
Python kubernetes.KubeUtil类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap