瀏覽代碼

Merge pull request #14 from denismerigoux/multi-seum

Allow multi-seum from Telegram bot
Denis Merigoux 5 年之前
父節點
當前提交
8a6406c5b4

+ 1 - 0
.gitignore

@@ -67,3 +67,4 @@ target/
67 67
 python3/
68 68
 seum/settings.py
69 69
 seum.json
70
+environment.yaml

+ 4 - 0
bot/models.py

@@ -13,6 +13,7 @@ class TelegramUser(models.Model):
13 13
     telegram_user_id = models.BigIntegerField(_('telegram_user_id'), unique=True)
14 14
 
15 15
     class Meta:
16
+        app_label = 'bot'
16 17
         verbose_name = _('telegram_user')
17 18
         verbose_name_plural = _('telegram_users')
18 19
 
@@ -30,6 +31,7 @@ class TelegramUserCheck(models.Model):
30 31
     verif_key = models.TextField(_('verify_key'), unique=True)
31 32
 
32 33
     class Meta:
34
+        app_label = 'bot'
33 35
         verbose_name = _('telegram_user_check')
34 36
         verbose_name_plural = _('telegram_user_checks')
35 37
 
@@ -42,6 +44,7 @@ class TelegramUserChat(models.Model):
42 44
     telegram_chat_id = models.BigIntegerField(_('telegram_chat_id'))
43 45
 
44 46
     class Meta:
47
+        app_label = 'bot'
45 48
         verbose_name = _('telegram_user_chat')
46 49
         verbose_name_plural = _('telegram_user_chats')
47 50
         unique_together = ('telegram_user_id', 'telegram_chat_id')
@@ -58,6 +61,7 @@ class TelegramChat(models.Model):
58 61
     notify_only_members = models.BooleanField(_('notify_only_members'))
59 62
 
60 63
     class Meta:
64
+        app_label = 'bot'
61 65
         verbose_name = _('telegram_chat')
62 66
         verbose_name_plural = _('telegram_chats')
63 67
 

+ 16 - 6
bot/views/telegram.py

@@ -153,14 +153,24 @@ def webhook(request):
153 153
             # it's a /seum cmd
154 154
             m = re.sub(seum_cmd, r"\3", text)
155 155
             maybe_counter = m.split(' ')[0]
156
-            try:
157
-                yes_counter = Counter.objects.get(trigramme=maybe_counter)
156
+            # allow multiple seums: /seum ABC+DEF Message
157
+            counters = [maybe_counter[i:i+3] for i in range(0, len(maybe_counter), 4)]
158
+            yes_counters = Counter.objects.filter(trigramme__in=counters)
159
+            seums_to_throw = []
160
+            user_counter = telegram_user.counter
161
+            if len(yes_counters):
158 162
                 seum_message = ' '.join(m.split(' ')[1:])
159
-            except Counter.DoesNotExist:
160
-                yes_counter = telegram_user.counter
161
-                seum_message = m
163
+                for counter in yes_counters:
164
+                    seums_to_throw.append((user_counter, counter, seum_message))
165
+                # for non existing trigrams, we throw the seum to the seum giver
166
+                for not_a_counter in set(counters) - set([c.trigramme for c in yes_counters]):
167
+                    seums_to_throw.append((user_counter, user_counter,
168
+                                           f"Trigramme {not_a_counter} qui n'existe pas du seum"))
169
+            else:
170
+                seums_to_throw.append((user_counter, user_counter, m))
162 171
 
163
-            perform_reset(telegram_user.counter, yes_counter, seum_message)
172
+            for (who, counter, message) in seums_to_throw:
173
+                perform_reset(who, counter, message)
164 174
     except TelegramUser.DoesNotExist:
165 175
         print('in that case we send a link to the user')
166 176
         if chat['type'] == 'private' and chat['id'] == telegram_user_id:

+ 21 - 0
counter/migrations/0009_auto_20200413_0902.py

@@ -0,0 +1,21 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.10.5 on 2020-04-13 09:02
3
+from __future__ import unicode_literals
4
+
5
+import django.core.validators
6
+from django.db import migrations, models
7
+
8
+
9
+class Migration(migrations.Migration):
10
+
11
+    dependencies = [
12
+        ('counter', '0008_auto_20170122_1732'),
13
+    ]
14
+
15
+    operations = [
16
+        migrations.AlterField(
17
+            model_name='counter',
18
+            name='trigramme',
19
+            field=models.CharField(max_length=3, validators=[django.core.validators.RegexValidator(regex='^\\S{3}$')], verbose_name='trigram'),
20
+        ),
21
+    ]

+ 10 - 1
counter/models.py

@@ -1,6 +1,7 @@
1 1
 from datetime import datetime
2 2
 
3 3
 from django.contrib.auth.models import User
4
+from django.core.validators import RegexValidator
4 5
 from django.db import models
5 6
 from django.utils.translation import ugettext_lazy as _, get_language
6 7
 
@@ -11,7 +12,11 @@ from babel.dates import format_timedelta
11 12
 class Counter(models.Model):
12 13
     name = models.CharField(_('name'), max_length=60)
13 14
     email = models.EmailField(_('email'), max_length=264, default='null@localhost')
14
-    trigramme = models.CharField(_('trigram'), max_length=3)
15
+    trigramme = models.CharField(
16
+        _('trigram'),
17
+        max_length=3,
18
+        validators=[RegexValidator(regex='^\S{3}$', message=_('Trigram must be 3 characters long.'))]
19
+    )
15 20
     user = models.ForeignKey(User, blank=True, null=True, verbose_name=_('associated user'))
16 21
     email_notifications = models.BooleanField(_('email notifications'), default=False)
17 22
     sort_by_score = models.BooleanField(_('sort by SeumScore'), default=True)
@@ -22,6 +27,10 @@ class Counter(models.Model):
22 27
     class Meta:
23 28
         verbose_name = _('counter')
24 29
 
30
+    def save(self, *args, **kwargs):
31
+        self.full_clean()
32
+        super(Counter, self).save(*args, **kwargs)
33
+
25 34
 
26 35
 class Reset(models.Model):
27 36
     timestamp = models.DateTimeField(_('datetime'), auto_now_add=True)

+ 5 - 2
counter/templates/createUser.html

@@ -31,10 +31,13 @@
31 31
                             {% trans "Email notifications" %}
32 32
                         </label>
33 33
                     </div>
34
-                    <p>{% trans "Other users will see your nickname and your trigram only, it will be your seum identity!" %}</p>
34
+                    <p>
35
+                        {% trans "Other users will see your nickname and your trigram only, it will be your seum identity!" %}
36
+                        {% trans "This trigram must be 3 characters long exactly." %}
37
+                    </p>
35 38
                     <div class="form-group">
36 39
                         <label for="id_trigramme">{% trans "Trigram" %}</label>
37
-                        <input id="id_trigramme" maxlength="3" type="text" class="form-control text-uppercase" name="trigramme" onkeyup="this.value=this.value.toUpperCase();" required />
40
+                        <input id="id_trigramme" minlength="3" maxlength="3" type="text" class="form-control text-uppercase" name="trigramme" onkeyup="this.value=this.value.toUpperCase();" required />
38 41
                     </div>
39 42
                     <div class="form-group">
40 43
                         <label for="id_nick">{% trans "Nick" %}</label>

+ 4 - 0
counter/views/user.py

@@ -18,6 +18,10 @@ def create(request):
18 18
         password2 = data['password2'][0]
19 19
         email_notifications = 'email_notifications' in data.keys()
20 20
 
21
+        if len(trigramme) != 3:
22
+            error = _("Trigram must be 3 characters long.")
23
+            return render(request, 'createUser.html', {'error': error})
24
+
21 25
         if password1 != password2:
22 26
             error = _("Passwords do not match.")
23 27
             return render(request, 'createUser.html', {'error': error})

+ 166 - 88
locale/en/LC_MESSAGES/django.po

@@ -8,7 +8,7 @@ msgid ""
8 8
 msgstr ""
9 9
 "Project-Id-Version: PACKAGE VERSION\n"
10 10
 "Report-Msgid-Bugs-To: \n"
11
-"POT-Creation-Date: 2017-01-23 15:08+0000\n"
11
+"POT-Creation-Date: 2020-04-13 09:40+0000\n"
12 12
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,174 +17,248 @@ msgstr ""
17 17
 "Content-Type: text/plain; charset=UTF-8\n"
18 18
 "Content-Transfer-Encoding: 8bit\n"
19 19
 
20
-#: counter/models.py:12
21
-msgid "name"
20
+#: bot/models.py:12 counter/models.py:28
21
+msgid "counter"
22
+msgstr ""
23
+
24
+#: bot/models.py:13 bot/models.py:30 bot/models.py:43
25
+msgid "telegram_user_id"
26
+msgstr ""
27
+
28
+#: bot/models.py:17
29
+msgid "telegram_user"
30
+msgstr ""
31
+
32
+#: bot/models.py:18
33
+msgid "telegram_users"
34
+msgstr ""
35
+
36
+#: bot/models.py:21
37
+#, python-format
38
+msgid "%(counter)s is %(telegram_user_id)d"
39
+msgstr ""
40
+
41
+#: bot/models.py:31
42
+msgid "verify_key"
43
+msgstr ""
44
+
45
+#: bot/models.py:35
46
+msgid "telegram_user_check"
47
+msgstr ""
48
+
49
+#: bot/models.py:36
50
+msgid "telegram_user_checks"
51
+msgstr ""
52
+
53
+#: bot/models.py:39
54
+#, python-format
55
+msgid "%(telegram_user_id)d has verif key %(verif_key)s"
56
+msgstr ""
57
+
58
+#: bot/models.py:44 bot/models.py:57
59
+msgid "telegram_chat_id"
60
+msgstr ""
61
+
62
+#: bot/models.py:48
63
+msgid "telegram_user_chat"
64
+msgstr ""
65
+
66
+#: bot/models.py:49
67
+msgid "telegram_user_chats"
68
+msgstr ""
69
+
70
+#: bot/models.py:53
71
+#, python-format
72
+msgid "%(telegram_user_id)d is in the chat %(telegram_chat)d"
73
+msgstr ""
74
+
75
+#: bot/models.py:61
76
+msgid "notify_only_members"
77
+msgstr ""
78
+
79
+#: bot/models.py:65
80
+msgid "telegram_chat"
81
+msgstr ""
82
+
83
+#: bot/models.py:66
84
+msgid "telegram_chats"
85
+msgstr ""
86
+
87
+#: bot/models.py:69
88
+#, python-format
89
+msgid ""
90
+"%(chat_id)d is a telegram chat, with option notify_only_members to "
91
+"%(notify_only_members)s"
22 92
 msgstr ""
23 93
 
24 94
 #: counter/models.py:13
25
-msgid "email"
95
+msgid "name"
26 96
 msgstr ""
27 97
 
28 98
 #: counter/models.py:14
99
+msgid "email"
100
+msgstr ""
101
+
102
+#: counter/models.py:16
29 103
 msgid "trigram"
30 104
 msgstr ""
31 105
 
32
-#: counter/models.py:15
106
+#: counter/models.py:18 counter/views/user.py:22
107
+msgid "Trigram must be 3 characters long."
108
+msgstr ""
109
+
110
+#: counter/models.py:20
33 111
 msgid "associated user"
34 112
 msgstr ""
35 113
 
36
-#: counter/models.py:16
114
+#: counter/models.py:21
37 115
 msgid "email notifications"
38 116
 msgstr ""
39 117
 
40
-#: counter/models.py:17
118
+#: counter/models.py:22
41 119
 msgid "sort by SeumScore"
42 120
 msgstr ""
43 121
 
44
-#: counter/models.py:20
122
+#: counter/models.py:25
45 123
 #, python-format
46 124
 msgid "%(trigram)s (%(name)s)"
47 125
 msgstr ""
48 126
 
49
-#: counter/models.py:23
50
-msgid "counter"
51
-msgstr ""
52
-
53
-#: counter/models.py:27 counter/models.py:55
127
+#: counter/models.py:36 counter/models.py:64
54 128
 msgid "datetime"
55 129
 msgstr ""
56 130
 
57
-#: counter/models.py:28
131
+#: counter/models.py:37
58 132
 msgid "reason"
59 133
 msgstr ""
60 134
 
61
-#: counter/models.py:29
135
+#: counter/models.py:38
62 136
 msgid "victim"
63 137
 msgstr ""
64 138
 
65
-#: counter/models.py:30
139
+#: counter/models.py:39
66 140
 msgid "seum giver"
67 141
 msgstr ""
68 142
 
69
-#: counter/models.py:34
143
+#: counter/models.py:43
70 144
 #, python-format
71 145
 msgid "%(counter)s: %(datetime)s (%(reason)s)"
72 146
 msgstr ""
73 147
 
74
-#: counter/models.py:48 counter/models.py:79
148
+#: counter/models.py:57 counter/models.py:88
75 149
 msgid "reset"
76 150
 msgstr ""
77 151
 
78
-#: counter/models.py:49
152
+#: counter/models.py:58
79 153
 msgid "resets"
80 154
 msgstr ""
81 155
 
82
-#: counter/models.py:53
156
+#: counter/models.py:62
83 157
 msgid "liker"
84 158
 msgstr ""
85 159
 
86
-#: counter/models.py:54
160
+#: counter/models.py:63
87 161
 msgid "seum"
88 162
 msgstr ""
89 163
 
90
-#: counter/models.py:58
164
+#: counter/models.py:67
91 165
 msgid "like"
92 166
 msgstr ""
93 167
 
94
-#: counter/models.py:59
168
+#: counter/models.py:68
95 169
 msgid "likes"
96 170
 msgstr ""
97 171
 
98
-#: counter/models.py:63
172
+#: counter/models.py:72
99 173
 #, python-format
100 174
 msgid "%(liker)s likes %(reset)s"
101 175
 msgstr ""
102 176
 
103
-#: counter/models.py:70
177
+#: counter/models.py:79
104 178
 msgid "keyword"
105 179
 msgstr ""
106 180
 
107
-#: counter/models.py:71
181
+#: counter/models.py:80
108 182
 msgid "keywords"
109 183
 msgstr ""
110 184
 
111
-#: counter/models.py:78 counter/models.py:82
185
+#: counter/models.py:87 counter/models.py:91
112 186
 msgid "hashtag"
113 187
 msgstr ""
114 188
 
115
-#: counter/models.py:83
189
+#: counter/models.py:92
116 190
 msgid "hashtags"
117 191
 msgstr ""
118 192
 
119
-#: counter/models.py:86
193
+#: counter/models.py:95
120 194
 #, python-format
121 195
 msgid "%(keyword)s for %(who)s"
122 196
 msgstr ""
123 197
 
124
-#: counter/templates/counterTemplate.html:47
125
-#: counter/templates/homeTemplate.html:32
198
+#: counter/templates/counterTemplate.html:48
199
+#: counter/templates/homeTemplate.html:25
126 200
 msgid "No seum yet"
127 201
 msgstr ""
128 202
 
129
-#: counter/templates/counterTemplate.html:51
130
-#: counter/templates/homeTemplate.html:138
203
+#: counter/templates/counterTemplate.html:52
204
+#: counter/templates/homeTemplate.html:129
131 205
 msgid "Got the seum"
132 206
 msgstr ""
133 207
 
134
-#: counter/templates/counterTemplate.html:52
135
-#: counter/templates/homeTemplate.html:139
208
+#: counter/templates/counterTemplate.html:53
209
+#: counter/templates/homeTemplate.html:130
136 210
 #, python-format
137 211
 msgid "Seum thrown by %(trigram)s %(time_ago)s."
138 212
 msgstr ""
139 213
 
140
-#: counter/templates/counterTemplate.html:60
141
-#: counter/templates/homeTemplate.html:45
214
+#: counter/templates/counterTemplate.html:61
215
+#: counter/templates/homeTemplate.html:36
142 216
 msgid "Reset the counter"
143 217
 msgstr ""
144 218
 
145
-#: counter/templates/counterTemplate.html:66
219
+#: counter/templates/counterTemplate.html:67
146 220
 msgid "Motive for the seum:"
147 221
 msgstr ""
148 222
 
149
-#: counter/templates/counterTemplate.html:73
150
-#: counter/templates/homeTemplate.html:89
223
+#: counter/templates/counterTemplate.html:74
224
+#: counter/templates/homeTemplate.html:80
151 225
 msgid "Throw the seum"
152 226
 msgstr ""
153 227
 
154
-#: counter/templates/counterTemplate.html:82
228
+#: counter/templates/counterTemplate.html:84
155 229
 msgid "Timeline of the seum"
156 230
 msgstr ""
157 231
 
158
-#: counter/templates/counterTemplate.html:87
232
+#: counter/templates/counterTemplate.html:89
159 233
 msgid "No timeline of the seum yet..."
160 234
 msgstr ""
161 235
 
162
-#: counter/templates/counterTemplate.html:101
236
+#: counter/templates/counterTemplate.html:103
163 237
 msgid "Seum history"
164 238
 msgstr ""
165 239
 
166
-#: counter/templates/counterTemplate.html:109
240
+#: counter/templates/counterTemplate.html:111
167 241
 #: counter/templates/hashtagTemplate.html:26
168 242
 msgid "Date"
169 243
 msgstr ""
170 244
 
171
-#: counter/templates/counterTemplate.html:110
245
+#: counter/templates/counterTemplate.html:112
172 246
 #: counter/templates/hashtagTemplate.html:27
173
-#: counter/templates/homeTemplate.html:82
247
+#: counter/templates/homeTemplate.html:73
174 248
 msgid "Motive"
175 249
 msgstr ""
176 250
 
177
-#: counter/templates/counterTemplate.html:111
251
+#: counter/templates/counterTemplate.html:113
178 252
 #: counter/templates/hashtagTemplate.html:29
179 253
 msgid "Seum thrower"
180 254
 msgstr ""
181 255
 
182
-#: counter/templates/counterTemplate.html:112
256
+#: counter/templates/counterTemplate.html:114
183 257
 #: counter/templates/hashtagTemplate.html:30
184 258
 msgid "Number of likes"
185 259
 msgstr ""
186 260
 
187
-#: counter/templates/counterTemplate.html:137
261
+#: counter/templates/counterTemplate.html:139
188 262
 #: counter/templates/hashtagTemplate.html:56
189 263
 msgid "Back to counters list"
190 264
 msgstr ""
@@ -214,49 +288,53 @@ msgstr ""
214 288
 msgid "Email notifications"
215 289
 msgstr ""
216 290
 
217
-#: counter/templates/createUser.html:34
291
+#: counter/templates/createUser.html:35
218 292
 msgid ""
219 293
 "Other users will see your nickname and your trigram only, it will be your "
220 294
 "seum identity!"
221 295
 msgstr ""
222 296
 
223
-#: counter/templates/createUser.html:36 counter/templates/homeTemplate.html:76
297
+#: counter/templates/createUser.html:36
298
+msgid "This trigram must be 3 characters long exactly."
299
+msgstr ""
300
+
301
+#: counter/templates/createUser.html:39 counter/templates/homeTemplate.html:67
224 302
 #: counter/views/home.py:200 counter/views/home.py:206
225 303
 #: counter/views/home.py:244 counter/views/home.py:250
226 304
 #: counter/views/home.py:282 counter/views/home.py:288
227 305
 msgid "Trigram"
228 306
 msgstr ""
229 307
 
230
-#: counter/templates/createUser.html:40
308
+#: counter/templates/createUser.html:43
231 309
 msgid "Nick"
232 310
 msgstr ""
233 311
 
234
-#: counter/templates/createUser.html:43
312
+#: counter/templates/createUser.html:46
235 313
 msgid ""
236 314
 "I could have required 10 characters with one digit, an emoji, three "
237 315
 "uppercase letters and two lowercase ones to throw you the seum, but actually "
238 316
 "you can choose whatever you want."
239 317
 msgstr ""
240 318
 
241
-#: counter/templates/createUser.html:45 counter/templates/login.html:27
319
+#: counter/templates/createUser.html:48 counter/templates/login.html:27
242 320
 msgid "Password"
243 321
 msgstr ""
244 322
 
245
-#: counter/templates/createUser.html:49
323
+#: counter/templates/createUser.html:52
246 324
 msgid "Confirm password"
247 325
 msgstr ""
248 326
 
249
-#: counter/templates/createUser.html:52
327
+#: counter/templates/createUser.html:55
250 328
 msgid ""
251 329
 "If this form has given you the seum, do not forget to reset your counter "
252 330
 "once you are logged in!"
253 331
 msgstr ""
254 332
 
255
-#: counter/templates/createUser.html:54
333
+#: counter/templates/createUser.html:57
256 334
 msgid "Create the counter"
257 335
 msgstr ""
258 336
 
259
-#: counter/templates/createUser.html:64 counter/templates/login.html:43
337
+#: counter/templates/createUser.html:67 counter/templates/login.html:43
260 338
 #: counter/templates/passwordChange.html:45
261 339
 #: counter/templates/passwordReset.html:37
262 340
 #: counter/templates/passwordResetConfirm.html:42
@@ -291,81 +369,81 @@ msgstr ""
291 369
 msgid "Victim"
292 370
 msgstr ""
293 371
 
294
-#: counter/templates/homeTemplate.html:6
372
+#: counter/templates/homeTemplate.html:1
295 373
 msgid "Counters"
296 374
 msgstr ""
297 375
 
298
-#: counter/templates/homeTemplate.html:36
376
+#: counter/templates/homeTemplate.html:28
299 377
 msgid "I got the seum"
300 378
 msgstr ""
301 379
 
302
-#: counter/templates/homeTemplate.html:38
380
+#: counter/templates/homeTemplate.html:30
303 381
 msgid "threw me the seum"
304 382
 msgstr ""
305 383
 
306
-#: counter/templates/homeTemplate.html:52
384
+#: counter/templates/homeTemplate.html:43
307 385
 msgid "Motive of the seum"
308 386
 msgstr ""
309 387
 
310
-#: counter/templates/homeTemplate.html:59
388
+#: counter/templates/homeTemplate.html:50
311 389
 msgid "I've got the seum"
312 390
 msgstr ""
313 391
 
314
-#: counter/templates/homeTemplate.html:70
392
+#: counter/templates/homeTemplate.html:61
315 393
 msgid "Break the seum wall"
316 394
 msgstr ""
317 395
 
318
-#: counter/templates/homeTemplate.html:134
396
+#: counter/templates/homeTemplate.html:126
319 397
 msgid "Has not got the seum yet"
320 398
 msgstr ""
321 399
 
322
-#: counter/templates/homeTemplate.html:154
400
+#: counter/templates/homeTemplate.html:145
323 401
 msgid "Timeline of the 24h of the seum"
324 402
 msgstr ""
325 403
 
326
-#: counter/templates/homeTemplate.html:159
404
+#: counter/templates/homeTemplate.html:150
327 405
 msgid "No seum in the last past 24h..."
328 406
 msgstr ""
329 407
 
330
-#: counter/templates/homeTemplate.html:172
408
+#: counter/templates/homeTemplate.html:161
331 409
 msgid "Best seumers"
332 410
 msgstr ""
333 411
 
334
-#: counter/templates/homeTemplate.html:177
335
-#: counter/templates/homeTemplate.html:249
412
+#: counter/templates/homeTemplate.html:166
413
+#: counter/templates/homeTemplate.html:230
336 414
 msgid "Nobody got the seum..."
337 415
 msgstr ""
338 416
 
339
-#: counter/templates/homeTemplate.html:190
417
+#: counter/templates/homeTemplate.html:177
340 418
 msgid "Most liked seumers"
341 419
 msgstr ""
342 420
 
343
-#: counter/templates/homeTemplate.html:195
344
-#: counter/templates/homeTemplate.html:231
421
+#: counter/templates/homeTemplate.html:182
422
+#: counter/templates/homeTemplate.html:214
345 423
 msgid "Nobody liked..."
346 424
 msgstr ""
347 425
 
348
-#: counter/templates/homeTemplate.html:208
426
+#: counter/templates/homeTemplate.html:193
349 427
 msgid "Most popular hashtags"
350 428
 msgstr ""
351 429
 
352
-#: counter/templates/homeTemplate.html:213
430
+#: counter/templates/homeTemplate.html:198
353 431
 msgid "Nobody used any hashtag..."
354 432
 msgstr ""
355 433
 
356
-#: counter/templates/homeTemplate.html:226
434
+#: counter/templates/homeTemplate.html:209
357 435
 msgid "Best likers of seum"
358 436
 msgstr ""
359 437
 
360
-#: counter/templates/homeTemplate.html:244
438
+#: counter/templates/homeTemplate.html:225
361 439
 msgid "Seum activity"
362 440
 msgstr ""
363 441
 
364
-#: counter/templates/homeTemplate.html:260
442
+#: counter/templates/homeTemplate.html:239
365 443
 msgid "Logout"
366 444
 msgstr ""
367 445
 
368
-#: counter/templates/homeTemplate.html:261
446
+#: counter/templates/homeTemplate.html:240
369 447
 #: counter/templates/passwordChange.html:5
370 448
 #: counter/templates/passwordChange.html:35
371 449
 #: counter/templates/passwordResetConfirm.html:5
@@ -373,19 +451,19 @@ msgstr ""
373 451
 msgid "Change password"
374 452
 msgstr ""
375 453
 
376
-#: counter/templates/homeTemplate.html:264
454
+#: counter/templates/homeTemplate.html:243
377 455
 msgid "Deactivate email notifications"
378 456
 msgstr ""
379 457
 
380
-#: counter/templates/homeTemplate.html:266
458
+#: counter/templates/homeTemplate.html:245
381 459
 msgid "Activate email notifications"
382 460
 msgstr ""
383 461
 
384
-#: counter/templates/homeTemplate.html:271
462
+#: counter/templates/homeTemplate.html:250
385 463
 msgid "Sort seums by date"
386 464
 msgstr ""
387 465
 
388
-#: counter/templates/homeTemplate.html:273
466
+#: counter/templates/homeTemplate.html:252
389 467
 msgid "Sort seums by score"
390 468
 msgstr ""
391 469
 
@@ -570,22 +648,22 @@ msgstr ""
570 648
 msgid "Number of received likes"
571 649
 msgstr ""
572 650
 
573
-#: counter/views/user.py:22
651
+#: counter/views/user.py:26
574 652
 msgid "Passwords do not match."
575 653
 msgstr ""
576 654
 
577
-#: counter/views/user.py:27
655
+#: counter/views/user.py:31
578 656
 msgid "A user with this email address already exists."
579 657
 msgstr ""
580 658
 
581
-#: counter/views/user.py:33
659
+#: counter/views/user.py:37
582 660
 msgid "Use another email address, another user has already this login."
583 661
 msgstr ""
584 662
 
585
-#: seum/settings.py:109
663
+#: seum/settings.py:105
586 664
 msgid "English"
587 665
 msgstr ""
588 666
 
589
-#: seum/settings.py:110
667
+#: seum/settings.py:106
590 668
 msgid "French"
591 669
 msgstr ""

+ 168 - 88
locale/fr/LC_MESSAGES/django.po

@@ -8,7 +8,7 @@ msgid ""
8 8
 msgstr ""
9 9
 "Project-Id-Version: PACKAGE VERSION\n"
10 10
 "Report-Msgid-Bugs-To: \n"
11
-"POT-Creation-Date: 2017-01-23 15:08+0000\n"
11
+"POT-Creation-Date: 2020-04-13 09:40+0000\n"
12 12
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13 13
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14 14
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,174 +18,249 @@ msgstr ""
18 18
 "Content-Transfer-Encoding: 8bit\n"
19 19
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
20 20
 
21
-#: counter/models.py:12
21
+#: bot/models.py:12 counter/models.py:28
22
+msgid "counter"
23
+msgstr "Compteur"
24
+
25
+#: bot/models.py:13 bot/models.py:30 bot/models.py:43
26
+msgid "telegram_user_id"
27
+msgstr ""
28
+
29
+#: bot/models.py:17
30
+msgid "telegram_user"
31
+msgstr ""
32
+
33
+#: bot/models.py:18
34
+msgid "telegram_users"
35
+msgstr ""
36
+
37
+#: bot/models.py:21
38
+#, fuzzy, python-format
39
+#| msgid "%(counter)s: %(reason)s"
40
+msgid "%(counter)s is %(telegram_user_id)d"
41
+msgstr "%(counter)s : %(reason)s"
42
+
43
+#: bot/models.py:31
44
+msgid "verify_key"
45
+msgstr ""
46
+
47
+#: bot/models.py:35
48
+msgid "telegram_user_check"
49
+msgstr ""
50
+
51
+#: bot/models.py:36
52
+msgid "telegram_user_checks"
53
+msgstr ""
54
+
55
+#: bot/models.py:39
56
+#, python-format
57
+msgid "%(telegram_user_id)d has verif key %(verif_key)s"
58
+msgstr ""
59
+
60
+#: bot/models.py:44 bot/models.py:57
61
+msgid "telegram_chat_id"
62
+msgstr ""
63
+
64
+#: bot/models.py:48
65
+msgid "telegram_user_chat"
66
+msgstr ""
67
+
68
+#: bot/models.py:49
69
+msgid "telegram_user_chats"
70
+msgstr ""
71
+
72
+#: bot/models.py:53
73
+#, python-format
74
+msgid "%(telegram_user_id)d is in the chat %(telegram_chat)d"
75
+msgstr ""
76
+
77
+#: bot/models.py:61
78
+msgid "notify_only_members"
79
+msgstr ""
80
+
81
+#: bot/models.py:65
82
+msgid "telegram_chat"
83
+msgstr ""
84
+
85
+#: bot/models.py:66
86
+msgid "telegram_chats"
87
+msgstr ""
88
+
89
+#: bot/models.py:69
90
+#, python-format
91
+msgid ""
92
+"%(chat_id)d is a telegram chat, with option notify_only_members to "
93
+"%(notify_only_members)s"
94
+msgstr ""
95
+
96
+#: counter/models.py:13
22 97
 msgid "name"
23 98
 msgstr "Nom d'utilisateur"
24 99
 
25
-#: counter/models.py:13
100
+#: counter/models.py:14
26 101
 msgid "email"
27 102
 msgstr "email"
28 103
 
29
-#: counter/models.py:14
104
+#: counter/models.py:16
30 105
 msgid "trigram"
31 106
 msgstr "Trigramme"
32 107
 
33
-#: counter/models.py:15
108
+#: counter/models.py:18 counter/views/user.py:22
109
+msgid "Trigram must be 3 characters long."
110
+msgstr "Le trigramme doit contenir exactement 3 caractères."
111
+
112
+#: counter/models.py:20
34 113
 msgid "associated user"
35 114
 msgstr "utilisateur associé"
36 115
 
37
-#: counter/models.py:16
116
+#: counter/models.py:21
38 117
 msgid "email notifications"
39 118
 msgstr "Notifications par email"
40 119
 
41
-#: counter/models.py:17
120
+#: counter/models.py:22
42 121
 msgid "sort by SeumScore"
43 122
 msgstr "Trier les seums par score"
44 123
 
45
-#: counter/models.py:20
124
+#: counter/models.py:25
46 125
 #, python-format
47 126
 msgid "%(trigram)s (%(name)s)"
48 127
 msgstr "%(trigram)s (%(name)s)"
49 128
 
50
-#: counter/models.py:23
51
-msgid "counter"
52
-msgstr "Compteur"
53
-
54
-#: counter/models.py:27 counter/models.py:55
129
+#: counter/models.py:36 counter/models.py:64
55 130
 msgid "datetime"
56 131
 msgstr "date et heure"
57 132
 
58
-#: counter/models.py:28
133
+#: counter/models.py:37
59 134
 msgid "reason"
60 135
 msgstr "raison"
61 136
 
62
-#: counter/models.py:29
137
+#: counter/models.py:38
63 138
 msgid "victim"
64 139
 msgstr "Victime"
65 140
 
66
-#: counter/models.py:30
141
+#: counter/models.py:39
67 142
 msgid "seum giver"
68 143
 msgstr "fouteur de seum"
69 144
 
70
-#: counter/models.py:34
145
+#: counter/models.py:43
71 146
 #, python-format
72 147
 msgid "%(counter)s: %(datetime)s (%(reason)s)"
73 148
 msgstr "%(counter)s : %(datetime)s %(reason)s"
74 149
 
75
-#: counter/models.py:48 counter/models.py:79
150
+#: counter/models.py:57 counter/models.py:88
76 151
 msgid "reset"
77 152
 msgstr "Remise à zéro"
78 153
 
79
-#: counter/models.py:49
154
+#: counter/models.py:58
80 155
 msgid "resets"
81 156
 msgstr "Remises à zéro"
82 157
 
83
-#: counter/models.py:53
158
+#: counter/models.py:62
84 159
 msgid "liker"
85 160
 msgstr "liker"
86 161
 
87
-#: counter/models.py:54
162
+#: counter/models.py:63
88 163
 msgid "seum"
89 164
 msgstr "seum"
90 165
 
91
-#: counter/models.py:58
166
+#: counter/models.py:67
92 167
 msgid "like"
93 168
 msgstr "like"
94 169
 
95
-#: counter/models.py:59
170
+#: counter/models.py:68
96 171
 msgid "likes"
97 172
 msgstr "likes"
98 173
 
99
-#: counter/models.py:63
174
+#: counter/models.py:72
100 175
 #, python-format
101 176
 msgid "%(liker)s likes %(reset)s"
102 177
 msgstr "%(liker)s likes %(reset)s"
103 178
 
104
-#: counter/models.py:70
179
+#: counter/models.py:79
105 180
 msgid "keyword"
106 181
 msgstr "mot-clé"
107 182
 
108
-#: counter/models.py:71
183
+#: counter/models.py:80
109 184
 msgid "keywords"
110 185
 msgstr "mots-clé"
111 186
 
112
-#: counter/models.py:78 counter/models.py:82
187
+#: counter/models.py:87 counter/models.py:91
113 188
 msgid "hashtag"
114 189
 msgstr "Hashtag"
115 190
 
116
-#: counter/models.py:83
191
+#: counter/models.py:92
117 192
 msgid "hashtags"
118 193
 msgstr "Hashtags"
119 194
 
120
-#: counter/models.py:86
195
+#: counter/models.py:95
121 196
 #, python-format
122 197
 msgid "%(keyword)s for %(who)s"
123 198
 msgstr "%(keyword)s pour %(who)s"
124 199
 
125
-#: counter/templates/counterTemplate.html:47
126
-#: counter/templates/homeTemplate.html:32
200
+#: counter/templates/counterTemplate.html:48
201
+#: counter/templates/homeTemplate.html:25
127 202
 msgid "No seum yet"
128 203
 msgstr "Pas encore de seum"
129 204
 
130
-#: counter/templates/counterTemplate.html:51
131
-#: counter/templates/homeTemplate.html:138
205
+#: counter/templates/counterTemplate.html:52
206
+#: counter/templates/homeTemplate.html:129
132 207
 msgid "Got the seum"
133 208
 msgstr "A eu le seum"
134 209
 
135
-#: counter/templates/counterTemplate.html:52
136
-#: counter/templates/homeTemplate.html:139
210
+#: counter/templates/counterTemplate.html:53
211
+#: counter/templates/homeTemplate.html:130
137 212
 #, python-format
138 213
 msgid "Seum thrown by %(trigram)s %(time_ago)s."
139 214
 msgstr "%(trigram)s lui a foutu le seum %(time_ago)s"
140 215
 
141
-#: counter/templates/counterTemplate.html:60
142
-#: counter/templates/homeTemplate.html:45
216
+#: counter/templates/counterTemplate.html:61
217
+#: counter/templates/homeTemplate.html:36
143 218
 msgid "Reset the counter"
144 219
 msgstr "Remettre à zéro"
145 220
 
146
-#: counter/templates/counterTemplate.html:66
221
+#: counter/templates/counterTemplate.html:67
147 222
 msgid "Motive for the seum:"
148 223
 msgstr "Motif du seum :"
149 224
 
150
-#: counter/templates/counterTemplate.html:73
151
-#: counter/templates/homeTemplate.html:89
225
+#: counter/templates/counterTemplate.html:74
226
+#: counter/templates/homeTemplate.html:80
152 227
 msgid "Throw the seum"
153 228
 msgstr "Foutre le seum"
154 229
 
155
-#: counter/templates/counterTemplate.html:82
230
+#: counter/templates/counterTemplate.html:84
156 231
 msgid "Timeline of the seum"
157 232
 msgstr "Timeline du seum"
158 233
 
159
-#: counter/templates/counterTemplate.html:87
234
+#: counter/templates/counterTemplate.html:89
160 235
 msgid "No timeline of the seum yet..."
161 236
 msgstr "Pas encore de timeline du seum..."
162 237
 
163
-#: counter/templates/counterTemplate.html:101
238
+#: counter/templates/counterTemplate.html:103
164 239
 msgid "Seum history"
165 240
 msgstr "Historique du seum"
166 241
 
167
-#: counter/templates/counterTemplate.html:109
242
+#: counter/templates/counterTemplate.html:111
168 243
 #: counter/templates/hashtagTemplate.html:26
169 244
 msgid "Date"
170 245
 msgstr "Date"
171 246
 
172
-#: counter/templates/counterTemplate.html:110
247
+#: counter/templates/counterTemplate.html:112
173 248
 #: counter/templates/hashtagTemplate.html:27
174
-#: counter/templates/homeTemplate.html:82
249
+#: counter/templates/homeTemplate.html:73
175 250
 msgid "Motive"
176 251
 msgstr "Motif"
177 252
 
178
-#: counter/templates/counterTemplate.html:111
253
+#: counter/templates/counterTemplate.html:113
179 254
 #: counter/templates/hashtagTemplate.html:29
180 255
 msgid "Seum thrower"
181 256
 msgstr "Fouteur de seum"
182 257
 
183
-#: counter/templates/counterTemplate.html:112
258
+#: counter/templates/counterTemplate.html:114
184 259
 #: counter/templates/hashtagTemplate.html:30
185 260
 msgid "Number of likes"
186 261
 msgstr "Nombre de likes"
187 262
 
188
-#: counter/templates/counterTemplate.html:137
263
+#: counter/templates/counterTemplate.html:139
189 264
 #: counter/templates/hashtagTemplate.html:56
190 265
 msgid "Back to counters list"
191 266
 msgstr "Retour à la liste des compteurs"
@@ -220,7 +295,7 @@ msgstr ""
220 295
 msgid "Email notifications"
221 296
 msgstr "Notifications par email"
222 297
 
223
-#: counter/templates/createUser.html:34
298
+#: counter/templates/createUser.html:35
224 299
 msgid ""
225 300
 "Other users will see your nickname and your trigram only, it will be your "
226 301
 "seum identity!"
@@ -228,18 +303,22 @@ msgstr ""
228 303
 "Les autres utilisateurs ne pourront voir que ton pseudo et ton trigramme, ce "
229 304
 "sera ton identité seumesque !"
230 305
 
231
-#: counter/templates/createUser.html:36 counter/templates/homeTemplate.html:76
306
+#: counter/templates/createUser.html:36
307
+msgid "This trigram must be 3 characters long exactly."
308
+msgstr "Ce trigramme doit comporter exactement 3 caractères."
309
+
310
+#: counter/templates/createUser.html:39 counter/templates/homeTemplate.html:67
232 311
 #: counter/views/home.py:200 counter/views/home.py:206
233 312
 #: counter/views/home.py:244 counter/views/home.py:250
234 313
 #: counter/views/home.py:282 counter/views/home.py:288
235 314
 msgid "Trigram"
236 315
 msgstr "Trigramme"
237 316
 
238
-#: counter/templates/createUser.html:40
317
+#: counter/templates/createUser.html:43
239 318
 msgid "Nick"
240 319
 msgstr "Pseudo"
241 320
 
242
-#: counter/templates/createUser.html:43
321
+#: counter/templates/createUser.html:46
243 322
 msgid ""
244 323
 "I could have required 10 characters with one digit, an emoji, three "
245 324
 "uppercase letters and two lowercase ones to throw you the seum, but actually "
@@ -249,15 +328,15 @@ msgstr ""
249 328
 "2 minuscules pour te foutre le seum mais en fait tu peux mettre ce que tu "
250 329
 "veux."
251 330
 
252
-#: counter/templates/createUser.html:45 counter/templates/login.html:27
331
+#: counter/templates/createUser.html:48 counter/templates/login.html:27
253 332
 msgid "Password"
254 333
 msgstr "Mot de passe"
255 334
 
256
-#: counter/templates/createUser.html:49
335
+#: counter/templates/createUser.html:52
257 336
 msgid "Confirm password"
258 337
 msgstr "Confirmer le mot de passe"
259 338
 
260
-#: counter/templates/createUser.html:52
339
+#: counter/templates/createUser.html:55
261 340
 msgid ""
262 341
 "If this form has given you the seum, do not forget to reset your counter "
263 342
 "once you are logged in!"
@@ -265,11 +344,11 @@ msgstr ""
265 344
 "Si ce formulaire t'as foutu le seum, n'oublie pas de remettre ton compteur à "
266 345
 "zéro en arrivant sur le site."
267 346
 
268
-#: counter/templates/createUser.html:54
347
+#: counter/templates/createUser.html:57
269 348
 msgid "Create the counter"
270 349
 msgstr "Créer le compteur"
271 350
 
272
-#: counter/templates/createUser.html:64 counter/templates/login.html:43
351
+#: counter/templates/createUser.html:67 counter/templates/login.html:43
273 352
 #: counter/templates/passwordChange.html:45
274 353
 #: counter/templates/passwordReset.html:37
275 354
 #: counter/templates/passwordResetConfirm.html:42
@@ -304,81 +383,81 @@ msgstr "Liste des seums contenant"
304 383
 msgid "Victim"
305 384
 msgstr "Victime"
306 385
 
307
-#: counter/templates/homeTemplate.html:6
386
+#: counter/templates/homeTemplate.html:1
308 387
 msgid "Counters"
309 388
 msgstr "Compteurs"
310 389
 
311
-#: counter/templates/homeTemplate.html:36
390
+#: counter/templates/homeTemplate.html:28
312 391
 msgid "I got the seum"
313 392
 msgstr "J'ai eu le seum"
314 393
 
315
-#: counter/templates/homeTemplate.html:38
394
+#: counter/templates/homeTemplate.html:30
316 395
 msgid "threw me the seum"
317 396
 msgstr "m'a foutu le seum"
318 397
 
319
-#: counter/templates/homeTemplate.html:52
398
+#: counter/templates/homeTemplate.html:43
320 399
 msgid "Motive of the seum"
321 400
 msgstr "Motif du seum"
322 401
 
323
-#: counter/templates/homeTemplate.html:59
402
+#: counter/templates/homeTemplate.html:50
324 403
 msgid "I've got the seum"
325 404
 msgstr "J'ai le seum"
326 405
 
327
-#: counter/templates/homeTemplate.html:70
406
+#: counter/templates/homeTemplate.html:61
328 407
 msgid "Break the seum wall"
329 408
 msgstr "Brise le mur du seum"
330 409
 
331
-#: counter/templates/homeTemplate.html:134
410
+#: counter/templates/homeTemplate.html:126
332 411
 msgid "Has not got the seum yet"
333 412
 msgstr "N'a pas encore eu le seum"
334 413
 
335
-#: counter/templates/homeTemplate.html:154
414
+#: counter/templates/homeTemplate.html:145
336 415
 msgid "Timeline of the 24h of the seum"
337 416
 msgstr "Timeline des 24 heures du seum"
338 417
 
339
-#: counter/templates/homeTemplate.html:159
418
+#: counter/templates/homeTemplate.html:150
340 419
 msgid "No seum in the last past 24h..."
341 420
 msgstr "Pas de seum durant les dernières 24h..."
342 421
 
343
-#: counter/templates/homeTemplate.html:172
422
+#: counter/templates/homeTemplate.html:161
344 423
 msgid "Best seumers"
345 424
 msgstr "Meilleurs seumers"
346 425
 
347
-#: counter/templates/homeTemplate.html:177
348
-#: counter/templates/homeTemplate.html:249
426
+#: counter/templates/homeTemplate.html:166
427
+#: counter/templates/homeTemplate.html:230
349 428
 msgid "Nobody got the seum..."
350 429
 msgstr "Personne n'a eu le seum..."
351 430
 
352
-#: counter/templates/homeTemplate.html:190
431
+#: counter/templates/homeTemplate.html:177
353 432
 msgid "Most liked seumers"
354 433
 msgstr "Seumers les plus likés"
355 434
 
356
-#: counter/templates/homeTemplate.html:195
357
-#: counter/templates/homeTemplate.html:231
435
+#: counter/templates/homeTemplate.html:182
436
+#: counter/templates/homeTemplate.html:214
358 437
 msgid "Nobody liked..."
359 438
 msgstr "Personne n'a aimé..."
360 439
 
361
-#: counter/templates/homeTemplate.html:208
440
+#: counter/templates/homeTemplate.html:193
362 441
 msgid "Most popular hashtags"
363 442
 msgstr "Hashtags les plus populaires"
364 443
 
365
-#: counter/templates/homeTemplate.html:213
444
+#: counter/templates/homeTemplate.html:198
366 445
 msgid "Nobody used any hashtag..."
367 446
 msgstr "Personne n'a utilisé de hashtag..."
368 447
 
369
-#: counter/templates/homeTemplate.html:226
448
+#: counter/templates/homeTemplate.html:209
370 449
 msgid "Best likers of seum"
371 450
 msgstr "Meilleurs likeurs de seum"
372 451
 
373
-#: counter/templates/homeTemplate.html:244
452
+#: counter/templates/homeTemplate.html:225
374 453
 msgid "Seum activity"
375 454
 msgstr "Activité seumesque"
376 455
 
377
-#: counter/templates/homeTemplate.html:260
456
+#: counter/templates/homeTemplate.html:239
378 457
 msgid "Logout"
379 458
 msgstr "Se déconnecter"
380 459
 
381
-#: counter/templates/homeTemplate.html:261
460
+#: counter/templates/homeTemplate.html:240
382 461
 #: counter/templates/passwordChange.html:5
383 462
 #: counter/templates/passwordChange.html:35
384 463
 #: counter/templates/passwordResetConfirm.html:5
@@ -386,19 +465,19 @@ msgstr "Se déconnecter"
386 465
 msgid "Change password"
387 466
 msgstr "Modifier le mot de passe"
388 467
 
389
-#: counter/templates/homeTemplate.html:264
468
+#: counter/templates/homeTemplate.html:243
390 469
 msgid "Deactivate email notifications"
391 470
 msgstr "Désactiver les notifications par email"
392 471
 
393
-#: counter/templates/homeTemplate.html:266
472
+#: counter/templates/homeTemplate.html:245
394 473
 msgid "Activate email notifications"
395 474
 msgstr "Activer les notifications par email"
396 475
 
397
-#: counter/templates/homeTemplate.html:271
476
+#: counter/templates/homeTemplate.html:250
398 477
 msgid "Sort seums by date"
399 478
 msgstr "Trier les seums par ancienneté"
400 479
 
401
-#: counter/templates/homeTemplate.html:273
480
+#: counter/templates/homeTemplate.html:252
402 481
 msgid "Sort seums by score"
403 482
 msgstr "Trier les seums par score"
404 483
 
@@ -525,6 +604,7 @@ msgstr ""
525 604
 "lien pour le réinitialiser :"
526 605
 
527 606
 #: counter/templates/resetEmail.txt:6
607
+#, python-format
528 608
 msgid "Your login is %(login)s in case you have forgotten it too."
529 609
 msgstr "Ton login c'est %(login)s, au cas où tu l'aurais oublié aussi."
530 610
 
@@ -592,22 +672,22 @@ msgstr "Nombre de seums contenant le hashtag"
592 672
 msgid "Number of received likes"
593 673
 msgstr "Nombre de likes reçus"
594 674
 
595
-#: counter/views/user.py:22
675
+#: counter/views/user.py:26
596 676
 msgid "Passwords do not match."
597 677
 msgstr "Les mots de passe sont différents."
598 678
 
599
-#: counter/views/user.py:27
679
+#: counter/views/user.py:31
600 680
 msgid "A user with this email address already exists."
601 681
 msgstr "Un utilisateur avec cette adresse email existe déjà."
602 682
 
603
-#: counter/views/user.py:33
683
+#: counter/views/user.py:37
604 684
 msgid "Use another email address, another user has already this login."
605 685
 msgstr "Utilise une autre adresse email, un autre utilisateur a déjà ce login."
606 686
 
607
-#: seum/settings.py:109
687
+#: seum/settings.py:105
608 688
 msgid "English"
609 689
 msgstr "Anglais"
610 690
 
611
-#: seum/settings.py:110
691
+#: seum/settings.py:106
612 692
 msgid "French"
613 693
 msgstr "Français"