1+ import framework as fw , secret
2+ ############################################################################################
3+ # EMBED VARIABLE DEFINITON #
4+ ############################################################################################
5+ # NOTE! There can only be one embed per message but you can add more fields inside that embed!
6+
7+
8+ # framework.EMBED example
9+ test_embed1 = fw .EMBED (
10+ author_name = "Developer" ,
11+ author_icon = "https://solarsystem.nasa.gov/system/basic_html_elements/11561_Sun.png" ,
12+ fields = \
13+ [
14+ fw .EmbedFIELD ("Test 1" , "Hello World" , True ),
15+ fw .EmbedFIELD ("Test 2" , "Hello World 2" , True ),
16+ fw .EmbedFIELD ("Test 3" , "Hello World 3" , True ),
17+ fw .EmbedFIELD ("No Inline" , "This is without inline" , False ),
18+ fw .EmbedFIELD ("Test 4" , "Hello World 4" , True ),
19+ fw .EmbedFIELD ("Test 5" , "Hello World 5" , True )
20+ ],
21+ ## ... for other arguments, see https://github.com/davidhozic/discord-advertisement-framework
22+ )
23+
24+
25+ # pycord (discord.py) Embed
26+ test_embed2 = fw .discord .Embed (
27+ color = fw .discord .Color .dark_orange (),
28+ title = "Test Embed Title" ,
29+ description = "This is a discord embed" ,
30+ # ... other, refer to Pycord documentation
31+ )
32+
33+ # framework.EMBED from discord.Embed
34+ test_embed_fw_2 = fw .EMBED .from_discord_embed (test_embed2 ) ## Converts discord.Embed into framework.EMBED
35+
36+
37+
38+ ############################################################################################
39+ # GUILD MESSAGES DEFINITION #
40+ ############################################################################################
41+ guilds = [
42+ fw .USER (
43+ user_id = 123456789 , # ID of server (guild)
44+ messages_to_send = [ # List MESSAGE objects
45+ fw .DirectMESSAGE (
46+ start_period = None , # If None, messages will be send on a fixed period (end period)
47+ end_period = 15 , # If start_period is None, it dictates the fixed sending period,
48+ # If start period is defined, it dictates the maximum limit of randomized period
49+ data = test_embed1 , # Data you want to sent to the function (Can be of types : str, embed, file, list of types to the left
50+ # or function that returns any of above types(or returns None if you don't have any data to send yet),
51+ # where if you pass a function you need to use the fw.FUNCTION decorator on top of it ).
52+ mode = "send" , # "send" will send a new message every time, "edit" will edit the previous message, "clear-send" will delete
53+ # the previous message and then send a new one
54+ start_now = True # Start sending now (True) or wait until period
55+ ),
56+
57+ fw .DirectMESSAGE (
58+ start_period = None ,
59+ end_period = 15 ,
60+
61+ data = test_embed_fw_2 ,
62+
63+ mode = "send" ,
64+ start_now = True
65+ ),
66+ ],
67+ generate_log = True ## Generate file log of sent messages (and failed attempts) for this user
68+ )
69+ ]
70+
71+ ############################################################################################
72+
73+ if __name__ == "__main__" :
74+ fw .run ( token = secret .C_TOKEN , # MANDATORY,
75+ server_list = guilds , # MANDATORY
76+ is_user = False , # OPTIONAL
77+ user_callback = None , # OPTIONAL
78+ server_log_output = "History" , # OPTIONAL
79+ debug = True ) # OPTIONAL
0 commit comments