Skip to content

Commit

Permalink
feat(slash): convert set-xp cmd to slash
Browse files Browse the repository at this point in the history
  • Loading branch information
ZRunner committed Jan 20, 2024
1 parent 9928158 commit bc66ad9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
11 changes: 9 additions & 2 deletions fcts/xp.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,16 +992,23 @@ async def top(self, ctx: MyContext, page: Optional[commands.Range[int, 1]]=1, sc
await view.disable(msg)


@commands.command(name='set-xp', aliases=["setxp"])
@commands.hybrid_command(name='set-xp')
@app_commands.default_permissions(administrator=True)
@app_commands.describe(
user="The user to set the XP of",
xp="The new XP value. Set to 0 to remove the user from the leaderboard",
)
@commands.guild_only()
@commands.cooldown(3, 15, commands.BucketType.user)
@commands.check(checks.has_admin)
async def set_xp(self, ctx: MyContext, user: discord.User, xp: commands.Range[int, 0, 10**15]):
"""Set the XP of a user
..Example set_xp 3000 @someone"""
..Example set_xp @someone 3000"""
if user.bot:
await ctx.send(await self.bot._(ctx.guild.id, "xp.no-bot"))
return
await ctx.defer()
xp_used_type: str = await self.bot.get_config(ctx.guild.id, "xp_type")
if xp_used_type == "global":
await ctx.send(await self.bot._(ctx.guild.id, "xp.change-global-xp"))
Expand Down
8 changes: 7 additions & 1 deletion lang/commands/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"rss set-mentions": "set-mentions",
"rss set-text": "set-text",
"rss test": "test",
"set-xp": "set-xp",
"slowmode": "slowmode",
"softban": "softban",
"stats": "stats",
Expand Down Expand Up @@ -136,7 +137,8 @@
"cases remove": "Permanently delete a moderation case",
"cases search": "Find the details of a moderation case",
"membercount": "Get some stats about your server members",
"random-tip": "Get a random tip or trivia about the bot"
"random-tip": "Get a random tip or trivia about the bot",
"set-xp": "Set the XP of a user in your server"
},
"group_description": {
"antiscam": "Everything related to the antiscam feature",
Expand Down Expand Up @@ -336,6 +338,10 @@
"rss test": {
"feed": "feed"
},
"set-xp": {
"user": "user",
"xp": "xp"
},
"modlogs list": {
"channel": "channel"
},
Expand Down
6 changes: 6 additions & 0 deletions lang/commands/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"rss set-mentions": "modifier-mentions",
"rss set-text": "modifier-texte",
"rss test": "test",
"set-xp": "modifier-xp",
"slowmode": "mode-lent",
"stats": "stats",
"tickets portal set-category": "modifier-catégorie",
Expand Down Expand Up @@ -134,6 +135,7 @@
"clear": "Supprime des messages du salon",
"membercount": "Donne quelques stats sur les membres du serveur",
"random-tip": "Affiche une astuce aléatoire à propos du bot",
"set-xp": "Modifie l'XP d'un utilisateur dans le serveur",
"slowmode": "Ralenti le spam du salon en activant le mode lent"
},
"group_description": {
Expand Down Expand Up @@ -334,6 +336,10 @@
"rss test": {
"feed": "flux"
},
"set-xp": {
"user": "utilisateur",
"xp": "xp"
},
"modlogs list": {
"channel": "salon"
},
Expand Down

0 comments on commit bc66ad9

Please sign in to comment.