Beispiel #1
0
def register(g_content_fun, g_startswith_fun):
    print('register : ', __name__)
    Uptime.uptimeset()

    # message.content == "key" 로 비교할 key 등록
    content_key = ["!업타임"]
    # message.content.startswith("key") 로 비교할 key 등록
    startswith_key = []

    # key 에 대응하는 함수 등록
    if len(content_key):
        g_content_fun[__name__] = {'keys': content_key, 'func': on_message}
    if len(startswith_key):
        g_startswith_fun[__name__] = {
            'keys': startswith_key,
            'func': on_message
        }
Beispiel #2
0
import asyncio
import discord
import random
from discord.ext import commands
from discord.utils import get
from Dtime import Uptime
import openpyxl
import os


app = commands.Bot(command_prefix='`')
uptime = Uptime.uptimeset()

notice = list()

@app.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        embed = discord.Embed(title=":no_entry: 오류 발생 :no_entry:\n**존재하지 않는 명령어입니다.**", description="**error code : 4932-S7FK-34DE-SI73** \n**오류가 났다면 저에게 DM으로 오류코드를 보내주세요.**", color=0xff0000)
        await ctx.send(content=ctx.author.mention, embed=embed)

@app.event
async def on_member_join(member):
    await member.send("반갑습니다. 저희 서버에 오신 것을 환영합니다. 규칙을 먼저 읽고 활동해주세요.")


@app.event
async def on_ready():
    print("======================================")
    print("서버와의 연결이 성공적으로 끝났습니다")
    print("다음 로봇으로 로그인 합니다 : ")
from urllib import request
from discord import guild, member, user
import os
import json
from Dtime import Uptime
import keep_olive

async def bt(games):
    await bot.wait_until_ready()

    while not bot.is_closed():
        for g in games:
            await bot.change_presence(status = discord.Status.online, activity = discord.Game(g))
            await asyncio.sleep(10)

Uptime.uptimeset()

calcResult = 0

@bot.event
async def on_ready():
    print("team.DBMAH GALAXY BOT 봇")
    await bt(["GALAXY BOT 입니다! (made by 호철Hochul)", "본 메시지는 10초에 1번씩 봐꿔저요!", "?명령어를 이용해 명령어 확인해주세요!", "http://dbmah.na.to"])
    await asyncio.sleep(86400)
    os.system("start main_discord_bot.py")

@bot.command(name="활성화")
async def load(ctx, extension):
    bot.load_extension('활성화 완료')

@bot.command(name="비활성화")