-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c938c4d
commit 177c0a8
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import discord | ||
from discord.ext import commands | ||
|
||
from mgylabs.i18n import __ | ||
from mgylabs.utils.config import VERSION, is_development_mode | ||
|
||
from .utils.feature import Feature | ||
from .utils.MGCert import Level, MGCertificate | ||
|
||
if is_development_mode(False) or VERSION.is_canary(): | ||
enabled = True | ||
else: | ||
enabled = False | ||
|
||
|
||
@commands.hybrid_command(hidden=True, enabled=enabled, with_app_command=enabled) | ||
@MGCertificate.verify(level=Level.TRUSTED_USERS) | ||
@Feature.Experiment() | ||
async def act(ctx: commands.Context, member: discord.Member, *, message): | ||
webhooks = await ctx.channel.webhooks() | ||
|
||
if webhooks: | ||
webhook = webhooks[0] | ||
else: | ||
webhook = await ctx.channel.create_webhook(name=member.name) | ||
|
||
await webhook.send( | ||
str(message), username=member.display_name, avatar_url=member.avatar.url | ||
) | ||
|
||
if ctx.interaction: | ||
await ctx.send( | ||
__("[MK Bot]({url}) acted like {member}.").format( | ||
url="<https://github.com/mgylabs/mkbot>", member=member.mention | ||
), | ||
ephemeral=True, | ||
) | ||
|
||
|
||
async def setup(bot: commands.Bot): | ||
bot.add_command(act) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters