本文整理汇总了Python中discord.gg方法的典型用法代码示例。如果您正苦于以下问题:Python discord.gg方法的具体用法?Python discord.gg怎么用?Python discord.gg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类discord
的用法示例。
在下文中一共展示了discord.gg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_guild_join
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def on_guild_join(self, guild):
"""Send welcome message to the server owner"""
message = ("Greetings! My name is **{}**, and my sole responsibility is to help you and "
"your group kick ass in Destiny 2! You're receiving this message because you "
"or one of your trusted associates has added me to **{}**.\n\n"
"**Command Prefix**\n\n"
"My default prefix is **!**, but you can also just mention me with **@{}**. "
"If another bot is already using the **!** prefix, you can choose a different prefix "
"for your server with **!settings setprefix <new_prefix>** (don't include the brackets).\n\n"
"For a list of all available commands, use the **!help** command. If you want more "
"information on a command, use **!help <command_name>**.\n\n"
"If you have any feedback, you can use my **!feedback** command to send "
"a message to my developer! If you want to request a feature, report a bug, "
"stay up to date with new features, or just want some extra help, check out the official "
"{} Support server! (https://discord.gg/GXCFpkr)"
).format(self.bot.user.name, guild.name, self.bot.user.name,
self.bot.user.name, self.bot.user.name)
await guild.owner.send(message)
示例2: initialize
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def initialize(self):
await self.bot.wait_until_ready()
key = (await self.bot.get_shared_api_tokens("dbl")).get("api_key")
try:
client = dbl.DBLClient(self.bot, key, session=self.session)
await client.get_guild_count()
except (dbl.Unauthorized, dbl.UnauthorizedDetected):
await client.close()
return await self.bot.send_to_owners(
"[DblTools cog]\n" + error_message.format(intro_msg)
)
except dbl.NotFound:
await client.close()
return await self.bot.send_to_owners(
_(
"[DblTools cog]\nThis bot seems doesn't seems be validated on Top.gg. Please try again with a validated bot."
)
)
except dbl.errors.HTTPException:
await client.close()
return await self.bot.send_to_owners(
_("[DblTools cog]\nFailed to contact Top.gg API. Please try again later.")
)
self.dbl = client
self._ready_event.set()
示例3: createinvite
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def createinvite(self, ctx, *, guild_id: int):
guild = await self.bot.cogs["Communication"].handler("get_guild", 1, {"guild_id": guild_id})
if not guild:
await ctx.send(embed=discord.Embed(description="No such guild was found.", colour=self.bot.error_colour))
return
invite = await self.bot.cogs["Communication"].handler("invite_guild", 1, {"guild_id": guild_id})
if not invite:
await ctx.send(
embed=discord.Embed(
description="No permissions to create an invite link.", colour=self.bot.primary_colour,
)
)
else:
await ctx.send(
embed=discord.Embed(
description=f"Here is the invite link: https://discord.gg/{invite[0]['code']}",
colour=self.bot.primary_colour,
)
)
示例4: _bot
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def _bot(ctx):
'''Shows info about bot'''
em = discord.Embed(color=discord.Color.green())
em.title = 'Bot Info'
em.set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url)
try:
em.description = bot.psa + '\n[Support Server](https://discord.gg/RzsYQ9f)'
except AttributeError:
em.description = 'A multipurpose bot made by SharpBit, Victini, AntonyJoseph03, Free TNT and Sleedyak.\n[Support Server](https://discord.gg/RzsYQ9f)'
em.add_field(name="Servers", value=len(bot.guilds))
em.add_field(name="Online Users", value=str(len({m.id for m in bot.get_all_members() if m.status is not discord.Status.offline})))
em.add_field(name='Total Users', value=len(bot.users))
em.add_field(name='Channels', value=f"{sum(1 for g in bot.guilds for _ in g.channels)}")
em.add_field(name="Library", value=f"discord.py")
em.add_field(name="Bot Latency", value=f"{bot.ws.latency * 1000:.0f} ms")
em.add_field(name="Invite", value=f"[Click Here](https://discordapp.com/oauth2/authorize?client_id={bot.user.id}&scope=bot&permissions=268905542)")
em.add_field(name='GitHub', value='[Click here](https://github.com/cree-py/RemixBot)')
em.add_field(name="Upvote this bot!", value=f"[Click here](https://discordbots.org/bot/{bot.user.id}) :reminder_ribbon:")
em.set_footer(text="RemixBot | Powered by discord.py")
await ctx.send(embed=em)
示例5: prepare_embed
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def prepare_embed(self, entries, page, *, first=False):
self.embed.clear_fields()
self.embed.description = self.description
self.embed.title = self.title
invite_code = self.bot.config['support_server'].get('invite_code')
if self.is_bot and invite_code:
invite = f'https://discord.gg/{invite_code}'
value = _('For more help, join the official bot support server: {invite}').format(**locals())
self.embed.add_field(name=_('Support'), value=value, inline=False)
self.embed.set_footer(
text=_('Use "{self.prefix}help command" for more info on a command.').format(**locals()))
for entry in entries:
signature = f'{entry.qualified_name} {entry.signature}'
self.embed.add_field(name=signature, value=entry.short_doc or _('No help given'), inline=False)
if self.maximum_pages:
self.embed.set_footer(
text=_('Page {page}⁄{self.maximum_pages} ({self.total} commands)').format(**locals()))
示例6: partners
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def partners(self, ctx):
e = discord.Embed(colour=COLOR)
e.set_author(name="Our partners", icon_url=self.bot.user.avatar_url)
e.add_field(name="EMIYA - Unlimited Lewd Works Server",
value="A place where we discuss anime related stuff, vidya, events, lewds and karaoke. "
"[Discord server](https://discord.gg/2Jd5Tu4) | "
"[Facebook page](https://www.facebook.com/xEmiyaShirou)")
e.add_field(name="Rap Town - Your #1 source for the best rap music!",
value="For the best rap music on YouTube check out Rap Town! "
"[YouTube channel](https://www.youtube.com/c/raptown) | "
"[Music Discord server](https://discord.gg/thetown)")
e.add_field(name="Scorchy - Himebot's artist!",
value="Scorchy is the artist for Hime's avatar, "
"you could check out some of his work on his [Twitter](https://twitter.com/AyyScorchy)")
await ctx.send(embed=e)
示例7: process_command_invoke_error
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def process_command_invoke_error(self, ctx: context.NabCtx, error: commands.CommandInvokeError):
"""Handles CommandInvokeError.
This exception is raised when an exception is raised during command execution."""
error_name = error.original.__class__.__name__
if isinstance(error.original, errors.NetworkError):
log.error(f"{error_name} in command {ctx.clean_prefix}{ctx.command.qualified_name}: {error.original}")
return await ctx.error("I'm having network issues right now. Please try again in a moment.")
log.error(f"{self.tag} Exception in command: {ctx.message.clean_content}", exc_info=error.original)
if isinstance(error.original, discord.HTTPException):
await ctx.error("Sorry, the message was too long to send.")
else:
if ctx.bot_permissions.embed_links:
embed = discord.Embed(colour=discord.Colour(0xff1414))
embed.set_author(name="Support Server", url="https://discord.gg/NmDvhpY",
icon_url=self.bot.user.avatar_url)
embed.set_footer(text="Please report this bug in the support server.")
embed.add_field(name=f"{ctx.tick(False)}Command Error",
value=f"```py\n{error_name}: {error.original}```",
inline=False)
await ctx.send(embed=embed)
else:
await ctx.error(f'Command error:\n```py\n{error_name}: {error.original}```')
示例8: handle_help
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def handle_help(message: discord.Message, server_settings: ServerSettings):
prefix = server_settings.prefix
embed = discord.Embed(title="All Commands", url="https://discord.gg/HD7x2vx",
description="For more help click on this above me to get to my Discord Support Server",
color=0x27fcfc)
embed.set_author(name="Help | Rules Bot")
embed.add_field(name="Prefix", value=prefix, inline=False)
embed.add_field(name="Change Prefix", value=prefix + "pchange [new prefix]")
embed.add_field(name="Help Message", value=prefix + "help", inline=False)
embed.add_field(name="Setup the Rules", value=prefix + "setup", inline=False)
embed.add_field(name="Reaction under a message to get roles", value=prefix+"setupreaction", inline=False)
embed.add_field(name="Edit the Rules", value=prefix + "editmessage", inline=False)
embed.add_field(name="Restore the rules if you delete them", value=prefix + "restore", inline=False)
embed.add_field(name="All supporters", value=prefix + "supporter", inline=True)
embed.add_field(name="Invite the Bot", value=prefix + "invite", inline=False)
embed.add_field(name="Bot info", value=prefix + "info", inline=False)
embed.add_field(name="Get all roles + id", value=prefix + "roles", inline=False)
embed.add_field(name="Server settings", value=prefix + "data guild", inline=False)
embed.add_field(name="premium info", value=prefix + "premium", inline=False)
embed.add_field(name="create a ticket", value=prefix + "create_ticket [ticket]", inline=False)
embed.set_footer(text="Bot by BaseChip | TheBotDev Project")
await message.channel.send(embed=embed)
示例9: about
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def about(self, ctx):
embed = discord.Embed(
color=discord.Color.blurple(),
title="About Roombot",
description='\n'.join([
":shield: Serving {} servers".format(len(self.bot.guilds)),
":robot: [Server](https://discord.gg/37kzrpr) Join my support server!",
":cat: [GitHub](https://github.com/Milotrince/discord-roombot) Help improve me!",
":mailbox: [Invite Link](https://discord.com/api/oauth2/authorize?client_id=592816310656696341&permissions=285224016&scope=bot) Invite me to another server!",
":woman: [Profile](https://github.com/Milotrince) Contact my creator @Milotrince#0001",
":heart: [Ko-fi](https://ko-fi.com/milotrince) Donate :coffee:!",
":purple_heart: RoomBot was made for Discord Hack Week"])
).set_thumbnail(
url="https://raw.githubusercontent.com/Milotrince/discord-roombot/master/assets/icon.png"
)
return await ctx.send(embed=embed)
示例10: _help_all
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def _help_all(self, ctx):
"""Gets the help message for all commands."""
info = discord.Embed(title='Dozer: Info', description='A guild management bot for FIRST Discord servers',
color=discord.Color.blue())
info.set_thumbnail(url=self.bot.user.avatar_url)
info.add_field(name='About',
value="Dozer: A collaborative bot for FIRST Discord servers, developed by the FRC Discord Server Development Team")
info.add_field(name='About `{}{}`'.format(ctx.prefix, ctx.invoked_with), value=inspect.cleandoc("""
This command can show info for all commands, a specific command, or a category of commands.
Use `{0}{1} {1}` for more information.
""".format(ctx.prefix, ctx.invoked_with)), inline=False)
info.add_field(name='Support',
value="Join our development server at https://discord.gg/bB8tcQ8 for support, to help with development, or if "
"you have any questions or comments!")
info.add_field(name="Open Source",
value="Dozer is open source! Feel free to view and contribute to our Python code "
"[on Github](https://github.com/FRCDiscord/Dozer)")
info.set_footer(text='Dozer Help | all commands | Info page')
await self._show_help(ctx, info, 'Dozer: Commands', '', 'all commands', ctx.bot.commands)
示例11: updates
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def updates(self, ctx):
emb1 = discord.Embed(
description="**Please join the Poll Bot server and see #announcements to see the latest updates! <https://discord.gg/FhT6nUn>**"
)
await ctx.message.channel.send(embed=emb1)
示例12: botinfo
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def botinfo(ctx, **_):
"""
[CMD_KEY]botinfo
General information about DueUtil.
"""
info_embed = discord.Embed(title="DueUtil's Information", type="rich", color=gconf.DUE_COLOUR)
info_embed.description = "DueUtil is customizable bot to add fun commands, quests and battles to your server."
info_embed.add_field(name="Created by", value="[MacDue#4453](https://dueutil.tech/)")
info_embed.add_field(name="Framework",
value="[discord.py %s :two_hearts:](http://discordpy.readthedocs.io/en/latest/)"
% discord.__version__)
info_embed.add_field(name="Version", value=gconf.VERSION),
info_embed.add_field(name="Invite Due!", value="https://dueutil.tech/invite", inline=False)
info_embed.add_field(name="Support server",
value="For help with the bot or a laugh join **https://discord.gg/n4b94VA**!")
await util.say(ctx.channel, embed=info_embed)
示例13: about
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def about(self, ctx):
"""Infos about the SelfBot."""
embed = discord.Embed()
embed.set_author(name="Igneel's SelfBot", url="https://igneeldxd.github.io/Discord-SelfBot/")
embed.description = "https://igneeldxd.github.io/Discord-SelfBot/\nThis is a Selfbot written by IgneelDxD#6666\nFor support or feedback you can join my [Server](https://discord.gg/DJK8h3n)"
embed.colour = discord.Color.purple()
async with aiohttp.ClientSession() as cs:
async with cs.get("https://api.github.com/repos/IgneelDxD/Discord-SelfBot/commits") as resp:
result = json.loads(await resp.text())
form = '[``{0}``](https://github.com/IgneelDxD/Discord-SelfBot/commit/{0}) {1} ({2})'
com0 = form.format(result[0]['sha'][:7], result[0]['commit']['message'], getAgo(parser.parse(result[0]['commit']['author']['date'], ignoretz=True)))
com1 = form.format(result[1]['sha'][:7], result[1]['commit']['message'], getAgo(parser.parse(result[1]['commit']['author']['date'], ignoretz=True)))
embed.add_field(name='Latest Changes', value=f'{com0}\n{com1}')
embed.set_thumbnail(url="https://i.imgur.com/cD51k3R.png")
embed.set_footer(text='Made with discord.py | rewrite is the future!', icon_url='https://i.imgur.com/MyEXmz8.png')
await edit(ctx, embed=embed)
# User info on Server
示例14: about
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def about(self, ctx):
"""Information about the bot."""
stats = {}
statKeys = ("dice_rolled_life", "spells_looked_up_life", "monsters_looked_up_life", "commands_used_life",
"items_looked_up_life", "rounds_init_tracked_life", "turns_init_tracked_life")
for k in statKeys:
stats[k] = await Stats.get_statistic(ctx, k)
embed = discord.Embed(description='Avrae, a bot to streamline D&D 5e online.\n'
'Check out the latest release notes '
'[here](https://github.com/avrae/avrae/releases/latest).')
embed.title = "Invite Avrae to your server!"
embed.url = "https://invite.avrae.io"
embed.colour = 0x7289da
total_members = sum(1 for _ in self.bot.get_all_members())
unique_members = len(self.bot.users)
members = '%s total\n%s unique' % (total_members, unique_members)
embed.add_field(name='Members (Cluster)', value=members)
embed.add_field(name='Uptime', value=str(timedelta(seconds=round(time.monotonic() - self.start_time))))
motd = random.choice(["May the RNG be with you", "May your rolls be high",
"Will give higher rolls for cookies", ">:3",
"Does anyone even read these?"])
embed.set_footer(
text=f'{motd} | Build {await self.bot.rdb.get("build_num")} | Cluster {self.bot.cluster_id}')
commands_run = "{commands_used_life} total\n{dice_rolled_life} dice rolled\n" \
"{spells_looked_up_life} spells looked up\n{monsters_looked_up_life} monsters looked up\n" \
"{items_looked_up_life} items looked up\n" \
"{rounds_init_tracked_life} rounds of initiative tracked ({turns_init_tracked_life} turns)" \
.format(**stats)
embed.add_field(name="Commands Run", value=commands_run)
embed.add_field(name="Servers", value=f"{len(self.bot.guilds)} on this cluster\n"
f"{await Stats.get_guild_count(self.bot)} total")
memory_usage = psutil.Process().memory_full_info().uss / 1024 ** 2
embed.add_field(name='Memory Usage', value='{:.2f} MiB'.format(memory_usage))
embed.add_field(name='About', value='Made with :heart: by zhu.exe#4211 and the D&D Beyond team\n'
'Join the official development server [here](https://discord.gg/pQbd4s6)!',
inline=False)
await ctx.send(embed=embed)
示例15: feedback
# 需要导入模块: import discord [as 别名]
# 或者: from discord import gg [as 别名]
def feedback(self, ctx, *, feedback):
"""Give me some feedback on the bot"""
await ctx.send(await _(ctx, "This command is deprecated. If you need help or want to provide feedback, please"
" ask in our support server https://discord.gg/UYJb8fQ"))