-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
72 additions
and
5 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import configuration | ||
from . import install | ||
from . import admin | ||
from . import admin | ||
from . import users |
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,44 @@ | ||
from __main__ import bot, slash | ||
import views | ||
import database | ||
|
||
import discord | ||
from discord import app_commands | ||
|
||
|
||
|
||
|
||
@app_commands.guild_only() | ||
class Users(app_commands.Group): | ||
|
||
@app_commands.command(name="set_username", description="Set user usernames") | ||
async def _setUsername( | ||
self, interaction: discord.Interaction, | ||
user: discord.Member, username: str, app: str = 'global' | ||
) -> None: | ||
await interaction.response.defer(ephemeral=True) | ||
|
||
database.saveCredentials(user.id, app, username) | ||
|
||
await interaction.followup.send( | ||
content="Successfully updated %s username for %s!" % (user.mention, app), | ||
ephemeral=True | ||
) | ||
|
||
@app_commands.command(name="set_infos", description="Set user infos") | ||
async def _setInfos( | ||
self, interaction: discord.Interaction, | ||
user: discord.Member, firstName: str|None, lastName: str|None, | ||
email: str|None, phoneNumber: str|None, | ||
) -> None: | ||
await interaction.response.defer(ephemeral=True) | ||
|
||
database.saveInfos(user.id, firstName, lastName, email, phoneNumber) | ||
|
||
await interaction.followup.send( | ||
content="Successfully updated %s infos!" % (user.mention), | ||
ephemeral=True | ||
) | ||
|
||
|
||
slash.add_command(Users(name="users", description="Manage users")) |