Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- import asyncio
- description = 'a bot'
- verno = '0.1'
- updtinfo = 'Starting up!'
- bot = commands.Bot(command_prefix='\\', description=description)
- #Channels: server_channel
- console = "307250339998990351"
- @bot.event
- async def on_ready():
- print('Logged in as')
- print(bot.user.name)
- print(bot.user.id)
- print('------')
- await bot.change_presence(game=discord.Game(name='101010'))
- await bot.send_message(bot.get_channel(console), 'Booting!')
- await bot.send_message(bot.get_channel(console), 'Version: `' + verno +'`')
- await bot.send_message(bot.get_channel(console), 'Most recent update text: `' + updtinfo + '`')
- def in_console(ctx):
- return (ctx.message.channel == bot.get_channel(console) #console
- #or ctx.message.channel == bot.get_channel()
- )
- @bot.command(pass_context=True)
- async def msg(ctx, rec : discord.User, *msg_in : str):
- if in_console(ctx):
- msg = ' '.join(msg_in)
- chan = discord.PrivateChannel(user=rec)
- await bot.send_message(chan, msg)
- else:
- await bot.delete_message(ctx.message)
- @bot.command(pass_context=True)
- async def say(ctx, chan : discord.Channel, *msg_in : str):
- if in_console(ctx):
- msg = ' '.join(msg_in)
- await bot.send_message(chan, msg)
- else:
- await bot.delete_message(ctx.message)
- @bot.command(pass_context=True)
- async def play(ctx, *game : str):
- if in_console(ctx):
- text_in = ' '.join(game)
- """sets what game the bot is playing"""
- await bot.change_presence(game=discord.Game(name=text_in))
- await bot.say('I am now playing ' + text_in)
- else:
- await bot.delete_message(ctx.message)
- bot.run('token')
Advertisement
Add Comment
Please, Sign In to add comment