Skip to content

Commit 28537ff

Browse files
authored
Merge pull request #137 from davidhozic/develop
v2.0.0
2 parents ffc3b3c + 42ebf8a commit 28537ff

File tree

123 files changed

+7766
-3095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+7766
-3095
lines changed

.github/workflows/docs.yml

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,20 @@ on:
1717
- debug
1818

1919
jobs:
20-
build:
21-
22-
runs-on: ubuntu-latest
23-
24-
steps:
25-
- uses: actions/checkout@v3
26-
- name: make
27-
run: make
28-
- name: make check
29-
run: make check
30-
- name: make distcheck
31-
run: make distcheck
32-
33-
3420
upload:
3521
runs-on: ubuntu-latest
22+
3623
steps:
3724
- uses: actions/checkout@v3
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -U -r requirements.txt
30+
pip install -U -r docs/requirements.txt
31+
3832
- name: build
3933
working-directory: docs
4034
run: make clean html
41-
- name: ftp-clean
42-
# You may pin to the exact commit or the version.
43-
# uses: taylorgibb/ftp-clean@37c34052bd2170bcab847bf8b61df5f4ff526093
44-
uses: taylorgibb/[email protected]
45-
with:
46-
# FTP host
47-
host: ${{ secrets.WEB_FTP_SERVER }}
48-
# FTP user
49-
user: ${{ secrets.WEB_FTP_USERNAME }}
50-
# FTP password
51-
password: ${{ secrets.WEB_FTP_PASSWORD }}
52-
# Files and directories which should be excluded from being removed.
53-
exclude: "stats"
5435

55-
- name: FTP Deploy
56-
# You may pin to the exact commit or the version.
57-
# uses: SamKirkland/FTP-Deploy-Action@d0aa83872616587eb552bc831bb9166b3f9c5ad5
58-
uses: SamKirkland/[email protected]
59-
with:
60-
# ftp server
61-
server: ${{ secrets.WEB_FTP_SERVER }}
62-
# ftp username
63-
username: ${{ secrets.WEB_FTP_USERNAME }}
64-
# ftp password
65-
password: ${{ secrets.WEB_FTP_PASSWORD }}
66-
# Server port to connect to (read your web hosts docs)
67-
68-
36+
# TODO: Upload to FTP

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
**/__pycache__/**
22
settings.json
3-
dist/**
3+
dist/**
4+
test**
5+
build**

Examples/Additional Application Layer Example/Coffee/main_coffee.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
servers = [
1414
fw.GUILD(
15-
guild_id=123456789,
16-
messages_to_send=[
15+
snowflake=123456789,
16+
messages=[
1717

18-
fw.TextMESSAGE(start_period=None, end_period=10, data=app.app.get_data(), channel_ids=[123456789], mode="send", start_now=True)
18+
fw.TextMESSAGE(start_period=None, end_period=10, data=app.app.get_data(), channels=[123456789], mode="send", start_now=True)
1919
],
20-
generate_log=True
20+
logging=True
2121
)
2222
]
2323

Examples/Additional Application Layer Example/Scheduled messages/BOT/main_obv.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ async def main():
250250
# Create the server list
251251
servers = [
252252
fw.GUILD (
253-
guild_id=guild["SERVER-ID"],
254-
messages_to_send= [
253+
snowflake=guild["SERVER-ID"],
254+
messages= [
255255
fw.TextMESSAGE(None, 1, get_data(ch_id), [ch_id], "send", True) for ch_id in guild["CHANNEL-IDs"]
256256
],
257-
generate_log=True
257+
logging=True
258258
) for guild in conf.WHITELISTED_GUILDS
259259
]
260260

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
The following example automatically generates the shilling list if the channel name matches
3+
any of the allowed_strings words.
4+
5+
It then dynamically adds an object, and later calls .update() method to change the initialization parameters
6+
passed at the start.
7+
"""
8+
9+
import asyncio
10+
import framework as fw
11+
from framework import trace
12+
13+
14+
# Create a list in which we will automatically add guilds
15+
allowed_strings = {"shill", "advert", "promo"}
16+
data_to_shill = ( # Example data set
17+
"Hello World",
18+
fw.EMBED(title="Example Embed",
19+
color=fw.EMBED.Color.blue(),
20+
description="This is a test embed")
21+
)
22+
23+
24+
async def user_task():
25+
# Returns the client to send commands to discord, for more info about client see https://docs.pycord.dev/en/master/api.html?highlight=discord%20client#discord.Client
26+
client = fw.get_client()
27+
for guild in client.guilds: # Iterate thru all the guilds where the bot is in
28+
await fw.add_object(
29+
fw.GUILD(guild.id, logging=True)
30+
)
31+
32+
# Find channels that match allowed_strings
33+
channels = []
34+
for channel in guild.text_channels: # Iterate thru all the text channels in the guild
35+
if any([x in channel.name for x in allowed_strings]): # Check if any of the strings in allowed_strings are in the channel name
36+
channels.append(channel)
37+
38+
text_msg = fw.TextMESSAGE(None, 15, data_to_shill, channels, "send", True)
39+
40+
# Dynamically add a message to the list
41+
await fw.add_object(text_msg, guild.id)
42+
43+
#########################################################################
44+
# Dynamic text message modification of the shill data and send period
45+
#########################################################################
46+
await asyncio.sleep(10)
47+
trace("Updating the TextMESSAGE object")
48+
# Update the object
49+
await text_msg.update(data="Updated Data", end_period=60)
50+
51+
trace("Now shilling 'Updated Data' with period of 60 seconds")
52+
#########################################################################
53+
54+
############################################################################################################################################################################
55+
56+
57+
############################################################################################
58+
if __name__ == "__main__":
59+
fw.run(token="OOFOAFO321o3oOOAOO$Oo$o$@O4242",
60+
user_callback=user_task)
61+

Examples/Examples.zip

2.87 MB
Binary file not shown.

Examples/Logging/JSON files/main_rickroll.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def get(st):
1919

2020
servers = [
2121
fw.GUILD(
22-
guild_id=12345,
23-
messages_to_send=[
22+
snowflake=12345,
23+
messages=[
2424
fw.TextMESSAGE(None, 5, get(rolls.copy()), [12345], "edit", True)
2525
],
26-
generate_log=True
26+
logging=True
2727
)
2828
]
2929

Examples/Logging/SQL Logging/main_rickroll.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def get(st):
1919

2020
servers = [
2121
fw.GUILD(
22-
guild_id=12345,
23-
messages_to_send=[
22+
snowflake=12345,
23+
messages=[
2424
fw.TextMESSAGE(None, 5, get(rolls.copy()), [12345], "edit", True)
2525
],
26-
generate_log=True
26+
logging=True
2727
)
2828
]
2929

Examples/Message Types/DirectMESSAGE/main_data_function.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def get_data(parameter):
1515

1616
guilds = [
1717
framework.USER(
18-
user_id=123456789, # ID of server (guild)
19-
messages_to_send=[ # List MESSAGE objects
18+
user_id=123456789, # ID of server (guild) or a discord.Guild object
19+
messages=[ # List MESSAGE objects
2020
framework.DirectMESSAGE(
2121
start_period=None, # If None, messages will be send on a fixed period (end period)
2222
end_period=15, # If start_period is None, it dictates the fixed sending period,
@@ -29,7 +29,7 @@ def get_data(parameter):
2929
start_now=True # Start sending now (True) or wait until period
3030
),
3131
],
32-
generate_log=True ## Generate file log of sent messages (and failed attempts) for this user
32+
logging=True ## Generate file log of sent messages (and failed attempts) for this user
3333
)
3434
]
3535

Examples/Message Types/DirectMESSAGE/main_send_embed.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
############################################################################################
4242
guilds = [
4343
fw.USER(
44-
user_id=123456789, # ID of server (guild)
45-
messages_to_send=[ # List MESSAGE objects
44+
user_id=123456789, # ID of server (guild) or a discord.Guild object
45+
messages=[ # List MESSAGE objects
4646
fw.DirectMESSAGE(
4747
start_period=None, # If None, messages will be send on a fixed period (end period)
4848
end_period=15, # If start_period is None, it dictates the fixed sending period,
@@ -65,7 +65,7 @@
6565
start_now=True
6666
),
6767
],
68-
generate_log=True ## Generate file log of sent messages (and failed attempts) for this user
68+
logging=True ## Generate file log of sent messages (and failed attempts) for this user
6969
)
7070
]
7171

0 commit comments

Comments
 (0)