Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from datetime import *
- from dateutil.relativedelta import *
- bot = commands.Bot(command_prefix='!')
- bot.remove_command("help")
- @bot.event
- async def on_ready():
- print('Logged in as')
- print(bot.user.name)
- print(bot.user.id)
- print('------')
- @bot.event
- async def on_message(message):
- if message.content == 'There are **Unknown** remaining until the Cabal invasion and the destruction of The Tower. Eyes up, guardian.':
- await bot.delete_message(message)
- await bot.process_commands(message)
- @bot.group(pass_context=True)
- async def countdown(ctx):
- if ctx.invoked_subcommand is None:
- await bot.say('!countdown <weekly/daily/xur>')
- @countdown.command(name='weekly')
- async def weekly():
- now = datetime.now()
- today = date.today()
- nextTue = today+relativedelta(weekday=TU(+2), hour = 19)
- reset = nextTue - now
- totalSeconds = reset.total_seconds()
- timeTil = datetime(1,1,1) + timedelta(seconds = totalSeconds)
- days = timeTil.day-7
- hours = timeTil.hour
- minutes = timeTil.minute
- seconds = timeTil.second
- await bot.say('The weekly reset is in ' + str(days) + ' days, ' + str(hours) + ' hours, ' + str(minutes) + ' minutes, and ' + str(seconds) + ' seconds.')
- @countdown.command(name='xur')
- async def xur():
- now = datetime.now()
- today = date.today()
- nextTue = today+relativedelta(weekday=FR(+2), hour = 19)
- reset = nextTue - now
- totalSeconds = reset.total_seconds()
- timeTil = datetime(1,1,1) + timedelta(seconds = totalSeconds)
- days = timeTil.day-7
- hours = timeTil.hour
- minutes = timeTil.minute
- seconds = timeTil.second
- await bot.say('Xur arrives in ' + str(days) + ' days, ' + str(hours) + ' hours, ' + str(minutes) + ' minutes, and ' + str(seconds) + ' seconds.')
- @countdown.command(name='daily')
- async def daily():
- now = datetime.now()
- today = date.today()
- if now.hour > 19:
- nextTue = today+relativedelta(hour = 19)
- nextTue += timedelta(days=1)
- else:
- nextTue = today+relativedelta(hour = 19)
- reset = nextTue - now
- totalSeconds = reset.total_seconds()
- timeTil = datetime(1,1,1) + timedelta(seconds = totalSeconds)
- hours = timeTil.hour
- minutes = timeTil.minute
- seconds = timeTil.second
- await bot.say('The daily reset is in ' + str(hours) + ' hours, ' + str(minutes) + ' minutes, and ' + str(seconds) + ' seconds.')
- @bot.group(pass_context=True)
- async def platform(ctx):
- if ctx.invoked_subcommand is None:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- @platform.command(pass_context=True, name ='join')
- async def join(ctx):
- content = ctx.message.content.lower().split()
- if len(content) >= 3:
- if content[2] == 'pc':
- await bot.say("Added to platform PC")
- currentServer = ctx.message.server
- pcRole = discord.utils.get(currentServer.roles, name="PC")
- await bot.add_roles(ctx.message.author, pcRole)
- elif content[2] == 'xbox':
- await bot.say("Added to platform Xbox")
- currentServer = ctx.message.server
- xboxRole = discord.utils.get(currentServer.roles, name="Xbox")
- await bot.add_roles(ctx.message.author, xboxRole)
- elif content[2] == 'playstation':
- await bot.say("Added to platform Playstation")
- currentServer = ctx.message.server
- playstationRole = discord.utils.get(currentServer.roles, name="Playstation")
- await bot.add_roles(ctx.message.author, playstationRole)
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- @platform.command(pass_context=True, name ='leave')
- async def leave(ctx):
- content = ctx.message.content.lower().split()
- if len(content) >= 3:
- if content[2] == 'pc':
- await bot.say("Removed from platform PC")
- currentServer = ctx.message.server
- pcRole = discord.utils.get(currentServer.roles, name="PC")
- await bot.remove_roles(ctx.message.author, pcRole)
- elif content[2] == 'xbox':
- await bot.say("Removed from platform Xbox")
- currentServer = ctx.message.server
- xboxRole = discord.utils.get(currentServer.roles, name="Xbox")
- await bot.remove_roles(ctx.message.author, xboxRole)
- elif content[2] == 'playstation':
- await bot.say("Removed from platform Playstation")
- currentServer = ctx.message.server
- playstationRole = discord.utils.get(currentServer.roles, name="Playstation")
- await bot.remove_roles(ctx.message.author, playstationRole)
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- #Test bot id
- #bot.run("MzU1OTYwMDgxODUxODc1MzMw.DJUZLQ.c8s7v0OxhKlHcOMW4Cy3P-c9Bbk")
- #Ember bot id
- bot.run("MzM4MTYxMzgyMTY1OTcwOTQ0.DJUhGA.FGsVKs7uqsv1TdJIybe1CJHDdoY")
- import discord
- from discord.ext import commands
- from datetime import *
- from dateutil.relativedelta import *
- bot = commands.Bot(command_prefix='!')
- bot.remove_command("help")
- @bot.event
- async def on_ready():
- print('Logged in as')
- print(bot.user.name)
- print(bot.user.id)
- print('------')
- @bot.event
- async def on_message(message):
- if message.content == 'There are **Unknown** remaining until the Cabal invasion and the destruction of The Tower. Eyes up, guardian.':
- await bot.delete_message(message)
- await bot.process_commands(message)
- @bot.group(pass_context=True)
- async def countdown(ctx):
- if ctx.invoked_subcommand is None:
- await bot.say('!countdown <weekly/daily/xur>')
- @countdown.command(name='weekly')
- async def weekly():
- now = datetime.now()
- today = date.today()
- nextTue = today+relativedelta(weekday=TU(+2), hour = 19)
- reset = nextTue - now
- totalSeconds = reset.total_seconds()
- timeTil = datetime(1,1,1) + timedelta(seconds = totalSeconds)
- days = timeTil.day-7
- hours = timeTil.hour
- minutes = timeTil.minute
- seconds = timeTil.second
- await bot.say('The weekly reset is in ' + str(days) + ' days, ' + str(hours) + ' hours, ' + str(minutes) + ' minutes, and ' + str(seconds) + ' seconds.')
- @countdown.command(name='xur')
- async def xur():
- now = datetime.now()
- today = date.today()
- nextTue = today+relativedelta(weekday=FR(+2), hour = 19)
- reset = nextTue - now
- totalSeconds = reset.total_seconds()
- timeTil = datetime(1,1,1) + timedelta(seconds = totalSeconds)
- days = timeTil.day-7
- hours = timeTil.hour
- minutes = timeTil.minute
- seconds = timeTil.second
- await bot.say('Xur arrives in ' + str(days) + ' days, ' + str(hours) + ' hours, ' + str(minutes) + ' minutes, and ' + str(seconds) + ' seconds.')
- @countdown.command(name='daily')
- async def daily():
- now = datetime.now()
- today = date.today()
- if now.hour > 19:
- nextTue = today+relativedelta(hour = 19)
- nextTue += timedelta(days=1)
- else:
- nextTue = today+relativedelta(hour = 19)
- reset = nextTue - now
- totalSeconds = reset.total_seconds()
- timeTil = datetime(1,1,1) + timedelta(seconds = totalSeconds)
- hours = timeTil.hour
- minutes = timeTil.minute
- seconds = timeTil.second
- await bot.say('The daily reset is in ' + str(hours) + ' hours, ' + str(minutes) + ' minutes, and ' + str(seconds) + ' seconds.')
- @bot.group(pass_context=True)
- async def platform(ctx):
- if ctx.invoked_subcommand is None:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- @platform.command(pass_context=True, name ='join')
- async def join(ctx):
- content = ctx.message.content.lower().split()
- if len(content) >= 3:
- if content[2] == 'pc':
- await bot.say("Added to platform PC")
- currentServer = ctx.message.server
- pcRole = discord.utils.get(currentServer.roles, name="PC")
- await bot.add_roles(ctx.message.author, pcRole)
- elif content[2] == 'xbox':
- await bot.say("Added to platform Xbox")
- currentServer = ctx.message.server
- xboxRole = discord.utils.get(currentServer.roles, name="Xbox")
- await bot.add_roles(ctx.message.author, xboxRole)
- elif content[2] == 'playstation':
- await bot.say("Added to platform Playstation")
- currentServer = ctx.message.server
- playstationRole = discord.utils.get(currentServer.roles, name="Playstation")
- await bot.add_roles(ctx.message.author, playstationRole)
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- @platform.command(pass_context=True, name ='leave')
- async def leave(ctx):
- content = ctx.message.content.lower().split()
- if len(content) >= 3:
- if content[2] == 'pc':
- await bot.say("Removed from platform PC")
- currentServer = ctx.message.server
- pcRole = discord.utils.get(currentServer.roles, name="PC")
- await bot.remove_roles(ctx.message.author, pcRole)
- elif content[2] == 'xbox':
- await bot.say("Removed from platform Xbox")
- currentServer = ctx.message.server
- xboxRole = discord.utils.get(currentServer.roles, name="Xbox")
- await bot.remove_roles(ctx.message.author, xboxRole)
- elif content[2] == 'playstation':
- await bot.say("Removed from platform Playstation")
- currentServer = ctx.message.server
- playstationRole = discord.utils.get(currentServer.roles, name="Playstation")
- await bot.remove_roles(ctx.message.author, playstationRole)
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- else:
- await bot.say('!platform <join/leave> <xbox/playstation/pc>')
- #Test bot id
- #bot.run("MzU1OTYwMDgxODUxODc1MzMw.DJUZLQ.c8s7v0OxhKlHcOMW4Cy3P-c9Bbk")
- #Ember bot id
- bot.run("MzM4MTYxMzgyMTY1OTcwOTQ0.DJUhGA.FGsVKs7uqsv1TdJIybe1CJHDdoY")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement