Skip to content

Commit

Permalink
Remote control (#323)
Browse files Browse the repository at this point in the history
* Performance improvements

* changelog

* Refactoring

* Remote

* remote

* Connection managers

* Local connection manager

* Fix internal IDs

* JSON transfer

* loggers

* Remote method execution

* serialization

* Fix _daf_id

* window size

* Fix

* confirm

* remote

* connector

* Fix 127

* docs

* remote

* Documentation & Tests

* fix tests

* fix linting

* rollback

* remove default

* Fix Embed serialization

* fix convert

* Convert remote

* Remote generation

* enum convert
  • Loading branch information
davidhozic authored Jun 3, 2023
1 parent 3ee9664 commit c081c69
Show file tree
Hide file tree
Showing 49 changed files with 1,722 additions and 637 deletions.
14 changes: 6 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
=========================================================
Discord Advertisement Framework (Shiller)
Discord Advertisement Framework
=========================================================
The Discord advertisement framework is a Python based **shilling application** that allows automatic advertising (and much more) on Discord.
The Discord advertisement framework is a Python based automatic application that allows **easy automatic advertisement** (and much more) on Discord.


.. image:: ./docs/images/daf-gui-front.png

.. image:: ./docs/images/daf-gui-front-edit-msg.png

---------------
Help
---------------
Need help? Contact me in my `Discord server <https://discord.gg/DEnvahb2Sw>`_.


----------------
Guide / Usage
----------------
Instructions can be found `here <https://daf.davidhozic.com/en/stable/guide/GUI/quickstart.html>`_.

---------------
Help
---------------
Need help? Contact me in my `Discord server <https://discord.gg/DEnvahb2Sw>`_.

----------------------
Key features
Expand Down
Binary file modified docs/images/daf-gui-front-edit-msg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/daf-gui-front.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ Glossary
Releases
----------------------

v2.8
=================

- Remote control though HTTP access:

- The core can be started on a remote server and then connected to and controlled by the graphical interface.
- The GUI now has a dropdown menu where users can select between a local connection client and a remote connection client.
Local connection client won't use the HTTP API, but will start DAF locally and interact with it directly.

- GUI:

- Method execution
- Executing method status window.
- When editing objects, the Y size will now be set to default size every time the frame changes.
- When executing async blocking functions, a progress bar window will be shown to indicate something is happening.

- Logging:

- :class:`daf.logging.LoggerJSON` will create a new file once the current one reaches 100 kilobytes.
- Improved performance of :class:`daf.logging.LoggerJSON`.
- Loggers will now trace their output path, so users can find the output logs more easily.

- State preservation

- When using the state preservation (introduced in :ref:`v2.7`), accounts that fail to login will, from now on,
not be removed from list to prevent data loss.



v2.7
================
Expand Down
6 changes: 3 additions & 3 deletions docs/source/guide/GUI/filegen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Schema backup
.. seealso::
:download:`Download example schema backup (schema.json) <./images/schema.json>`

To save a schema after it has been defined, we can click on the *Load/Save/Generate* button, located in the top left
To save a schema after it has been defined, we can click on the *Schema* button, located in the top left
corner of the *Schema definition* tab and then click the **Save schema** option.

We will be asked for a file location of the schema backup, where the GUI will save backup our schema.
Expand All @@ -37,7 +37,7 @@ We will be asked for a file location of the schema backup, where the GUI will sa

Schema restore
---------------
In case we want to restore a backed-up schema, we can click on the *Load/Save/Generate* button, located in the top left
In case we want to restore a backed-up schema, we can click on the *Schema* button, located in the top left
corner of the *Schema definition* tab and then click the **Load schema** option.

We will be asked for a file location of the schema backup, from which the GUI will load our schema.
Expand All @@ -56,7 +56,7 @@ a computer capable of displaying image.

Luckily DAF-GUI allows use to create a (Python) shilling script in the event that we want to run DAF on a server 24/7.

To generate a shilling script , we can click on the *Load/Save/Generate* button, located in the top left
To generate a shilling script , we can click on the *Schema* button, located in the top left
corner of the *Schema definition* tab and then click the **Generate script** option.
This will open up a file dialog asking us where to save the shilling script.
After we save the location our shilling script will be generated and we
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/guide/GUI/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ This section contains the guide to using the Discord Advertisement Framework ins
schema
live_view
filegen
analytics
analytics
remote
1 change: 1 addition & 0 deletions docs/source/guide/GUI/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ GUI structure
The GUI consists of:

- START and STOP buttons starting and stopping DAF's core,
- Connection type selection (see :ref:`Remote control (GUI)`)
- Optional modules tab - Where you can install optional functionallity
- Schema definition tab - Where you can define accounts, guilds, messages & type of logging:

Expand Down
38 changes: 38 additions & 0 deletions docs/source/guide/GUI/remote.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
======================
Remote control (GUI)
======================
.. versionadded:: 2.8


.. seealso::

This section describes how to set up the GUI to connect to a server.
To find information about setting up the actual server see :ref:`Remote control (core)`.


DAF can run either locally or it can connect to a remote server that is running the
DAF core. Users can choose between these two options by changing the connection client as
shown in picture:

.. image:: ./images/connection-select.png
:width: 1000px

Using ``LocalConnectionCLIENT`` will start DAF locally and anything the users do will be done locally.
Using :class:`~daf_gui.connector.RemoteConnectionCLIENT` will connect to a remote server and anything the users do including adding / removing
accounts, retrieving logs, etc. will be done through a HTTP API which can also be HTTPS (recommended) if desired.


If the *Edit* button is clicked (in the top right corner) and :class:`~daf_gui.connector.RemoteConnectionCLIENT`
is selected, a new window will be opened, which allows customization of connection parameters.


.. image:: ./images/edit-remoteconnectionclient.png

.. autoclass:: daf_gui.connector.RemoteConnectionCLIENT

.. seealso::

When :ref:`generating the DAF core script <Shilling script generation>`,
remote access will also be configured if the :class:`~daf_gui.connector.RemoteConnectionCLIENT` is selected.

Clicking on *Edit* when ``LocalConnectionCLIENT`` is selected will show an error.
4 changes: 2 additions & 2 deletions docs/source/guide/core/autogen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ It can be passed to the framework exactly the same way as |GUILD|
otherwise you will be spammed with warnings and only one guild will be shilled.


.. literalinclude:: ./DEP/Examples/Automatic Generation/autoguild.py
.. literalinclude:: ./DEP/autoguild.py


Automatic channel generation
==============================
For a auto-managed channel list use |AUTOCHANNEL| instances.
It can be passed to xMESSAGE objects into the ``channels`` parameters instead of a list.

.. literalinclude:: ./DEP/Examples/Automatic Generation/autochannel.py
.. literalinclude:: ./DEP/autochannel.py
:caption: AutoCHANNEL example
1 change: 1 addition & 0 deletions docs/source/guide/core/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ words, running it directly by Python and providing all the required information
quickstart
messages
logging
remote
modification
autogen
web
10 changes: 5 additions & 5 deletions docs/source/guide/core/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ All logs will contain keys:
+ :py:meth:`daf.message.DirectMESSAGE.generate_log_context`

.. seealso::
:download:`Example structure <./DEP/Examples/Logging/JSON files/History/2023/04/28/David's py dungeon.json>`
:download:`Example structure <./DEP/David's py dungeon.json>`

.. only:: html

JSON code example
-----------------
.. literalinclude:: ./DEP/Examples/Logging/JSON files/main_rickroll.py
.. literalinclude:: ./DEP/main_rickroll.py
:language: python
:caption: Code to produce JSON logs

Expand Down Expand Up @@ -144,14 +144,14 @@ The structure contains the following attributes:
Attributes marked with ``(json)`` are the same as in :ref:`JSON Logging (file)`

.. seealso::
:download:`Structure example <./DEP/Examples/Logging/CSV files/History/2023/04/28/David's py dungeon.csv>`
:download:`Structure example <./DEP/David's py dungeon.csv>`


.. only:: html

CSV code example
-----------------
.. literalinclude:: ./DEP/Examples/Logging/CSV files/main_rickroll.py
.. literalinclude:: ./DEP/main_rickroll.py
:language: python
:caption: Code to produce JSON logs

Expand Down Expand Up @@ -183,7 +183,7 @@ For daf to use SQL logging, you need to pass the :func:`~daf.core.run` function

.. only:: html

.. literalinclude:: ./DEP/Examples/Logging/SQL Logging/rolls.py
.. literalinclude:: ./DEP/rolls.py
:language: python


Expand Down
6 changes: 3 additions & 3 deletions docs/source/guide/core/messages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ To add these messages to the guild, set the |GUILD| / |USER|'s ``messages`` para

.. only:: html

.. literalinclude:: ./DEP/Examples/Message Types/TextMESSAGE/main_send_multiple.py
.. literalinclude:: ./DEP/main_send_multiple.py
:language: Python
:caption: **TextMESSAGE example - normal text (string)**

.. literalinclude:: ./DEP/Examples/Message Types/DirectMESSAGE/main_send_multiple.py
.. literalinclude:: ./DEP/main_send_multiple.py
:language: Python
:caption: **DirectMESSAGE example - normal text (string)**

Expand All @@ -57,5 +57,5 @@ You can either stream a fixed audio file or a youtube video, both thru :class:`d

.. only:: html

.. literalinclude:: ./DEP/Examples/Message Types/VoiceMESSAGE/main_stream_audio.py
.. literalinclude:: ./DEP/main_stream_audio.py
:caption: **VoiceMESSAGE example - audio file**
6 changes: 3 additions & 3 deletions docs/source/guide/core/modification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The function can be used to add the following object types:
.. only:: html

.. literalinclude:: ./DEP/Examples/Dynamic Modification/main_add_object.py
.. literalinclude:: ./DEP/main_add_object.py
:language: python


Expand All @@ -80,7 +80,7 @@ Objects can be removed with the :func:`daf.core.remove_object`.

.. only:: html

.. literalinclude:: ./DEP/Examples/Dynamic Modification/main_remove_object.py
.. literalinclude:: ./DEP/main_remove_object.py
:language: python


Expand Down Expand Up @@ -129,7 +129,7 @@ For a full list of objects that support ``.update`` search ".update" in the sear

.. only:: html

.. literalinclude:: ./DEP/Examples/Dynamic Modification/main_update.py
.. literalinclude:: ./DEP/main_update.py
:language: python


16 changes: 16 additions & 0 deletions docs/source/guide/core/remote.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
======================
Remote control (core)
======================

.. versionadded:: 2.8

While DAF can run completely standalone locally, it also allows to be run as a server that will accept connections from
a graphical interface (:ref:`Remote control (GUI)`).

The remote module spins up a HTTP server which can also be given a certificate and a private key allowing HTTPS connections.

To set up the core as a remote server, pass the :func:`~daf.core.run` function with the ``remote_client`` parameter.
It accepts an object of type :class:`daf.remote.RemoteAccessCLIENT`.

After the script is ran, DAF will listen and accept connections based on the configured options. While the server is running,
DAF can be used the same way as if there was no server at all.
2 changes: 1 addition & 1 deletion docs/source/guide/core/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ Web feature example
=====================
The following shows an example of both previously described features.

.. literalinclude:: ./DEP/Examples/Web/main_web.py
.. literalinclude:: ./DEP/main_web.py
:language: python
33 changes: 19 additions & 14 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
=========================================================
DAF (|version|)
Discord Advertisement Framework (|version|)
=========================================================
The Discord advertisement framework is a Python based **shilling framework** that allows easy advertising on Discord.
The Discord advertisement framework is a Python based automatic application that allows **easy automatic advertisement** (and much more) on Discord.

.. image:: ./DEP/daf-gui-front.png


---------------------
Links
Expand All @@ -22,30 +25,32 @@ Links
- `PyCord Documentation <https://docs.pycord.dev/en/master/>`_


.. figure:: ./DEP/daf-gui-front.png
:width: 15cm
------------------
Need help?
------------------

Graphical interface (GUI)
- Checkout the guides:

.. figure:: ./DEP/daf-console-run.png
:width: 15cm

Script (for running in console)
- :ref:`Guide (GUI)`
- :ref:`Guide (core)`

- Contact me in my `Discord server <https://discord.gg/DEnvahb2Sw>`_.

----------------------
Key features
----------------------
- Periodic and scheduled advertisements,
- Automatic periodic and scheduled messages to multiple servers and channels,
- Error checking and recovery,
- Message logging, invite link tracking & statistics
- Multi-account support
- Graphical Interface (GUI) / Console (script)
- Easy to setup
- Asynchronous
- Programmatic usage
- Much more


.. caution::
While running this on user accounts is possible, it is against Discord's ToS.
I am not responsible if your account get's disabled for using self-bots!
.. note::
Running on user accounts is against Discord ToS, however DAF still enables it.

----------------------
Installation
Expand Down
2 changes: 2 additions & 0 deletions docs/source/scripts/generate_autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

sys.path.append(os.path.abspath("../../../src"))
os.environ["DOCUMENTATION"] = "True"


import daf


Expand Down
Loading

0 comments on commit c081c69

Please sign in to comment.