redstonetehnik

Untitled

Apr 27th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. import discord
  2. from discord.ext import commands
  3. import asyncio
  4.  
  5. description = 'a bot'
  6. verno       = '0.1'
  7. updtinfo    = 'Starting up!'
  8.  
  9.  
  10. bot = commands.Bot(command_prefix='\\', description=description)
  11.  
  12. #Channels: server_channel
  13. console = "307250339998990351"
  14.  
  15.  
  16. @bot.event
  17. async def on_ready():
  18.     print('Logged in as')
  19.     print(bot.user.name)
  20.     print(bot.user.id)
  21.     print('------')
  22.     await bot.change_presence(game=discord.Game(name='101010'))
  23.     await bot.send_message(bot.get_channel(console), 'Booting!')
  24.     await bot.send_message(bot.get_channel(console), 'Version: `' + verno +'`')
  25.     await bot.send_message(bot.get_channel(console), 'Most recent update text: `' + updtinfo + '`')
  26.  
  27.  
  28.  
  29. def in_console(ctx):
  30.     return (ctx.message.channel == bot.get_channel(console) #console
  31.             #or ctx.message.channel == bot.get_channel()
  32.             )
  33.  
  34.  
  35. @bot.command(pass_context=True)
  36. async def msg(ctx, rec : discord.User, *msg_in : str):
  37.     if in_console(ctx):
  38.         msg = ' '.join(msg_in)
  39.         chan = discord.PrivateChannel(user=rec)
  40.         await bot.send_message(chan, msg)
  41.     else:
  42.         await bot.delete_message(ctx.message)
  43.  
  44.  
  45. @bot.command(pass_context=True)
  46. async def say(ctx, chan : discord.Channel, *msg_in : str):
  47.     if in_console(ctx):
  48.         msg = ' '.join(msg_in)
  49.         await bot.send_message(chan, msg)
  50.     else:
  51.         await bot.delete_message(ctx.message)
  52.  
  53. @bot.command(pass_context=True)
  54. async def play(ctx, *game : str):
  55.     if in_console(ctx):
  56.         text_in = ' '.join(game)
  57.         """sets what game the bot is playing"""
  58.         await bot.change_presence(game=discord.Game(name=text_in))
  59.         await bot.say('I am now playing ' + text_in)
  60.     else:
  61.         await bot.delete_message(ctx.message)
  62.  
  63.  
  64. bot.run('token')
Advertisement
Add Comment
Please, Sign In to add comment