This file contains hidden or 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
| # IMPORT DISCORD.PY. ALLOWS ACCESS TO DISCORD'S API. | |
| import discord | |
| # GETS THE CLIENT OBJECT FROM DISCORD.PY. CLIENT IS SYNONYMOUS WITH BOT. | |
| bot = discord.Client() | |
| # EVENT LISTENER FOR WHEN THE BOT HAS SWITCHED FROM OFFLINE TO ONLINE. | |
| @bot.event | |
| async def on_ready(): | |
| # CREATES A COUNTER TO KEEP TRACK OF HOW MANY GUILDS / SERVERS THE BOT IS CONNECTED TO. |
This file contains hidden or 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
| # Import the os module. | |
| import os | |
| # Import load_dotenv function from dotenv module. | |
| from dotenv import load_dotenv | |
| # Loads the .env file that resides on the same level as the script. | |
| load_dotenv() | |
| # Grab the API token from the .env file. | |
| DISCORD_TOKEN = os.getenv("DISCORD_TOKEN") |
This file contains hidden or 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
| # IMPORT DISCORD.PY. ALLOWS ACCESS TO DISCORD'S API. | |
| import discord | |
| # IMPORT THE OS MODULE. | |
| import os | |
| # IMPORT LOAD_DOTENV FUNCTION FROM DOTENV MODULE. | |
| from dotenv import load_dotenv | |
| # LOADS THE .ENV FILE THAT RESIDES ON THE SAME LEVEL AS THE SCRIPT. |
This file contains hidden or 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
| # IMPORT DISCORD.PY. ALLOWS ACCESS TO DISCORD'S API. | |
| import discord | |
| # IMPORT THE OS MODULE. | |
| import os | |
| # IMPORT LOAD_DOTENV FUNCTION FROM DOTENV MODULE. | |
| from dotenv import load_dotenv | |
| # IMPORT COMMANDS FROM THE DISCORD.EXT MODULE. |
This file contains hidden or 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.command() | |
| async def print(ctx, *args): | |
| response = "" | |
| for arg in args: | |
| response = response + " " + arg | |
| await ctx.channel.send(response) |
This file contains hidden or 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.command( | |
| help="Uses come crazy logic to determine if pong is actually the correct value or not.", | |
| brief="Prints pong back to the channel." | |
| ) | |
| async def ping(ctx): | |
| await ctx.channel.send("pong") | |
| @bot.command( | |
| help="Looks like you need some help.", | |
| brief="Prints the list of values back to the channel." |
This file contains hidden or 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.event | |
| async def on_message(message): | |
| if message.content == "hello": | |
| await message.channel.send("pies are better than cakes. change my mind.") |
This file contains hidden or 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.event | |
| async def on_message(message): | |
| if message.content == "hello": | |
| await message.channel.send("pies are better than cakes. change my mind.") | |
| await bot.process_commands(message) |
This file contains hidden or 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
| {"lastUpload":"2020-08-08T05:04:10.070Z","extensionVersion":"v3.4.3"} |
This file contains hidden or 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
| # IMPORT DISCORD.PY. ALLOWS ACCESS TO DISCORD'S API. | |
| import discord | |
| # IMPORT THE OS MODULE. | |
| import os | |
| # IMPORT LOAD_DOTENV FUNCTION FROM DOTENV MODULE. | |
| from dotenv import load_dotenv | |
| # IMPORT COMMANDS FROM THE DISCORD.EXT MODULE. |
OlderNewer