Code Monkey home page Code Monkey logo

simplesendphoto's Introduction

SimpleSendPhoto

一个简单的自定义随机发图插件(Mirai)

JDK需求:jdk17

每在群中检测到一次触发语句,就会随机从图库文件夹中抽取一张图片发送回QQ群中

可在配置文件中修改图片路径以及触发语句

第一次使用请先修改配置文件
初次运行会生成配置文件:config/com.alins.SimpleSendPhoto/config.yml以及Ascii2dConfig.yml

# 图库路径
PicturePath: (路径必须带上单引号)
  - 'C:\Users\90899\Desktop\pictest'    图库1
  - 'C:\Users\90899\Desktop\pictest'    图库2(如若需要更多图库以及触发词可以照此格式自行添加)
# 触发词
Trigger: 
  - 测试1                               触发词1
  - 测试2                               触发词2(如若需要更多图库以及触发词可以照此格式自行添加)
# 可控范围图库路径
RangePicturePath: 请修改
# 可控范围图库触发语句
RangeTrigger: 请修改
# 存放群内通过指令添加的图片路径
PicturePath4: 请修改
# 图片缓存路径,默认不要修改
LinuxSavePicture: 'data/sspPic/SavePicture.jpg'
WindowsSavePicture: data\SSPpic\SavePicture.jpg
# 0为不开启r18模式,1为只开启r18模式,2为混合模式
r18: 0
# 搜索图功能冷却时间,默认为30秒
SearchCD: 30
# (开启后在同一图库一轮下来读的文件不重复,第一轮读完之后再重新开始第二轮(简单的说就是用过的图片不再出现)),默认关闭
NoPutBackSampling: true

功能一

(该功能不需要chat-command插件支持)

通过一图库对应一关键词的方式来进行简单的发图

功能二

(该指令功能需要chat-command插件支持) chat-command

搜索图片来源以及根据关键词搜索网络图片

指令 需要权限 效果
(/)来点 关键词 com.alins.simplesendphoto:command.来点 从loliconapi中抽取一张含有对应关键词的图片
(/)搜图 图片 com.alins.simplesendphoto:command.搜图 通过Ascii2d搜索图片来源

默认是没有权限的(除bot主人外) 下面附上Mirai权限管理相关指令:

/permission cancel <被许可人 ID> <权限 ID>   取消授权一个权限
/permission cancelall <被许可人 ID> <权限 ID>   取消授权一个权限及其所有子权限
/permission listpermissions    查看所有权限列表
/permission permit <被许可人 ID> <权限 ID>   授权一个权限
/permission permittedpermissions <被许可人 ID>   查看被授权权限列表

simplesendphoto's People

Contributors

caligrosto avatar

Stargazers

 avatar  avatar sansiny avatar Buran avatar  avatar PEIKnifer[.CN] avatar  avatar  avatar  avatar  avatar  avatar Lie_Kong avatar bbbblkhg avatar  avatar

Watchers

 avatar

simplesendphoto's Issues

无法下载图片

2022-07-30 13:57:56 V/Bot.742431945: GWS Tech.L(2029252158) -> /添加图片 新人 [mirai:image:{4A7D335C-2D32-3F9A-9B1B-1FAC98D8BA8A}.jpg, width=250, height=284, size=15535, type=JPG, isEmoji=true]
2022-07-30 13:57:57 W/SimpleSendPhoto: Exception in executing command `[mirai:source:ids=[24213], internalIds=[1606708816], from friend 2029252158 to 742431945 at 1659189475]/添加图片 新人 [mirai:image:{4A7D335C-2D32-3F9A-9B1B-1FAC98D8BA8A}.jpg, width=250, height=284, size=15535, type=JPG, isEmoji=true]`
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97)
        at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113)
        at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108)
        at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:159)
        at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:112)
        at net.mamoe.mirai.console.internal.command.CommandReflector$findSubCommands$6$1$invokeSuspend$$inlined$runBIO$1.invoke(CoroutineUtils.kt:194)
        at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:51)
        at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
        at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:43)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.io.FileNotFoundException: 请修改/新人.jpg (No such file or directory)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:184)
        at SimpleSendPhoto-V1.5.jar//com.example.Util.savePictures.SavePicture(savePictures.java:34)
        at SimpleSendPhoto-V1.5.jar//com.example.Command.UploadPictures.onCommand(UploadPictures.java:21)
        ... 21 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.