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):
|
async def on_message(message: Message):
|
||||||
if message.author == bot.user:
|
if message.author == bot.user:
|
||||||
return
|
return
|
||||||
commandes = Commande.query.filter_by(discord_enable=True).all()
|
if not message.content.startswith('!'):
|
||||||
for commande in commandes:
|
return
|
||||||
if message.content.find(commande.trigger) == 0:
|
command_name = message.content.split()[0]
|
||||||
try:
|
commande = Commande.query.filter_by(discord_enable=True, trigger=command_name).first()
|
||||||
await message.channel.send(commande.response, suppress_embeds=True)
|
if commande:
|
||||||
return
|
try:
|
||||||
except Exception as e:
|
await message.channel.send(commande.response, suppress_embeds=True)
|
||||||
logging.error(e)
|
return
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(e)
|
||||||
|
|
||||||
if(ConfigurationHelper().getValue('proton_db_enable_enable') and message.content.find('!protondb')==0) :
|
if(ConfigurationHelper().getValue('proton_db_enable_enable') and message.content.find('!protondb')==0) :
|
||||||
if (message.content.find('<@')>0) :
|
if (message.content.find('<@')>0) :
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ def commandes():
|
|||||||
def add_commande():
|
def add_commande():
|
||||||
trigger = request.form.get('trigger')
|
trigger = request.form.get('trigger')
|
||||||
response = request.form.get('response')
|
response = request.form.get('response')
|
||||||
discord_enable = request.form.get('discord_enable') == 'on'
|
discord_enable = request.form.get('discord_enable') != None
|
||||||
twitch_enable = request.form.get('twitch_enable') == 'on'
|
twitch_enable = request.form.get('twitch_enable') != None
|
||||||
|
|
||||||
if trigger and response:
|
if trigger and response:
|
||||||
if not trigger.startswith('!'):
|
if not trigger.startswith('!'):
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ header nav img {
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.table_td {
|
table th,
|
||||||
|
table td {
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
max-width: 250px;
|
max-width: 250px;
|
||||||
text-align: left;
|
}
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,29 +6,29 @@
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="table_td">Commande</th>
|
<th>Commande</th>
|
||||||
<th class="table_td">Réponse</th>
|
<th>Réponse</th>
|
||||||
<th class="table_td">Discord</th>
|
<th>Discord</th>
|
||||||
<th class="table_td">Twitch</th>
|
<th>Twitch</th>
|
||||||
<th class="table_td">Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for commande in commandes %}
|
{% for commande in commandes %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="table_td">{{ commande.trigger }}</td>
|
<td>{{ commande.trigger }}</td>
|
||||||
<td class="table_td">{{ commande.response }}</td>
|
<td>{{ commande.response }}</td>
|
||||||
<td class="table_td">
|
<td>
|
||||||
<a href="{{ url_for('toggle_discord_commande', commande_id = commande.id) }}" style="text-decoration: none; font-size: 1.2em;">
|
<a href="{{ url_for('toggle_discord_commande', commande_id = commande.id) }}" style="text-decoration: none; font-size: 1.2em;">
|
||||||
{{ '✅' if commande.discord_enable else '❌' }}
|
{{ '✅' if commande.discord_enable else '❌' }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</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;">
|
<a href="{{ url_for('toggle_twitch_commande', commande_id = commande.id) }}" style="text-decoration: none; font-size: 1.2em;">
|
||||||
{{ '✅' if commande.twitch_enable else '❌' }}
|
{{ '✅' if commande.twitch_enable else '❌' }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user