You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3KB

  1. #!/usr/env python
  2. import configparser
  3. import discord
  4. from discord.ext.commands import Bot
  5. from config.config import Config
  6. from cogs import cogs
  7. __version__ = '0.3.6'
  8. settings = configparser.ConfigParser()
  9. settings.read('config/settings.ini')
  10. token = settings["Credentials"]["Token"]
  11. owner_id = settings["RoxBot"]["OwnerID"]
  12. command_prefix = settings["RoxBot"]["CommandPrefix"]
  13. bot = Bot(command_prefix=command_prefix)
  14. con = Config(bot)
  15. def blacklisted(user):
  16. with open("config/blacklist.txt", "r") as fp:
  17. for line in fp.readlines():
  18. if user.id+"\n" == line:
  19. return True
  20. return False
  21. @bot.event
  22. async def on_ready():
  23. # TODO: First part needs to be moved to wait_until_ready
  24. con.config_errorcheck()
  25. print("Discord.py version: "+discord.__version__)
  26. print("Client logged in\n")
  27. await bot.change_presence(game=discord.Game(name="v"+__version__), afk=False)
  28. print("Cods loaded:")
  29. for cog in cogs:
  30. bot.load_extension(cog)
  31. print("{}".format(cog))
  32. print("")
  33. print("Servers I am currently in:")
  34. for server in bot.servers:
  35. print(server)
  36. print("")
  37. @bot.event
  38. async def on_message(message):
  39. if blacklisted(message.author):
  40. return
  41. else:
  42. return await bot.process_commands(message)
  43. if __name__ == "__main__":
  44. bot.run(token)