Last active
July 1, 2024 16:56
-
-
Save JDJGInc/5607b3f63f651d2232a25b305aea4d33 to your computer and use it in GitHub Desktop.
Some information about bot setup and how it works.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please view example.env for an explanation as to what it does.