示例#1
0
 async def uptime(self, ctx):
     uptime = str(Uptime.uptime()).split(":")
     hours = uptime[0]
     minitues = uptime[1]
     seconds = uptime[2].split(".")[0]
     embed=discord.Embed(title="인피니티봇 업타임", description=f"{hours}시간 {minitues}분 {seconds}초 가동됬습니다", color=embedcolor)
     await ctx.send(embed=embed)
示例#2
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
        }
示例#3
0
async def on_message(message):
    if message.content == '!업타임':
        uptime = str(Uptime.uptime()).split(":")
        hours = uptime[0]
        minitues = uptime[1]
        seconds = uptime[2].split(".")[0]
        await message.channel.send(
            f"{hours}시간 {minitues}분 {seconds}초 동안 켜져있었습니다.")
async def on_message(message):  #메세지를 보냈을때
    if message.content == '!업타임':  # 사용자가 '!업타임' 이라고 입력하면
        uptime = str(Uptime.uptime()).split(":")  # uptime을 나눈다. (':' 기준)
        hours = uptime[0]  # hours를 uptime에서 나눈 것 중 0번째 (':' 기준)로 정한다.
        minitues = uptime[1]  # minitues를 uptime에서 나눈 것 중 1번째 (':' 기준)로 정한다.
        seconds = uptime[2].split(".")[
            0]  # seconds를 uptime에서 나눈 것 중 2번째 (':' 기준), 56.에서 .을 뺀 나머지 수로 정한다.
        await message.channel.send(
            f"{hours}시간 {minitues}분 {seconds}초"
        )  # 메세지를 보냈던 채널에 "{hours}시간 {minitues}분 {seconds}초"라고 보낸다.
示例#5
0
async def 업타임(ctx):
    uptime = str(Uptime.uptime()).split(":")
    hours = uptime[0]
    minitues = uptime[1]
    seconds = uptime[2].split(".")[0]
    await ctx.send(f"**{hours}**시간 **{minitues}**분 **{seconds}**초동안 구동 중입니다.")
示例#6
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("다음 로봇으로 로그인 합니다 : ")
示例#7
0
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="비활성화")
示例#8
0
 async def 업타임(self, ctx):
     uptime = str(Uptime.uptime()).split(":")
     hours = uptime[0]
     minitues = uptime[1]
     seconds = uptime[2].split(".")[0]
     await ctx.send(f"{hours}시간 {minitues}분 {seconds}초 동안 살아있었어!!")
示例#9
0
 async def uptime(self, ctx):
     uptime = str(Uptime.uptime()).split(":")
     hours = uptime[0]
     minitues = uptime[1]
     seconds = uptime[2].split(".")[0]
     await ctx.send(f"{hours}시간 {minitues}분 {seconds}초 `(Galaxy Bot은 호스팅 안정화 및 봇 안정화를 하루에 1번씩 리붓 됩니다!)`")