Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
chatbot/mainFileZ.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
124 lines (87 sloc)
4.62 KB
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
import discord | |
import sys | |
from discord.ext import commands | |
# You could find information about this library in : https://discordpy.readthedocs.io/en/rewrite/api html | |
TOKEN = "NTA5MTI5MDk0MTA2MTg1NzI4.DszP3A.sR0zVBv3EGemz43a7lHFjl4RSek" | |
extensions = ["real API", "Music (1)", "help"] | |
bot = commands.Bot("!") | |
@commands.command | |
async def on_ready(): | |
print(f"Bot is online as {bot.user}") | |
if __name__ == '__main__': #Load extensions from other modules | |
for extension in extensions: | |
try: | |
bot.load_extension(extension) | |
except Exception as error: | |
print(f'{extension} cannot be loaded [{error}]') | |
@bot.event | |
async def on_message(message): | |
print(f"{message.channel}: {message.author}: {message.author.name}: {message.content}") | |
CyberLife_guild = bot.get_guild("server ID") | |
if "hi there" in message.content.lower(): | |
await message.channel.send("HI! :wave:") | |
if "how are you?" in message.content.lower(): | |
await message.channel.send("I am fine.Thanks for asking. :slight_smile:") | |
if "hello" in message.content.lower(): | |
await message.channel.send("Hello!") | |
if "What's your name?" in message.content: | |
await message.channel.send("My name is 77987 bot. :slight_smile:") | |
if "Where are you from?" in message.content: | |
await message.channel.send("I'm from Coventry.") | |
if "Where do you come from?" in message.content: | |
await message.channel.send("I'm designed in Coventry.") | |
if "Who is your best friend?" in message.content: | |
await message.channel.send("You :slight_smile:") | |
if "soccer info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Association_football") | |
if "golf info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Golf") | |
if "basketball info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Basketball") | |
if "boxing info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Boxing") | |
if "cricket info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Cricket") | |
if "tennis info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Tennis") | |
if "athletics info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Sport_of_athletics") | |
if "rugby info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Rugby_football") | |
if "ice hockey info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Ice_hockey") | |
if "volleyball info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Volleyball") | |
if "baseball info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Baseball") | |
if "american football info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/American_football") | |
if "swimming info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Swimming") | |
if "gymnastics info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Gymnastics") | |
if "horse racing info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Horse_racing") | |
if "wrestling info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Wrestling") | |
if "skiing info" in message.content: | |
await message.channel.send("here you go: https://en.wikipedia.org/wiki/Skiing") | |
"""The code below was copied from: https://youtu.be/I3xQcBwjXPc""" | |
if "77987.member_count()" == message.content.lower(): | |
await message.channel.send(f"'''py\n{CyberLife_guild.member_count}'''") | |
elif "77987.community_report()" == message.content.lower(): | |
online = 0 | |
idle = 0 | |
offline = 0 | |
for m in CyberLife_guild.members: | |
if str(m.status) == "online": | |
online += 1 | |
if str(m.status) == "offline": | |
offline += 1 | |
else: | |
idle += 1 | |
await message.channel.send(f"'''Online: {online}.\nIdle/busy/dnd: {idle}.\nOffline : {offline}'''") | |
elif "!logout" == message.content.lower(): | |
await bot.close() | |
sys.exit() | |
bot.run(TOKEN) |