From 896d2a979c2ae5777785ee6e113daadd7e2149b2 Mon Sep 17 00:00:00 2001 From: Denis Emrulov Date: Thu, 29 Nov 2018 16:18:08 +0000 Subject: [PATCH] new file --- mainFileZ.py | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 mainFileZ.py diff --git a/mainFileZ.py b/mainFileZ.py new file mode 100644 index 0000000..ca0e8d6 --- /dev/null +++ b/mainFileZ.py @@ -0,0 +1,124 @@ +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) \ No newline at end of file