Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
S
SMAW
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
bakaclub
SMAW
Validations
b7230533
Valider
b7230533
rédigé
Il y a 4 ans
par
Deurstann
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Added birthday feature : show me a/an/more DAY MONTH
parent
cc76f166
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!2
Feature : Birthday
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
launch.py
+36
-2
36 ajouts, 2 suppressions
launch.py
avec
36 ajouts
et
2 suppressions
launch.py
+
36
−
2
Voir le fichier @
b7230533
...
@@ -5,6 +5,8 @@ import random
...
@@ -5,6 +5,8 @@ import random
import
re
import
re
import
csv
import
csv
import
aiohttp
import
aiohttp
import
requests
import
datetime
from
dotenv
import
load_dotenv
from
dotenv
import
load_dotenv
...
@@ -14,6 +16,7 @@ TOKEN = os.getenv('DISCORD_TOKEN')
...
@@ -14,6 +16,7 @@ TOKEN = os.getenv('DISCORD_TOKEN')
SECRET
=
os
.
getenv
(
'
REDDIT_SECRET
'
)
SECRET
=
os
.
getenv
(
'
REDDIT_SECRET
'
)
REDDIT_ID
=
os
.
getenv
(
'
REDDIT_ID
'
)
REDDIT_ID
=
os
.
getenv
(
'
REDDIT_ID
'
)
REDDIT_AGENT
=
os
.
getenv
(
'
REDDIT_AGENT
'
)
REDDIT_AGENT
=
os
.
getenv
(
'
REDDIT_AGENT
'
)
HTTP_USER_AGENT
=
os
.
getenv
(
'
HTTP_USER_AGENT
'
)
PROXY
=
os
.
getenv
(
'
PROXY
'
)
PROXY
=
os
.
getenv
(
'
PROXY
'
)
postLimit
=
int
(
os
.
getenv
(
'
POST_LIMIT
'
))
postLimit
=
int
(
os
.
getenv
(
'
POST_LIMIT
'
))
...
@@ -79,6 +82,29 @@ def create_embed(post,author,posturl):
...
@@ -79,6 +82,29 @@ def create_embed(post,author,posturl):
def
send_waifu
(
post
,
author
,
posturl
):
def
send_waifu
(
post
,
author
,
posturl
):
return
'
https://www.reddit.com
'
+
str
(
posturl
)
+
'
[
'
+
str
(
author
)
+
'
]
'
return
'
https://www.reddit.com
'
+
str
(
posturl
)
+
'
[
'
+
str
(
author
)
+
'
]
'
def
verify_date
(
day
,
month
):
try
:
datetime
.
datetime
.
strptime
(
day
+
"
-
"
+
month
,
"
%d-%m
"
)
except
ValueError
:
return
False
return
True
def
create_embed_birthday
(
day
,
month
):
embed
=
discord
.
Embed
(
color
=
discord
.
Colour
.
blue
()
)
if
month
[
0
]
==
'
0
'
:
month
=
month
[
1
]
if
day
[
0
]
==
'
0
'
:
day
=
day
[
1
]
url
=
"
http://www.animecharactersdatabase.com/api_series_characters.php?month=
"
+
month
+
"
&day=
"
+
day
request
=
requests
.
get
(
url
,
headers
=
{
"
User-Agent
"
:
HTTP_USER_AGENT
})
request_json
=
request
.
json
()
characters
=
request_json
[
"
characters
"
]
selected_character
=
characters
[
random
.
randint
(
0
,
len
(
characters
))]
embed
.
set_image
(
url
=
selected_character
[
"
character_image
"
])
embed
.
description
=
selected_character
[
"
name
"
]
return
embed
refresh_all_posts
()
refresh_all_posts
()
if
PROXY
!=
""
:
if
PROXY
!=
""
:
...
@@ -96,12 +122,20 @@ async def on_message(message):
...
@@ -96,12 +122,20 @@ async def on_message(message):
return
return
lower
=
message
.
content
.
lower
()
lower
=
message
.
content
.
lower
()
if
lower
==
"
show me an help
"
or
lower
==
"
show me a help
"
:
if
lower
==
"
show me an help
"
or
lower
==
"
show me a help
"
:
mess
=
"
Usage : ``show me a xxxx`` or ``show me an xxxx`` or ``show me more xxxx``
\n
Currently, I can show :```
"
mess
=
"
Usage : ``show me a xxxx`` or ``show me an xxxx`` or ``show me more xxxx``
or ``show me a/an/more bd DAY MONTH``
\n
Currently, I can show :```
"
for
entry
in
subreddits
.
values
():
for
entry
in
subreddits
.
values
():
mess
+=
entry
.
name
+
"
with a picture from r/
"
+
entry
.
subName
+
"
\n
"
mess
+=
entry
.
name
+
"
with a picture from r/
"
+
entry
.
subName
+
"
\n
"
mess
+=
"
\n
```
"
mess
+=
"
\n
```
"
await
message
.
channel
.
send
(
mess
)
await
message
.
channel
.
send
(
mess
)
if
(
"
show me a
"
in
lower
)
or
(
"
show me more
"
in
lower
):
if
(
"
show me a
"
in
lower
)
or
(
"
show me more
"
in
lower
):
birthday
=
re
.
search
(
r
"
show me (an?|more) bd ([0-9]+) ([0-9]+)
"
,
lower
)
if
birthday
!=
None
:
day
=
birthday
.
group
(
2
)
month
=
birthday
.
group
(
3
)
print
(
'
asking for birthday :
'
+
day
+
"
/
"
+
month
)
if
(
not
verify_date
(
day
,
month
)):
return
await
message
.
channel
.
send
(
embed
=
create_embed_birthday
(
day
,
month
))
name
=
re
.
search
(
r
"
show me (an?|more) ([\S]+)s?
"
,
lower
)
name
=
re
.
search
(
r
"
show me (an?|more) ([\S]+)s?
"
,
lower
)
if
name
==
None
:
if
name
==
None
:
return
return
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter