Skip to main content

Framework (or bot) that allows you to advertise on discord

Project description

DISCORD ADVERTISEMENT FRAMEWORK (BOT) - DAF

PyPI CodeFactor Grade

The Discord advertisement framework is a tool that allows easy advertising on Discord.

FULL documentation

For documentation see WEBSITE

Key features

  • Periodic advertisement to Direct (Private) Messages, Text channels and Voice channels
  • Advertising with either static data or dynamic data (function call)
  • Logging of send attempts with JSON file logs or to a SQL server (Microsoft SQL Server only).
  • Ability to add additional application layers with help of asyncio
  • Easy to setup

Installation

To install the framework use one of the following:

# Windows
python -m pip install discord-advert-framework
# Windows
py -3 -m pip install discord-advert-framework
# Linux
python3 -m pip install discord-advert-framework

Example

"""
~ Example file ~
This file shows how you can make a script that automatically generates the server
list based on the `allowed_strings` list (contains strings that must appear in the channel name we want to shill into).

We pass the framework a user_callback function named `find_advertisement_channels` which autofills the servers list with GUILD objects.
"""
import framework as fw


# Create a list in which we will automatically add guilds
allowed_strings = {"shill", "advert", "promo"}
data_to_shill = (     # Example data set
                "Hello World", 
                fw.EMBED(title="Example Embed",
                         color=fw.EMBED.Color.blue(),
                         description="This is a test embed")
                )


servers = []

async def find_advertisement_channels():
    # 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
    client = fw.get_client()  
    
    for guild in client.guilds:  # Iterate thru all the guilds where the bot is in
        channels = []
        for channel in guild.text_channels: # Iterate thru all the text channels in the guild
            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
                channels.append(channel.id) # If so, add the channel id to the list
        
        # Add the guild to the internal shilling list
        await fw.core.add_object(   
            fw.GUILD(
                guild.id,                               # Guild id
                [                                       # List of messages
                    fw.TextMESSAGE(None,                    # Start period
                                   5,                       # End period
                                   data_to_shill,           # Data that will be sent
                                   channels,                # List of channels to send the message to            
                                   "send",                  # Sending moode (send, edit, clear-send)
                                   True                     # Should the message be sent immediately after adding it to the list
                    )                                   
                ],
                True                                    # Should the framework generate a log of sent messages for this guild
            )
        )


fw.run(
    token="OSDSJ44JNnnJNJ2NJDBWQUGHSHFAJSHDUQHFDBADVAHJVERAHGDVAHJSVDE",   # Example token
    server_list=servers,
    user_callback=find_advertisement_channels
)

Project details


Release history Release notifications | RSS feed

This version

2.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Discord-Advert-Framework-2.0.2.tar.gz (862.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Discord_Advert_Framework-2.0.2-py3-none-any.whl (976.3 kB view details)

Uploaded Python 3

File details

Details for the file Discord-Advert-Framework-2.0.2.tar.gz.

File metadata

  • Download URL: Discord-Advert-Framework-2.0.2.tar.gz
  • Upload date:
  • Size: 862.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for Discord-Advert-Framework-2.0.2.tar.gz
Algorithm Hash digest
SHA256 82bfac80c74680f48cb9b7c1a54418a0159a3366dececd299337c23ba6ac8167
MD5 ea2fb00df2c3d6d35737a3f75e3d7d20
BLAKE2b-256 01d4184dc6d09d8f94742b66ef1ea90f0c273b59317967b77805f700185d6abe

See more details on using hashes here.

File details

Details for the file Discord_Advert_Framework-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for Discord_Advert_Framework-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9c81f6365b95c22c5e7b61d2caed7c0f3399d8096e99dddfbf0d5d2a5e714218
MD5 a6d4c6b87cbf282e163593709637cdfb
BLAKE2b-256 417678011468c0373c5d43f0b18e04349b6f3494e177b6fa4d7b39be0f98af79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page