mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 06:40:35 +01:00
Améliore la gestion des commandes Discord et l'interface web
This commit is contained in:
@@ -72,14 +72,16 @@ bot = DiscordBot(intents=intents)
|
||||
async def on_message(message: Message):
|
||||
if message.author == bot.user:
|
||||
return
|
||||
commandes = Commande.query.filter_by(discord_enable=True).all()
|
||||
for commande in commandes:
|
||||
if message.content.find(commande.trigger) == 0:
|
||||
try:
|
||||
await message.channel.send(commande.response, suppress_embeds=True)
|
||||
return
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
if not message.content.startswith('!'):
|
||||
return
|
||||
command_name = message.content.split()[0]
|
||||
commande = Commande.query.filter_by(discord_enable=True, trigger=command_name).first()
|
||||
if commande:
|
||||
try:
|
||||
await message.channel.send(commande.response, suppress_embeds=True)
|
||||
return
|
||||
except Exception as e:
|
||||
logging.error(e)
|
||||
|
||||
if(ConfigurationHelper().getValue('proton_db_enable_enable') and message.content.find('!protondb')==0) :
|
||||
if (message.content.find('<@')>0) :
|
||||
|
||||
@@ -12,8 +12,8 @@ def commandes():
|
||||
def add_commande():
|
||||
trigger = request.form.get('trigger')
|
||||
response = request.form.get('response')
|
||||
discord_enable = request.form.get('discord_enable') == 'on'
|
||||
twitch_enable = request.form.get('twitch_enable') == 'on'
|
||||
discord_enable = request.form.get('discord_enable') != None
|
||||
twitch_enable = request.form.get('twitch_enable') != None
|
||||
|
||||
if trigger and response:
|
||||
if not trigger.startswith('!'):
|
||||
|
||||
@@ -2,11 +2,12 @@ header nav img {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.table_td {
|
||||
table th,
|
||||
table td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: normal;
|
||||
max-width: 250px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,29 +6,29 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table_td">Commande</th>
|
||||
<th class="table_td">Réponse</th>
|
||||
<th class="table_td">Discord</th>
|
||||
<th class="table_td">Twitch</th>
|
||||
<th class="table_td">Actions</th>
|
||||
<th>Commande</th>
|
||||
<th>Réponse</th>
|
||||
<th>Discord</th>
|
||||
<th>Twitch</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for commande in commandes %}
|
||||
<tr>
|
||||
<td class="table_td">{{ commande.trigger }}</td>
|
||||
<td class="table_td">{{ commande.response }}</td>
|
||||
<td class="table_td">
|
||||
<td>{{ commande.trigger }}</td>
|
||||
<td>{{ commande.response }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('toggle_discord_commande', commande_id = commande.id) }}" style="text-decoration: none; font-size: 1.2em;">
|
||||
{{ '✅' if commande.discord_enable else '❌' }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="table_td">
|
||||
<td>
|
||||
<a href="{{ url_for('toggle_twitch_commande', commande_id = commande.id) }}" style="text-decoration: none; font-size: 1.2em;">
|
||||
{{ '✅' if commande.twitch_enable else '❌' }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="table_td">
|
||||
<td>
|
||||
<a href="{{ url_for('delete_commande', commande_id = commande.id) }}" onclick="return confirm('Êtes-vous sûr de vouloir supprimer cette commande ?')">Supprimer</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user