Example #1
0
import os
import re
import random
import asyncio
from fuzzywuzzy import fuzz
import discord
import commands

intents = discord.Intents.default()
intents.members = True
intents.reactions = True

client = discord.Client(intents=intents)

bot = commands.Bot()

# main commands
bot.register_command(commands.roll.roll, ["!roll", "!r", "/roll", "/r"],
                     fancy=True)
bot.register_command(commands.roll.roll_simple, ["!d"],
                     fancy=True,
                     require_space=False)
bot.register_command(commands.coc.roll, ["!cocroll", "!coc", "!croll", "!c"])
bot.register_command(commands.coc.roll_multiple, ["!c+"])
bot.register_command(commands.ua.roll, ["!uaroll", "!ua"])
bot.register_command(commands.dark.roll, ["!dark", "!cdark"])
bot.register_command(commands.dg.roll, ["!dgroll", "!dg"])
bot.register_command(commands.mothership.roll_command, ["!mothership", "!ms"])
bot.register_command(commands.npc.generate_npc, ["!npc"], add_footer=False)
bot.register_command(commands.npc.generate_name, ["!names", "!name"],
                     add_footer=False)
Example #2
0
import discord
import commands
import os
import traceback
import random

bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']


@bot.event
async def on_command_error(ctx, error):
    orig_error = getattr(error, "original", error)
    error_msg = ''.join(
        traceback.TracebackException.from_exception(orig_error).format())
    await ctx.send(error_msg)


@client.event
async def on_message(message):
    if "!語録" in message.content:
        word_list = [
            "ブンブンハローRed♪Tube", "SexkinTV♪every day♪", "ひき逃げです",
            "ヒカキンさんのアナ、ゥお借りしたいんです!", "OnakinTV♪every day♪", "ナイチンチンゲール♪",
            "ウンコの力", "ケツの穴が無い!", "パンパンパンパンパン!パンパン!", "メッサムラムラ!?", "ローション!?",
            "最初はブンブンじゃんけん出たー!出た!出たぁ...", "あ~ん!ちゃんち~ん!あっちっち~",
            "なんか4545ってこれ誰だ?遊んでんのかな?"
        ]
        await message.channel.send(random.choice(word_list))

Example #3
0
import discord
form discord.ext import commands
form discord.ext.commands import Bot
import asyncio
import random
import requests
import os

client = commands.Bot(command_prefix=".") 
player_dict = dict()


@client.event
async def on_ready():
    print("The Bot is now Online")


@client.command(pass_context=True)
async def play (ctx, url):
    channel = ctx.massage.author.voice_channel
    await client.join_voice_channel(channel)
    server = ctx.message.server
    voice = client.voice_client_in(server)
    player = await voice.create_ytdl_player(url)
    player_dict[server.id] = player
    await client.send_message(ctx.message.channel, "Playing `%s` now" % player.title)
    player.start()
    
    
@client.command(pass_context=True)
async def stop(ctx):
Example #4
0
import distutils
import commands
from distutils import get
import sqlite3
import os

TOKEN = 'NTYyNDQ3ODExNjAyNDE1NjE5.XUm2GA.qZ2PRD1YYiN-vywnYse0EmF0wZ0'
BOT_PREFIX = '/'

bot = commands.Bot(command_prefix=BOT_PREFIX)

DIR = os.path.dirname(__file__)
db = sqlite3.connect(os.path.join(DIR, "BankAccounts.db"))
SQL = db.cursor()
START_BALANCE = 100.00
C_NAME = "Coins"


@bot.event
async def on_ready():
    print("Logged in as: " + bot.user.name + "\n")


@bot.command(pass_context=True, brief="Shows users balance", aliases=["bal"])
async def balance(ctx):
    USER_ID = ctx.message.author.id
    USER_NAME = str(ctx.message.author)
    SQL.execute(
        'create table if not exists Accounts("Num" integer primary key autoincrement,"user_name" text, "user_id" integer not null, "balance" real)'
    )
    SQL.execute(f'select user_id from Accounts where user_id="{USER_ID}"')
Example #5
0
import discord.ext import commands
import time
client = commands.Bot(command_prefix = '.')
@client.event
async def on_ready():
    print("bot is online")

@client.command()
async def test():
        print("test")


client.run('ODU2OTA2OTgyODYxNzAxMTIw.YNH20Q.1VMV6QohqbWYKfRgp0w0JYqK2bg')
Example #6
0
import commands
import config

cfg = config.load_config()

bot = commands.Bot(command_prefix=cfg.get('command_prefix'),
                   help_command=commands.CustomHelpCommand())
bot.config = cfg

for ext in cfg.get('active_extensions', []):
    bot.load_extension(ext)

bot.run(cfg.get('discord_token'))
Example #7
0
from motor.motor_asyncio import AsyncIOMotorClient

from commands import *

from discord.ext import commands, tasks

from commands import *
from commands.assign import *
from commands.task import *
from essentials.messagecache import MessageCache
from essentials.multi_server import ask_for_server

intents = discord.Intents.default()
intents.members = True

client = commands.Bot(command_prefix="/task ", intents=intents)
mydbcursor = None
logger = logging.getLogger('discord')

extensions = ['essentials.notifications']

client.message_cache = MessageCache(client)


@client.event
async def on_ready():
    # mongodb below

    mongo = AsyncIOMotorClient(SETTINGS.mongo_db)
    client.db = mongo.taskmaster
    client.session = aiohttp.ClientSession()
Example #8
0
import discord
from discord.ext.commands import Bot
from discord ext. import commands
import asyncio
import time
import os

Client = discord.Client()
client = commands.Bot(command_prefix = "."
@client.event
async def on_ready():
	print("Thank you for using Bot")
	await client.change_presence(game=discord.Game(name="Toast"))

@client.event
async def on_message(message):
	if message.content.startswith(".hello'):
		msg = 'Hello {0.author.mention} How are you today?'.format(message)
		await client.send_message(message.channel, msg)
	if message.content.startswith('.bye'):
		msg = 'Goodbye {0.author.mention} Hope to see you again soon :wave:'.format(message)
		await client.send_message(message.channel, msg)
								  
client.run(os.getenv('TOKEN'))