Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext import commands
- from discord.ext.commands import Bot
- import threading
- from threading import Thread
- import time
- import os
- import asyncio
- import random
- bot = Bot(command_prefix='$', pm_help=True)
- client = discord.Client()
- def serverCommands():
- while 1==1:
- scommand = input("> ")
- if scommand == "quit":
- os._exit(1)
- bot.command()
- async def game(*, game: str):
- await bot.change_presence(game=discord.Game(name=game))
- await bot.say("Game changed to: " +game)
- @bot.event
- async def on_ready():
- print('CaffeineBot connected through user {0}'.format(bot.user.name))
- s = Thread(target=serverCommands)
- s.start
- @bot.command()
- async def ping():
- "A useless command"
- await bot.say("Pong!")
- @bot.command()
- async def pong():
- "An even more useless command"
- await bot.say("Ping!")
- @bot.command(pass_context=True)
- async def mention(ctx):
- author = discord.User.mention(name=ctx.message.author)
- await bot.say(author)
- @bot.command(pass_context = True)
- async def clear(ctx, number):
- '''Clears previous messages'''
- number = int(number) #Converting the amount of messages to delete to an integer
- counter = 0
- async for x in bot.logs_from(ctx.message.channel, limit = number):
- if counter <= number:
- await bot.delete_message(x)
- counter += 1
- await asyncio.sleep(1.2)
- @bot.command(pass_context=True)
- async def channel(ctx):
- client.create_channel(ctx.message.server, 'test', type=discord.ChannelType.text)
- def startBot():
- bot.run('token')
- u = Thread(target=startBot)
- u.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement