Browse Source

Formatting changes here and there and blacklist check added to twitch shilling.

tags/v0.3.0
roxie 7 years ago
parent
commit
b7d0043cb4
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      main.py

+ 7
- 7
main.py View File

# RoxBot # RoxBot
# Version = 1.2
# Version = 1.1
# Author = Roxxers # Author = Roxxers


############## ##############
# TODO: Move away from using ID's for everthing. Maybe replace list with dict # TODO: Move away from using ID's for everthing. Maybe replace list with dict
# TODO: Add check for no channel id when a module is enabled # TODO: Add check for no channel id when a module is enabled


# Fixed bug with blacklist remove options. So that any option not '+' or 'add' is no longer accepted as the remove option.
# Optimised removerole command
# New names for some commands so it is easier to know what module they change.
# Twitch Shilling
# Fixed major bug with the owner only commands


import json import json
import random import random
print("Servers I am currently in:") print("Servers I am currently in:")
for server in bot.servers: for server in bot.servers:
print(server) print(server)
print("")




@bot.event @bot.event
async def on_member_update(member_b, member_a): async def on_member_update(member_b, member_a):
# Twitch Shilling Part # Twitch Shilling Part
if blacklisted(member_b):
return

ts_enabled = config[member_a.server.id]["twitch_shilling"]["enabled"] ts_enabled = config[member_a.server.id]["twitch_shilling"]["enabled"]
if ts_enabled: if ts_enabled:
if not config[member_a.server.id]["twitch_shilling"]["whitelist"]["enabled"] or member_a.id in config[member_a.server.id]["twitch_shilling"]["whitelist"]["list"]: if not config[member_a.server.id]["twitch_shilling"]["whitelist"]["enabled"] or member_a.id in config[member_a.server.id]["twitch_shilling"]["whitelist"]["list"]:
if member_a.game: if member_a.game:
if member_a.game.type: if member_a.game.type:
channel = discord.Object(config[member_a.server.id]["twitch_shilling"]["twitch-channel"]) channel = discord.Object(config[member_a.server.id]["twitch_shilling"]["twitch-channel"])
return await bot.send_message(channel, content=":video_game:**{} is live!**:video_game:\n {}\n{}".format(member_a.name, member_a.game.name, member_a.game.url))
return await bot.send_message(channel, content=":video_game:** {} is live!** :video_game:\n {}\n{}".format(member_a.name, member_a.game.name, member_a.game.url))




@bot.event @bot.event
elif option == 'list': elif option == 'list':
return await bot.say(config[ctx.message.server.id]["twitch_shilling"]["whitelist"]["list"]) return await bot.say(config[ctx.message.server.id]["twitch_shilling"]["whitelist"]["list"])



if __name__ == "__main__": if __name__ == "__main__":
config = load_config() config = load_config()
bot.run(token) bot.run(token)

Loading…
Cancel
Save