Example #1
0
 def init(bot, token=None):
     '''Starts the actual bot'''
     selfbot = bot()
     safe_token = token or selfbot.token.strip('\"')
     try:
         selfbot.run(safe_token, bot=False, reconnect=True)
     except Exception as e:
         print(e)
Example #2
0
import discord
from discord.ext import commands

client = commands.bot(command_prefix=">")


@client.event
async def on_ready():
    print("I am ON")


@client.command()
async def hello(ctx):
    await ctx.send("hello")


client.run("NzU5MDI4MDMyODcwMjg1NDA1.X23h8Q.AzEK2pn6_CCRwFmQlOUiWNyDsVM")
Example #3
0
import discord
from discord.ext import commands, tasks

from random import choice

clients = commands.bot(command_prefix="ur command")

status = ["github.com/JustD09"]
queue = []

@client.event
async def on_ready():
    change_status_start()
    print("Bot Is Online")

@client.event
async def on_member_join():
    channel = discord.utils.get(member.guild.channels, name="general")

@client.command(aliases="S")
async def serverstats(ctx):
    embed=discord.Embed(title=f"Stats Server {ctx.guild.name}")
    embed.add_field(name="Users:", value=ctx.guild.member_count, inline=False)
    embed.add_field(name="Channels:", value=len(ctx.guild.channels), inline=False)
    embed.add_field(name="Messages sent:", value=messagecounts[ctx.guild.id], inline=False)
    await ctx.send(embed=embed)

@client.event
async def on_message(message):
    if message.guild.id not in messagecount.keys():
        messagecounts[message.guild.id] = 0
Example #4
0
import discord
from discord.ext import commands

client = commands.bot(commands_prefix="!")

client.run("NTY3NDMwMzg1MDkzNTc0NjU4.XLThzg.VSmwlZp0oXCsg7lQhswLIozo_Qw")
Example #5
0
import discord
import pdb;
from discord.ext import commands
import random
TOKEN = ""


desc='''This is bot.
これはbotです'''

pdb.set_trace()
client = commands.bot(command_prefix = '!',description=desc)

@client.event
async def on_ready():
    print('Logget in as')
    print('BOT-NAME :',client.user.name)
    print('BOT-ID   :',client.user.id)
    print('-------')




@client.command()
async def command(team):
    return message.split(' ')[0]
cmd = command(message.content)
if cmd ==('team'):

@client.event
async def on_message(message):
Example #6
0
import discord
from discord.ext import commands

bot = commands.bot(commands_prefix="[")


@bot.event
async def on_ready():
    print("bot is online")


bot.run(Njg1NjkyMzg5NzQyMjE1MzEz.XmMkjA.f6 - Ec7YfPo4eYQWUS40gwsNJEaA)
Example #7
0
import discord
from discord.ext import commands

client = commands.bot(command_prefix="Your bot's Prefix")


@client.event
async def on_ready():
    print("The bot is ready.")

# if the bot is ready it will send the message below


@client.event
async def on_member_join(member):
    print(f"{member} has joined a server.")


@client.event
async def on_member_remove(member):
    print(f"{member} has left a server.")


client.run("Your bot's token")
Example #8
0
import discord.py
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio
import os 

Client = discord.Client ()
client = commands.bot(command_prefix='m.')
@client.event
async def on_ready() :
     print("Bot has been launched!")
     await client.change_presence(game=discord.Game(name="New me on Python"))
    
@client.event
async def on_message(message) :
  if message.content.startswith('m.python') :
  message = await client.send_message(message.channel, 'I am an Discord Bot powered by Python (3.6.7)')
  
  client.run(os.getenv(SECRET))
  
Example #9
0
class BamboozledTest:
    """ 0.3 Expand the emotional spectrum (maybe will use union)
        -   1 - 10 = ANGER
            + 1. HURT
            + 2. THREATENED
            + 3. HATEFUL
            + 4. MAD
            + 5. AGGRESSIVE
            + 6. FRUSTRATED
            + 7. DISTANT
            + 8. CRITICAL        
        -   11 - 20 = FEAR
        -   21 - 30 = HAPPY         JOYFUL + POWERFUL + PEACEFUL
        -   31 - 40 = SURPRISE
        -   41 - 50 = DISGUST
        -   51 - 60 = SAD       


        Avoid using: N/A
        Arguments: N/A
        
        0.2 Greeting accordance to 6 basic moods
        -   1 = MAD
        -   2 = SCARED
        -   3 = JOYFUL
        -   4 = POWERFUL
        -   5 = PEACEFUL
        -   6 = SAD
        0.1. class Lamb will now prompt a user greeting for now        
    """

    def __init__(self,
                 bot):  # view:python3 is good, view: python is bad for sublime
        self.bot = bot

    # =============================================================================
    # Types and constants
    # =============================================================================

    """
    # 0.3.
    greeting = [
                    "(╯°□°)╯︵ ┻━┻ GTFO",                                                # 1
                    "༼;´༎ຶ ۝ ༎ຶ༽ *gasp",                                                 # 2
                    "\m/...(>.<)…\m/ └[∵┌]└[ ∵ ]┘[┐∵]┘ OH YEAH, MY DUDE!!!!!",          # 3
                    "<:pikachu:512132390920126474> (・□・;)(」゜ロ゜)」 Σ(゜ロ゜;)"             # 4
                    " щ(゜ロ゜щ) ┌╏ º □ º ╏┐ NAN-TAH-NOH?(○□○)∴(O艸O★)", 
                    "uhhhhhhh -(≖д≖﹆)"                                ,                # 5
                    "\"( _ _ \")\" oh....kay"                                             # 6
                ]
    old greeting

    """
    # 0.2.
    uwu_greeting = [
                    "(╯°□°)╯︵ ┻━┻ WHO WOKE ME UP!!!???", 
                    "༼;´༎ຶ ۝ ༎ຶ༽ I WUV YOU WHOA~~~~~~~",
                    "\m/...(>.<)…\m/ └[∵┌]└[ ∵ ]┘[┐∵]┘ HOWDY, MY DUDE!!!!!",
                    "( ︶︿︶)_╭∩╮", 
                    "| (• ◡•)| (❍ᴥ❍ʋ ) what's up, mah homie!!??",
                    "\"( Ó_Ò \")\" h...hi......."
                ]

    uwu_mood = [
                    "(╯°□°)╯︵ ┻━┻ GTFO", 
                    "༼;´༎ຶ ۝ ༎ຶ༽ *gasp",
                    "\m/...(>.<)…\m/ └[∵┌]└[ ∵ ]┘[┐∵]┘ OH YEAH, MY DUDE!!!!!",
                    "( ︶︿︶)_╭∩╮ <:pikachu:512132390920126474>", 
                    "| (• ◡•)| (❍ᴥ❍ʋ ) darn right, mah homie!",
                    "\"( Ó_Ò \")\" oh....kay"
                ]
    # =============================================================================

    # =============================================================================
    # Trigger commands
    # =============================================================================    
    bot = commands.bot(command_prefix="sure ")
    # =============================================================================    


    async def on_message(self, message):
        """Defines bot behavior when a message is posted to channel"""

        activate_emoji = "<:thonking:455992031752355870> "
        if message.content.startswith(activate_emoji):
            # convert the result to bot class => ctx = bot.context
            ctx = await self.bot.get_context(message)

            # make sure others can use more than 1 emoji without triggering uwu
            #   repeat_count = 0
            #for index in xrange(1,10):
            #    if ctx[index] == <:thonking:455992031752355870>:
            #        repeat_count++; 
            
            mood = random.randint(1, 6)               # generate a random mood like
                                                      # my cousin's wife
            await ctx.send(self.uwu_mood[mood-1])     # we can use ctx.send

    @commands.command()
    async def ciao(self, ctx):
        """ 0.2. Greeting accordance to mood
            0.1. Saying "hello"
        """


        mood = random.randint(1, 6)
        await ctx.send(self.uwu_greeting[mood - 1])  # array max index is n -1

    @commands.command()
    async def sure(self, ctx, *args):
        """ 0.1. Spongebod Bob mocking tone

            Argument: message
        """
        """
        mocking = message
        mocking = mocking.lower()
        for index in mocking:
            mocking[index] = mocking[index].upper()
        """
        """
        activate_line = "sure "
        mocking = message
        if message.content.startswith(activate_line):
            ctx = await self.bot.get_context(message)
            await ctx.send(mocking)
        """
        await ctx.send(args)
Example #10
0
import discord
from discord.ext import commands
import os

#---- YOU CAN INPUT UR PREFIX HERE ----#
bot = commands.bot(command_prefix="PREFIX HERE")

#---- SIGNS IF THE BOT / CLIENT IS ONLINE ----#
@bot.event
async def on_ready():
    print(f"{bot.user.name} Has Logged in)

#---- CREATE UR FIRST COMMAND ----#
@bot.command()
async def ping(ctx):
    await ctx.send(f":ping_pong: Pong!, bot latency is {found(bot.latency *1000)} ms")

token = os.environ["TOKEN"] 
#---- YOU CAN INPUT TOKEN ON (token) IF YOU WANT ----#
bot.run(token)