Untitled

 avatar
unknown
python
4 years ago
2.7 kB
4
Indexable
import discord
import time
import schedule
import asyncio

from tinydb import TinyDB, Query
from chatbot import panggil, sorter
from gemsimpel import startduel, assign_player1, assign_player2, assign_char, sorterer, reset, dmg_list
from discord.ext import commands, tasks
from quotes import quots
from random import choice

command_prefix = 'oi ',
client = commands.Bot(command_prefix)

status = ['Cyberpunk 2077', 'Satisfactory', 'Grand Theft Auto V', 'Counter-Strike: Global Offensive', 'VALORANT',
          "Stellaris", 'Space Engineers']
guild = 0

User = Query()

dbg = TinyDB('guilds.json')

@client.event
async def on_ready():
    wai.start()
    change_status.start()
    print("Bot udah jalan")

@client.command()
async def ping(ctx):
    await ctx.send('Pong!')
    await asyncio.sleep(1)
    await ctx.send('{} ms'.format(round(client.latency * 1000)))

@client.command()
async def guilds(ctx):
    global guild

    guild = ctx.guild.name
    dbv.insert({'guild': guild})

@client.command()
async def bot(ctx, *args):
    if args[0] == 'tolol':
        await ctx.send('hargailah para bot')

@client.command()
async def hgloow(ctx, *args):
    isi = ' '.join(args)

    if not args:
        await panggil(ctx, client)

    if len(args) == 1:
        arg1 = args[0]
        arg2 = args[0]
        await sorter(ctx, arg1, arg2, isi, client, args)
    elif len(args) > 1:
        arg1 = args[0]
        arg2 = args[1]
        await sorter(ctx, arg1, arg2, isi, client,args)

@client.command()
async def duel(ctx, *args):
    isi = ' '.join(args)

    if not args:
        await startduel(ctx, args)

    if len(args) > 0:
        if args[0] == 'join1':
            await assign_player1(ctx)
        elif args[0] == 'join2':
            await assign_player2(ctx)
        elif args[0] == 'pilih':
            await assign_char(ctx, args)
        elif args[0] == 'pake':
            await sorterer(ctx, args)
        elif args[0] == 'reset':
            await reset()
        elif isi == 'list attack':
            await dmg_list(ctx)

def startquote():
    guild = discord.Client.get_guild(client, 587206369317224452)

    channel = discord.utils.get(guild.channels, name="💬┃general")
    quots(channel, guild)

schedule.every().day.at("09:00").do(startquote)
schedule.every().day.at("21:00").do(startquote)

@tasks.loop(seconds=1)
async def wai():
    schedule.run_pending()

@tasks.loop(seconds=20)
async def change_status():
  await client.change_presence(activity=discord.Game((choice(status))))

client.run('ODE1Nzk0NjcxOTU1MzQ1NDM4.YDxl_g.dJa_4Uvovk9SRhc98tjJ9rjNdeg')
Editor is loading...