(meta): Send message on guild join.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
|
# flake8: noqa
|
||||||
from .module import module
|
from .module import module
|
||||||
|
|
||||||
from . import help
|
from . import help
|
||||||
from . import links
|
from . import links
|
||||||
from . import nerd
|
from . import nerd
|
||||||
|
from . import join_message
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from utils import interactive, ctx_addons # noqa
|
|||||||
from wards import is_guild_admin
|
from wards import is_guild_admin
|
||||||
|
|
||||||
from .module import module
|
from .module import module
|
||||||
|
from .lib import guide_link
|
||||||
|
|
||||||
|
|
||||||
# Set the command groups to appear in the help
|
# Set the command groups to appear in the help
|
||||||
@@ -46,9 +47,9 @@ header = """
|
|||||||
[StudyLion](https://bot.studylions.com/) is a fully featured study assistant \
|
[StudyLion](https://bot.studylions.com/) is a fully featured study assistant \
|
||||||
that tracks your study time and offers productivity tools \
|
that tracks your study time and offers productivity tools \
|
||||||
such as to-do lists, task reminders, private study rooms, group accountability sessions, and much much more.\n
|
such as to-do lists, task reminders, private study rooms, group accountability sessions, and much much more.\n
|
||||||
Use `{ctx.best_prefix}help <command>` (e.g. `{ctx.best_prefix}help send`) to learn how to use each command, \
|
Use `{{ctx.best_prefix}}help <command>` (e.g. `{{ctx.best_prefix}}help send`) to learn how to use each command, \
|
||||||
or [click here](https://discord.studylions.com/tutorial) for a comprehensive tutorial.
|
or [click here]({guide_link}) for a comprehensive tutorial.
|
||||||
"""
|
""".format(guide_link=guide_link)
|
||||||
|
|
||||||
|
|
||||||
@module.cmd("help",
|
@module.cmd("help",
|
||||||
|
|||||||
46
bot/modules/meta/join_message.py
Normal file
46
bot/modules/meta/join_message.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import discord
|
||||||
|
|
||||||
|
from cmdClient import cmdClient
|
||||||
|
|
||||||
|
from meta import client, conf
|
||||||
|
from .lib import guide_link, animation_link
|
||||||
|
|
||||||
|
|
||||||
|
message = """
|
||||||
|
Thank you for inviting me to your community.
|
||||||
|
Get started by typing `{prefix}help` to see my commands, and `{prefix}config info` \
|
||||||
|
to read about my configuration options!
|
||||||
|
|
||||||
|
To learn how to configure me and use all of my features, \
|
||||||
|
make sure to [click here]({guide_link}) to read our full setup guide.
|
||||||
|
|
||||||
|
Remember, if you need any help configuring me, \
|
||||||
|
want to suggest a feature, report a bug and stay updated, \
|
||||||
|
make sure to join our main support and study server by [clicking here]({support_link}).
|
||||||
|
|
||||||
|
Best of luck with your studies!
|
||||||
|
|
||||||
|
""".format(
|
||||||
|
guide_link=guide_link,
|
||||||
|
support_link=conf.bot.get('support_link'),
|
||||||
|
prefix=client.prefix
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@client.add_after_event('guild_join', priority=0)
|
||||||
|
async def post_join_message(client: cmdClient, guild: discord.Guild):
|
||||||
|
if (channel := guild.system_channel) and channel.permissions_for(guild.me).embed_links:
|
||||||
|
embed = discord.Embed(
|
||||||
|
description=message
|
||||||
|
)
|
||||||
|
embed.set_author(
|
||||||
|
name="Hello! My name is Leo",
|
||||||
|
icon_url="https://cdn.discordapp.com/emojis/933610591459872868.webp"
|
||||||
|
)
|
||||||
|
embed.set_image(url=animation_link)
|
||||||
|
try:
|
||||||
|
await channel.send(embed=embed)
|
||||||
|
except discord.HTTPException:
|
||||||
|
# Something went wrong sending the hi message
|
||||||
|
# Not much we can do about this
|
||||||
|
pass
|
||||||
5
bot/modules/meta/lib.py
Normal file
5
bot/modules/meta/lib.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
guide_link = "https://discord.studylions.com/tutorial"
|
||||||
|
|
||||||
|
animation_link = (
|
||||||
|
"https://media.discordapp.net/attachments/879412267731542047/926837189814419486/ezgif.com-resize.gif"
|
||||||
|
)
|
||||||
@@ -5,6 +5,7 @@ from meta import conf
|
|||||||
from LionContext import LionContext as Context
|
from LionContext import LionContext as Context
|
||||||
|
|
||||||
from .module import module
|
from .module import module
|
||||||
|
from .lib import guide_link
|
||||||
|
|
||||||
|
|
||||||
@module.cmd(
|
@module.cmd(
|
||||||
@@ -38,7 +39,7 @@ async def cmd_invite(ctx: Context):
|
|||||||
"""
|
"""
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
colour=discord.Colour.orange(),
|
colour=discord.Colour.orange(),
|
||||||
description=f"Click here] to add me to your server: {conf.bot.get('invite_link')}"
|
description=f"Click here to add me to your server: {conf.bot.get('invite_link')}"
|
||||||
)
|
)
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Setup tips",
|
name="Setup tips",
|
||||||
@@ -50,7 +51,7 @@ async def cmd_invite(ctx: Context):
|
|||||||
).format(
|
).format(
|
||||||
prefix=ctx.best_prefix,
|
prefix=ctx.best_prefix,
|
||||||
support=conf.bot.get('support_link'),
|
support=conf.bot.get('support_link'),
|
||||||
guide="https://discord.studylions.com/tutorial"
|
guide=guide_link
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
await ctx.reply(embed=embed)
|
await ctx.reply(embed=embed)
|
||||||
|
|||||||
Reference in New Issue
Block a user