Skip to content

Instantly share code, notes, and snippets.

@JDJGInc
Last active April 2, 2024 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JDJGInc/5607b3f63f651d2232a25b305aea4d33 to your computer and use it in GitHub Desktop.
Save JDJGInc/5607b3f63f651d2232a25b305aea4d33 to your computer and use it in GitHub Desktop.
Some information about bot setup and how it works.
#Bot Setup
#guide for those who want to fork some of the bot's command.
Please use my code for a learning guide, do not copy commands.
When you see os.environ["tenor_key"]
Env is loaded by default on services that see the .env file as a secret file, however you can just load it with python-dotenv or replace the text with a string
you get a key from the tenor api key from https://tenor.com/developer/keyregistration
a giphy key like os.environ["giphy_key"]
make a key on https://developers.giphy.com/dashboard/
(I will not provide you with my api keys, do not ask me about them, if you need help adding them properly you may ask, but I will not provide you mine or make one for you, do not ask me to make you an api key for you.)
os.environ["image_api_key"] uses
https://developers.google.com/custom-search/v1/overview
os.environ["google_image_key"] use:
make a key on https://cse.google.com/cse/all
some settings:
https://i.imgur.com/wJYEb1e.png
Name this something you want, prefarbly without profanity.
I censored my own codes, because I do not want you use to my custom search, copy to clipboard for the code(this is highlighted)
turn image search on, it's nice. Turn on Safe Search. Language English, unless you use a different language for your bot.
https://i.imgur.com/eHYlqcC.png
You do not need to search a specific site, just don't instead search the internet like how google does.
There you go.
bot.session or client.session is for a bot subclass, ask discord.py or your local fork what this means.
But basically we are adding a custom session to the class.
I would urge you to ask for an example in discord.py (yes the main server or the one right now)
```python
class MyBot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
async def start(self, *args, **kwargs):
self.session = aiohttp.ClientSession()
#doesn't intefer with the main bot's session as the bot uses http_session
await super().start(*args, **kwargs)
async def close(self):
await self.session.close()
await super().close()
bot = MyBot()
```
You should be using bot, as it's commands.Bot and client doesn't have built in error handling, it's easier to tell which is which which is why people in the discord.py guild do it like this, just replace commands.Bot with your bot name, my bot uses JDBot I believe, Yep it does.
Don't copy my code word for word, make it your own unique code, let me see your changes, I may enjoy your yours, if you want you can even make an issue in my github about something you want changed(not removal of commands), unless it infrigres the actual rights of you.
(it likely won't)
Anyway, if you want to help me with commands, you can pull request them, and If you want to you can help me write or suggest new commands.
Anything related to Database could be asked to me, or someone could anylaze my code, if you have trouble reading my code.
pip install black, then run
```black .``` on the top folder.
I code weirdly, I am not a fan of pep8.
If you don't have a top.gg api key for the Cog DSLCount, you can always not include this until you get one.
topgg_key is the key for this, a disforge_key is required for the os.environ of that value.
botlist_eu_key is required for the bolist_eu to appear, again if you don't have these remove the variables or ask me to fork it and provide you the forked copy.
For the reddit api you need the reddit_client_id , reddit_client_secret, reddit_password, reddit_username
you also need the tweet_key, tweet_secret, tweet_access, tweet_token
I would rather not find all the stuff, just ask the library I use(which isn't hard to find out, how to get this info, or contact me when I am avaible)
classic_token is bot token, where you can get it from discord's portal.
clever_bot is from the travapi.
webhook1 and webhook99 are my own webhooks, they are meant for updating.
Paginator was made by Soheab_#6240!
https://github.com/iDevision/enhanced-discord.py/pull/109
Yes I got permission to use it.
For Legal Reasons, pycord if you have any issue with my paginator contact Soheab, he's the one who made the paginator.
Anyway, the github_token was from the personal token, page, you can go there if you want(make sure to use your **own** new account meant for your bot.
I only gave mine gist permissions, that's it.
For more information ask me on discord:
JDJG Inc. Official#3493
https://discord.com/users/168422909482762240
id: 168422909482762240
@JDJGInc
Copy link
Author

JDJGInc commented Apr 2, 2024

Rtfm uses master for now, in the future it will use the default however that's not exactly needed

@JDJGInc
Copy link
Author

JDJGInc commented Apr 2, 2024

for rtfm you can use this:

[
    {
        "name": "master",
        "link": "https://discordpy.readthedocs.io/en/latest/"
    },
    {
        "name": "tweepy",
        "link": "https://docs.tweepy.org/en/latest/"
    },
    {
        "name": "aiogifs",
        "link": "https://aiogifs.readthedocs.io/en/latest/"
    },
    {
        "name": "python-cse",
        "link": "https://python-cse.readthedocs.io/en/latest/"
    },
    {
        "name": "wavelink",
        "link": "https://wavelink.readthedocs.io/en/latest/"
    },
    {
        "name": "motor",
        "link": "https://motor.readthedocs.io/en/stable/"
    },
    {
        "name": "dagpi",
        "link": "https://asyncdagpi.readthedocs.io/en/latest/"
    },
    {
        "name": "pymongo",
        "link": "https://pymongo.readthedocs.io/en/stable/"
    },
    {
        "name": "aiohttp",
        "link": "https://docs.aiohttp.org/en/stable/"
    },
    {
        "name": "wand",
        "link": "https://docs.wand-py.org/en/stable/"
    },
    {
        "name": "pillow",
        "link": "https://pillow.readthedocs.io/en/stable/"
    },
    {
        "name": "aiosqlite",
        "link": "https://aiosqlite.omnilib.dev/en/stable/"
    },
    {
        "name": "pytube",
        "link": "https://pytube.io/en/latest/"
    },
    {
        "name": "black",
        "link": "https://black.readthedocs.io/en/stable/"
    },
    {
        "name": "asyncpraw",
        "link": "https://asyncpraw.readthedocs.io/en/latest/"
    },
    {
        "name": "python",
        "link": "https://docs.python.org/3/"
    },
    {
        "name": "latest",
        "link": "https://discordpy.readthedocs.io/en/stable/"
    },
    {
        "name": "jishaku",
        "link": "https://jishaku.readthedocs.io/en/latest/"
    },
    {
        "name": "asyncpg",
        "link": "https://magicstack.github.io/asyncpg/current/"
    },
    {
        "name": "rapidfuzz",
        "link": "https://maxbachmann.github.io/RapidFuzz/"
    },
    {
        "name": "numpy",
        "link": "https://numpy.org/doc/stable/"
    },
    {
        "name": "aioredis",
        "link": "https://aioredis.readthedocs.io/en/latest/"
    },
    {
        "name": "emoji",
        "link": "https://carpedm20.github.io/emoji/docs/"
    },
    {
        "name": "fonttools",
        "link": "https://fonttools.readthedocs.io/en/latest/"
    },
    {
        "name": "click",
        "link": "https://click.palletsprojects.com/en/8.1.x/"
    }
]

@JDJGInc
Copy link
Author

JDJGInc commented Apr 2, 2024

You should able to load that in json.dumps and it should be immediatetly a list within python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment