You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- JSON Logging [For easier parsing with different programs & compatibility with future addition of SQL logs]
- Auto remove channels if they were deleted (messages will still be "sent" even if no channels remain making empty logs)
- Updated the Pycord library to it's latest version
- server_list : list= List of [framework.GUILD](#frameworkguild) objects
330
331
- is_user : bool= Set to Trueif token isfrom an user account andnot a bot account
331
-
- user_callback : function= User callback function (gets called after framework is ran)
332
+
- user_callback : function= User callback asyncfunction (gets called after framework is ran)
332
333
- server_log_output : str= Path where the server log files will be created
333
334
- debug : bool= Print trace message to the console,
334
335
usefull for debugging if you feel like something isnot working
@@ -361,7 +362,7 @@ It is used to fully shutdown the framework and then **exit** out of the program.
361
362
362
363
## framework.**data_function**
363
364
364
-
- This decorator accepts a function as it's parameter and then returns a object that will be called by the framework. To use an <u>user defined function as parameter</u> to the [framework.TextMESSAGE/framework.VoiceMESSAGE](#frameworktextmessage--frameworkvoicemessage) data parameter, you **MUST** use this decorator beforehand. Please see the **Examples** folder.
365
+
- This decorator accepts a function as it's parameter and then returns a object that will be called by the framework. To use an <u>user defined function as parameter</u> to the [framework.TextMESSAGE/framework.VoiceMESSAGE/DirectMESSAGE](#frameworkxxxmessage) data parameter, you **MUST** use this decorator beforehand. Please see the **Examples** folder.
365
366
- Usage:
366
367
```py
367
368
import datetime
@@ -397,7 +398,10 @@ It is used to fully shutdown the framework and then **exit** out of the program.
397
398
data=some_other_function(),
398
399
channel_ids= [21345, 23132],
399
400
start_now=True
400
-
),
401
+
)
402
+
],
403
+
generate_log=True
404
+
),
401
405
fw.USER(
402
406
user_id=123456789,
403
407
messages_to_send=[
@@ -415,9 +419,6 @@ It is used to fully shutdown the framework and then **exit** out of the program.
415
419
],
416
420
generate_log=True
417
421
)
418
-
],
419
-
generate_log=True
420
-
)
421
422
]
422
423
423
424
...
@@ -426,13 +427,157 @@ It is used to fully shutdown the framework and then **exit** out of the program.
426
427
427
428
# **Logging**
428
429
## **LOG OF SENT MESSAGES**
429
-
The framework can keep a log of sent messages for**each guild/server**. To enable file logging of sent messages, set the parameter **Generate file log** to True inside each [GUILDOBJECT](#frameworkguild).<br>
430
-
Inside the log you will find data of what was sent, a channel list it succeeded to send this message and a channel list of the ones it failed (If it failed due to slow mode, the message will be sent as soon as possible, overwriting the default period) <br>
431
-
All of these file logs will be Markdown files.<br><br>
The framework allows to log sent messages for each GUILD/USER (if you set the "generate_log" to True inside the [**GUILD**](#frameworkguild) or [**USER**](#frameworkuser) object).
431
+
The logs are writen in the JSONformatand saved into a .json file, that has the name of the guild or an user you were sending messages into.
432
+
The .json files are fragmantated by day and stored into folder "Year/Month/Day", this means that each day a new json file will be generated for that specific day for easier managing,
433
+
for example, if today is13.07.2022, the log will be saved into the file that is located in
434
+
```
435
+
History
436
+
└───2022
437
+
│ └───07
438
+
│ └───13
439
+
| └─── #David's dungeon.json
440
+
```
441
+
442
+
- name -- The display name of the guild or an user
443
+
-id-- The discord's snowflake ID of the guild or the user
444
+
-type-- The type of object that created this log ([GUILD](#frameworkguild) or [USER](#frameworkuser))
445
+
- message_history -- A list of all the message logs, this is depandant on the type of [**xxxMESSAGE**](#frameworkxxxmessage):
446
+
-for**TextMESSAGE**:
447
+
- sent_data -- contains the information about the sent data, can contain (the following keys are only present if that type of data was sent):
448
+
- sent_text -- the text that was sent
449
+
- sent_embed -- The embed that was sent, can contain the following (it only contains certain item if it was specified in the embed):
450
+
- title
451
+
- author
452
+
- thumbnail
453
+
- image
454
+
- description
455
+
- color
456
+
- fields --list of the embedded fields, each field contains:
457
+
- inline --bool variable that specifies if the field was inline with the prev. ornext field
458
+
- name -- name of the field
459
+
- content -- text inside the field body
460
+
- sent_files -- List of paths to the sent files
461
+
- channels -- dictionary of channels, contains:
462
+
- successful --list of channels that the message was successfuly sent to, contains:
463
+
- name
464
+
-id
465
+
- failed --list of channels that the message failed to be sent to, contains:
466
+
- name
467
+
-id
468
+
- reason
469
+
-type-- This is always TextMESSAGE
470
+
- mode -- The sending mode ("send", "edit", "clear-send")
471
+
- index -- Index of the log, new items are added to the top of the list
472
+
- timestamp -- The timestamp of the message
473
+
474
+
-for**VoiceMESSAGE**:
475
+
- streamed_audio -- The audio file that was streamed to the channels
476
+
- channels -- dictionary of channels, contains:
477
+
- successful --list of channels that the message was successfuly sent to, contains:
478
+
- name
479
+
-id
480
+
- failed --list of channels that the message failed to be sent to, contains:
481
+
- name
482
+
-id
483
+
- reason
484
+
-type-- This is always VoiceMESSAGE
485
+
- index -- Index of the log, new items are added to the top of the list
486
+
- timestamp -- The timestamp of the message
487
+
488
+
-for**DirectMESSAGE**:
489
+
- sent_data -- contains the information about the sent data, can contain (the following keys are only present if that type of data was sent):
490
+
- This is exactly the same asin**TextMESSAGE**
491
+
- success_info -- dictionary containing:
492
+
- success --bool variable that signals that sending was successful
493
+
- reason -- [only present if success is false] The reason why sending failed
494
+
-type-- This is always DirectMESSAGE
495
+
- mode -- The sending mode ("send", "edit", "clear-send")
496
+
- index -- Index of the log, new items are added to the top of the list
497
+
- timestamp -- The timestamp of the message
498
+
499
+
### **Example**
500
+
```json
501
+
{
502
+
"name": "\\David's dungeon",
503
+
"id": 863071397207212052,
504
+
"type": "GUILD",
505
+
"message_history": [
506
+
{
507
+
"sent_data": {
508
+
"text": "First message"
509
+
},
510
+
"channels": {
511
+
"successful": [
512
+
{
513
+
"name": "spam",
514
+
"id": 964251195168423999
515
+
}
516
+
],
517
+
"failed": []
518
+
},
519
+
"type": "TextMESSAGE",
520
+
"mode": "send",
521
+
"index": 3,
522
+
"timestamp": "18.04.2022 13:07:12"
523
+
},
524
+
{
525
+
"sent_data": {
526
+
"text": "First message"
527
+
},
528
+
"channels": {
529
+
"successful": [
530
+
{
531
+
"name": "spam",
532
+
"id": 964251195168423999
533
+
}
534
+
],
535
+
"failed": []
536
+
},
537
+
"type": "TextMESSAGE",
538
+
"mode": "send",
539
+
"index": 2,
540
+
"timestamp": "18.04.2022 13:07:07"
541
+
},
542
+
{
543
+
"sent_data": {
544
+
"text": "First message"
545
+
},
546
+
"channels": {
547
+
"successful": [
548
+
{
549
+
"name": "spam",
550
+
"id": 964251195168423999
551
+
}
552
+
],
553
+
"failed": []
554
+
},
555
+
"type": "TextMESSAGE",
556
+
"mode": "send",
557
+
"index": 1,
558
+
"timestamp": "18.04.2022 13:07:02"
559
+
},
560
+
{
561
+
"sent_data": {
562
+
"text": "First message"
563
+
},
564
+
"channels": {
565
+
"successful": [
566
+
{
567
+
"name": "spam",
568
+
"id": 964251195168423999
569
+
}
570
+
],
571
+
"failed": []
572
+
},
573
+
"type": "TextMESSAGE",
574
+
"mode": "send",
575
+
"index": 0,
576
+
"timestamp": "18.04.2022 13:06:57"
577
+
}
578
+
]
579
+
}
580
+
```
436
581
437
582
## **Trace messages**
438
583
In case you feel like the framework isnot doing it's job properly, eg. you feel like some messages aren't being send or the framework just stops without advertising, the framework offers **console logging** of **trace** messages. Trace messages can be **informative** (eg. which account is logged in), they can be **warnings** (eg. some channels could not be found),<br>
0 commit comments