First Commit
This commit is contained in:
parent
bf00e9ef23
commit
4257c73d74
10
.idea/artifacts/Bot_Mk1_1_jar.xml
Normal file
10
.idea/artifacts/Bot_Mk1_1_jar.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="Bot_Mk1.1:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/Bot_Mk1_1_jar</output-path>
|
||||
<root id="archive" name="Bot_Mk1.1.jar">
|
||||
<element id="module-output" name="Bot_Mk1.1" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../JDA-withDependencies-2.2.1_353.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../enigma-beta-0.2/enigma-beta-0.2/lib/enigma-console.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
22
.idea/compiler.xml
Normal file
22
.idea/compiler.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
3
.idea/copyright/profiles_settings.xml
Normal file
3
.idea/copyright/profiles_settings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<component name="CopyrightManager">
|
||||
<settings default="" />
|
||||
</component>
|
11
.idea/libraries/JDA_3_0_BETA_98_withDependencies.xml
Normal file
11
.idea/libraries/JDA_3_0_BETA_98_withDependencies.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="JDA-3.0.BETA_98-withDependencies">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../libraries/JDA/JDA-3.0.BETA_98-withDependencies.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../libraries/JDA/JDA-3.0.BETA_75-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
11
.idea/libraries/enigma_console.xml
Normal file
11
.idea/libraries/enigma_console.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="enigma-console">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../libraries/enigma-beta-0.2/enigma-beta-0.2/lib/enigma-console.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="file://$PROJECT_DIR$/../../libraries/enigma-beta-0.2/enigma-beta-0.2/docs/javadoc" />
|
||||
</JAVADOC>
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
26
.idea/misc.xml
Normal file
26
.idea/misc.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
<option name="myConfigurationMap">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$">
|
||||
<value>
|
||||
<SvnBranchConfiguration>
|
||||
<option name="branchUrls">
|
||||
<list>
|
||||
<option value="http://seb6596.freeboxos.fr:600/svn/bot/libraries" />
|
||||
<option value="http://seb6596.freeboxos.fr:600/svn/bot/tag" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="trunkUrl" value="http://seb6596.freeboxos.fr:600/svn/bot/trunk" />
|
||||
</SvnBranchConfiguration>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
<option name="mySupportsUserInfoFilter" value="true" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Bot_Mk1.1.iml" filepath="$PROJECT_DIR$/Bot_Mk1.1.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
124
.idea/uiDesigner.xml
Normal file
124
.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="svn" />
|
||||
</component>
|
||||
</project>
|
1467
.idea/workspace.xml
Normal file
1467
.idea/workspace.xml
Normal file
File diff suppressed because it is too large
Load Diff
14
Bot_Mk1.1.iml
Normal file
14
Bot_Mk1.1.iml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Enigma-console" level="project" />
|
||||
<orderEntry type="library" name="JDA-3.0.BETA_98-withDependencies" level="project" />
|
||||
<orderEntry type="library" name="enigma-console" level="project" />
|
||||
</component>
|
||||
</module>
|
3
META-INF/MANIFEST.MF
Normal file
3
META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: net.borken.MainBot
|
||||
|
381
borken.uml
Normal file
381
borken.uml
Normal file
@ -0,0 +1,381 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Diagram>
|
||||
<ID>JAVA</ID>
|
||||
<OriginalElement>net.borken</OriginalElement>
|
||||
<nodes>
|
||||
<node x="2592.3349390690846" y="1335.0">net.borken.commandes.Over18.SM</node>
|
||||
<node x="2868.551362928349" y="1019.0">net.borken.Outils.CommandParser.CommandContainer</node>
|
||||
<node x="2376.3349390690846" y="1346.0">net.borken.commandes.Over18.Madame</node>
|
||||
<node x="924.2708333333333" y="1063.0">net.borken.BotListener</node>
|
||||
<node x="816.375" y="808.0">net.borken.Outils.AntiSpam</node>
|
||||
<node x="2428.0849390690846" y="1062.5">net.borken.Outils.Redirection</node>
|
||||
<node x="870.0" y="486.5">net.borken.Outils.AntiSpam.Minuteur</node>
|
||||
<node x="2844.0749908374573" y="1379.0">net.borken.Outils.CommandParser</node>
|
||||
<node x="1384.3349390690846" y="1356.5">net.borken.Outils.DayListener</node>
|
||||
<node x="1208.0" y="541.5">net.borken.Outils.Moderateur</node>
|
||||
<node x="513.9999999999999" y="454.0">net.borken.commandes.Move</node>
|
||||
<node x="2141.3349390690846" y="1335.0">net.borken.commandes.Over18.Ass</node>
|
||||
<node x="1292.0849390690846" y="997.0">net.borken.commandes.Spam</node>
|
||||
<node x="0.0" y="167.0">net.borken.Commande</node>
|
||||
<node x="292.0" y="531.0">net.borken.commandes.Help</node>
|
||||
<node x="21.0" y="531.0">net.borken.commandes.PingCommande</node>
|
||||
<node x="1671.3349390690846" y="1335.0">net.borken.commandes.Over18.Pipe</node>
|
||||
<node x="1696.3263629283492" y="0.0">net.borken.Outils.Heure</node>
|
||||
<node x="1820.9999999999998" y="1617.0">net.borken.MainBot</node>
|
||||
<node x="1694.8263629283492" y="200.0">net.borken.Outils.Entete</node>
|
||||
<node x="1906.3349390690846" y="1335.0">net.borken.commandes.Over18.Boobs</node>
|
||||
</nodes>
|
||||
<notes />
|
||||
<edges>
|
||||
<edge source="net.borken.commandes.Over18.Boobs" target="net.borken.Outils.Redirection">
|
||||
<point x="80.625" y="-81.0" />
|
||||
<point x="2094.4599390690846" y="1305.0" />
|
||||
<point x="2468.5849390690846" y="1305.0" />
|
||||
<point x="-40.5" y="48.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Move">
|
||||
<point x="-97.64705882352928" y="-158.0" />
|
||||
<point x="1889.3529411764705" y="1567.0" />
|
||||
<point x="569.8333333333333" y="1567.0" />
|
||||
<point x="-111.66666666666663" y="147.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.SM" target="net.borken.Commande">
|
||||
<point x="-80.625" y="-81.0" />
|
||||
<point x="2619.2099390690846" y="1255.0" />
|
||||
<point x="270.5" y="1255.0" />
|
||||
<point x="270.5" y="384.0" />
|
||||
<point x="237.25" y="384.0" />
|
||||
<point x="54.75" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Help" target="net.borken.Commande">
|
||||
<point x="-67.33333333333326" y="-70.0" />
|
||||
<point x="325.66666666666674" y="434.0" />
|
||||
<point x="310.25" y="434.0" />
|
||||
<point x="127.75" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.Outils.CommandParser">
|
||||
<point x="156.2352941176473" y="-158.0" />
|
||||
<point x="2143.235294117647" y="1597.0" />
|
||||
<point x="2950.5749908374573" y="1597.0" />
|
||||
<point x="35.5" y="37.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.Entete" target="net.borken.Outils.Heure">
|
||||
<point x="0.0" y="-25.5" />
|
||||
<point x="0.0" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Boobs" target="net.borken.Outils.Entete">
|
||||
<point x="-26.875" y="-81.0" />
|
||||
<point x="1986.9599390690846" y="1285.0" />
|
||||
<point x="1991.6999908374573" y="1285.0" />
|
||||
<point x="1991.6999908374573" y="434.0" />
|
||||
<point x="1792.026362928349" y="434.0" />
|
||||
<point x="7.199999999999818" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Madame" target="net.borken.Outils.Redirection">
|
||||
<point x="48.75" y="-70.0" />
|
||||
<point x="13.5" y="48.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Spam" target="net.borken.Outils.AntiSpam">
|
||||
<point x="-35.24999999999977" y="-114.0" />
|
||||
<point x="1397.834939069085" y="947.0" />
|
||||
<point x="963.0416666666667" y="947.0" />
|
||||
<point x="58.66666666666674" y="59.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.DayListener" target="net.borken.Outils.Entete">
|
||||
<point x="66.75" y="-59.5" />
|
||||
<point x="1584.5849390690846" y="414.0" />
|
||||
<point x="1770.4263629283491" y="414.0" />
|
||||
<point x="-14.400000000000091" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.BotListener" target="net.borken.Outils.AntiSpam">
|
||||
<point x="-24.625" y="-48.0" />
|
||||
<point x="998.1458333333333" y="967.0" />
|
||||
<point x="904.375" y="967.0" />
|
||||
<point x="0.0" y="59.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.PingCommande" target="net.borken.Commande">
|
||||
<point x="0.0" y="-70.0" />
|
||||
<point x="118.5" y="434.0" />
|
||||
<point x="54.75" y="434.0" />
|
||||
<point x="-127.75" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Spam">
|
||||
<point x="-58.58823529411757" y="-158.0" />
|
||||
<point x="1928.4117647058822" y="1547.0" />
|
||||
<point x="1362.5849390690846" y="1547.0" />
|
||||
<point x="-70.5" y="114.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.CommandParser" target="net.borken.Outils.Entete">
|
||||
<point x="-17.75" y="-37.0" />
|
||||
<point x="2897.3249908374573" y="1305.0" />
|
||||
<point x="2858.051362928349" y="1305.0" />
|
||||
<point x="2858.051362928349" y="324.0" />
|
||||
<point x="1871.2263629283493" y="324.0" />
|
||||
<point x="86.40000000000009" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Help">
|
||||
<point x="-117.17647058823513" y="-158.0" />
|
||||
<point x="1869.8235294117646" y="1577.0" />
|
||||
<point x="393.0" y="1577.0" />
|
||||
<point x="0.0" y="70.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.AntiSpam.Minuteur" target="net.borken.Outils.AntiSpam">
|
||||
<point x="79.25" y="114.5" />
|
||||
<point x="1107.75" y="778.0" />
|
||||
<point x="948.375" y="778.0" />
|
||||
<point x="44.0" y="-59.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Pipe" target="net.borken.Outils.Entete">
|
||||
<point x="26.875" y="-81.0" />
|
||||
<point x="1805.7099390690846" y="1315.0" />
|
||||
<point x="1767.6999908374573" y="1315.0" />
|
||||
<point x="1767.6999908374573" y="434.0" />
|
||||
<point x="1784.8263629283492" y="434.0" />
|
||||
<point x="0.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.PingCommande">
|
||||
<point x="-136.705882352941" y="-158.0" />
|
||||
<point x="1850.2941176470588" y="1587.0" />
|
||||
<point x="118.5" y="1587.0" />
|
||||
<point x="0.0" y="70.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Pipe" target="net.borken.Outils.Redirection">
|
||||
<point x="80.625" y="-81.0" />
|
||||
<point x="1859.4599390690846" y="1295.0" />
|
||||
<point x="2441.5849390690846" y="1295.0" />
|
||||
<point x="-67.5" y="48.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.Commande">
|
||||
<point x="-156.23529411764684" y="-158.0" />
|
||||
<point x="1830.764705882353" y="1597.0" />
|
||||
<point x="10.5" y="1597.0" />
|
||||
<point x="10.5" y="434.0" />
|
||||
<point x="18.25" y="434.0" />
|
||||
<point x="-164.25" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.Moderateur" target="net.borken.Outils.Entete">
|
||||
<point x="55.75" y="-59.5" />
|
||||
<point x="1375.25" y="384.0" />
|
||||
<point x="1748.8263629283492" y="384.0" />
|
||||
<point x="-36.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.Outils.DayListener">
|
||||
<point x="-39.05882352941171" y="-158.0" />
|
||||
<point x="1947.941176470588" y="1537.0" />
|
||||
<point x="1517.8349390690846" y="1537.0" />
|
||||
<point x="0.0" y="59.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Spam" target="net.borken.Outils.Entete">
|
||||
<point x="105.75000000000023" y="-114.0" />
|
||||
<point x="1538.834939069085" y="977.0" />
|
||||
<point x="1502.0164238592643" y="977.0" />
|
||||
<point x="1502.0164238592643" y="404.0" />
|
||||
<point x="1763.2263629283493" y="404.0" />
|
||||
<point x="-21.59999999999991" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.AntiSpam" target="net.borken.commandes.Move">
|
||||
<point x="-73.33333333333326" y="-59.5" />
|
||||
<point x="831.0416666666667" y="788.0" />
|
||||
<point x="681.4999999999999" y="788.0" />
|
||||
<point x="0.0" y="147.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.CommandParser.CommandContainer" target="net.borken.Outils.CommandParser">
|
||||
<point x="57.25" y="92.0" />
|
||||
<point x="3040.301362928349" y="1315.0" />
|
||||
<point x="2968.3249908374573" y="1315.0" />
|
||||
<point x="53.25" y="-37.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Over18.Madame">
|
||||
<point x="39.05882352941171" y="-158.0" />
|
||||
<point x="2026.0588235294115" y="1537.0" />
|
||||
<point x="2473.8349390690846" y="1537.0" />
|
||||
<point x="0.0" y="70.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Ass" target="net.borken.Outils.Entete">
|
||||
<point x="26.875" y="-81.0" />
|
||||
<point x="2275.7099390690846" y="1285.0" />
|
||||
<point x="2237.6999908374573" y="1285.0" />
|
||||
<point x="2237.6999908374573" y="404.0" />
|
||||
<point x="1813.6263629283494" y="404.0" />
|
||||
<point x="28.800000000000182" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Ass" target="net.borken.Commande">
|
||||
<point x="-80.625" y="-81.0" />
|
||||
<point x="2168.2099390690846" y="1275.0" />
|
||||
<point x="248.5" y="1275.0" />
|
||||
<point x="248.5" y="404.0" />
|
||||
<point x="164.25" y="404.0" />
|
||||
<point x="-18.25" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Over18.Boobs">
|
||||
<point x="0.0" y="-158.0" />
|
||||
<point x="1986.9999999999998" y="1517.0" />
|
||||
<point x="2013.8349390690846" y="1517.0" />
|
||||
<point x="0.0" y="81.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Over18.Pipe">
|
||||
<point x="-19.529411764705856" y="-158.0" />
|
||||
<point x="1967.470588235294" y="1527.0" />
|
||||
<point x="1778.8349390690846" y="1527.0" />
|
||||
<point x="0.0" y="81.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Help" target="net.borken.Outils.Entete">
|
||||
<point x="67.33333333333337" y="-70.0" />
|
||||
<point x="460.3333333333335" y="324.0" />
|
||||
<point x="1705.6263629283494" y="324.0" />
|
||||
<point x="-79.19999999999982" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.Outils.Entete">
|
||||
<point x="117.17647058823513" y="-158.0" />
|
||||
<point x="2104.176470588235" y="1577.0" />
|
||||
<point x="2828.8349390690846" y="1577.0" />
|
||||
<point x="2828.8349390690846" y="344.0" />
|
||||
<point x="1856.8263629283492" y="344.0" />
|
||||
<point x="72.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.Outils.Redirection">
|
||||
<point x="58.58823529411757" y="-158.0" />
|
||||
<point x="2045.5882352941173" y="1547.0" />
|
||||
<point x="2581.8349390690846" y="1547.0" />
|
||||
<point x="2581.8349390690846" y="1315.0" />
|
||||
<point x="2549.5849390690846" y="1315.0" />
|
||||
<point x="40.5" y="48.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.AntiSpam" target="net.borken.Outils.AntiSpam.Minuteur">
|
||||
<point x="14.666666666666742" y="-59.5" />
|
||||
<point x="919.0416666666667" y="768.0" />
|
||||
<point x="949.25" y="768.0" />
|
||||
<point x="-79.25" y="114.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.BotListener" target="net.borken.Outils.Moderateur">
|
||||
<point x="24.625" y="-48.0" />
|
||||
<point x="1047.3958333333333" y="967.0" />
|
||||
<point x="1263.5224390690848" y="967.0" />
|
||||
<point x="-55.75" y="59.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.SM" target="net.borken.Outils.Entete">
|
||||
<point x="80.625" y="-81.0" />
|
||||
<point x="2780.4599390690846" y="1315.0" />
|
||||
<point x="2747.8289238592643" y="1315.0" />
|
||||
<point x="2747.8289238592643" y="364.0" />
|
||||
<point x="1842.4263629283491" y="364.0" />
|
||||
<point x="57.59999999999991" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Boobs" target="net.borken.Commande">
|
||||
<point x="-80.625" y="-81.0" />
|
||||
<point x="1933.2099390690846" y="1285.0" />
|
||||
<point x="237.5" y="1285.0" />
|
||||
<point x="237.5" y="414.0" />
|
||||
<point x="127.75" y="414.0" />
|
||||
<point x="-54.75" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Pipe" target="net.borken.Commande">
|
||||
<point x="-80.625" y="-81.0" />
|
||||
<point x="1698.2099390690846" y="1305.0" />
|
||||
<point x="226.5" y="1305.0" />
|
||||
<point x="226.5" y="424.0" />
|
||||
<point x="91.25" y="424.0" />
|
||||
<point x="-91.25" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Spam" target="net.borken.Commande">
|
||||
<point x="-105.74999999999977" y="-114.0" />
|
||||
<point x="1327.334939069085" y="957.0" />
|
||||
<point x="281.5" y="957.0" />
|
||||
<point x="281.5" y="374.0" />
|
||||
<point x="273.75" y="374.0" />
|
||||
<point x="91.25" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.Redirection" target="net.borken.Outils.Entete">
|
||||
<point x="40.5" y="-48.5" />
|
||||
<point x="2549.5849390690846" y="977.0" />
|
||||
<point x="2504.366423859264" y="977.0" />
|
||||
<point x="2504.366423859264" y="384.0" />
|
||||
<point x="1828.026362928349" y="384.0" />
|
||||
<point x="43.19999999999982" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Madame" target="net.borken.Commande">
|
||||
<point x="-48.75" y="-70.0" />
|
||||
<point x="2425.0849390690846" y="1265.0" />
|
||||
<point x="259.5" y="1265.0" />
|
||||
<point x="259.5" y="394.0" />
|
||||
<point x="200.75" y="394.0" />
|
||||
<point x="18.25" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.AntiSpam" target="net.borken.Outils.Entete">
|
||||
<point x="-14.666666666666742" y="-59.5" />
|
||||
<point x="889.7083333333333" y="768.0" />
|
||||
<point x="859.4999999999999" y="768.0" />
|
||||
<point x="859.4999999999999" y="354.0" />
|
||||
<point x="1727.2263629283493" y="354.0" />
|
||||
<point x="-57.59999999999991" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.SM" target="net.borken.Outils.Redirection">
|
||||
<point x="-26.875" y="-81.0" />
|
||||
<point x="2672.9599390690846" y="1245.0" />
|
||||
<point x="2576.5849390690846" y="1245.0" />
|
||||
<point x="67.5" y="48.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.BotListener">
|
||||
<point x="-78.11764705882342" y="-158.0" />
|
||||
<point x="1908.8823529411764" y="1557.0" />
|
||||
<point x="1022.7708333333333" y="1557.0" />
|
||||
<point x="0.0" y="48.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Over18.Ass">
|
||||
<point x="19.529411764705856" y="-158.0" />
|
||||
<point x="2006.5294117647056" y="1527.0" />
|
||||
<point x="2248.8349390690846" y="1527.0" />
|
||||
<point x="0.0" y="81.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.MainBot" target="net.borken.commandes.Over18.SM">
|
||||
<point x="78.11764705882342" y="-158.0" />
|
||||
<point x="2065.1176470588234" y="1557.0" />
|
||||
<point x="2699.8349390690846" y="1557.0" />
|
||||
<point x="0.0" y="81.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Move" target="net.borken.Outils.Entete">
|
||||
<point x="0.0" y="-147.0" />
|
||||
<point x="681.4999999999999" y="334.0" />
|
||||
<point x="1712.8263629283492" y="334.0" />
|
||||
<point x="-72.0" y="25.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Over18.Ass" target="net.borken.Outils.Redirection">
|
||||
<point x="80.625" y="-81.0" />
|
||||
<point x="2329.4599390690846" y="1315.0" />
|
||||
<point x="2495.5849390690846" y="1315.0" />
|
||||
<point x="-13.5" y="48.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.commandes.Move" target="net.borken.Commande">
|
||||
<point x="-111.66666666666674" y="-147.0" />
|
||||
<point x="569.8333333333331" y="304.0" />
|
||||
<point x="346.75" y="304.0" />
|
||||
<point x="164.25" y="58.5" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.DayListener" target="net.borken.commandes.Spam">
|
||||
<point x="-66.75" y="-59.5" />
|
||||
<point x="1451.0849390690846" y="1315.0" />
|
||||
<point x="1503.5849390690846" y="1315.0" />
|
||||
<point x="70.5" y="114.0" />
|
||||
</edge>
|
||||
<edge source="net.borken.Outils.CommandParser" target="net.borken.Outils.CommandParser.CommandContainer">
|
||||
<point x="17.75" y="-37.0" />
|
||||
<point x="2932.8249908374573" y="1315.0" />
|
||||
<point x="2925.801362928349" y="1315.0" />
|
||||
<point x="-57.25" y="92.0" />
|
||||
</edge>
|
||||
</edges>
|
||||
<settings layout="Hierarchic Group" zoom="0.30000000000000016" x="1996.7380952380934" y="937.2857142857144" />
|
||||
<SelectedNodes>
|
||||
<node>net.borken.Outils.DayListener</node>
|
||||
</SelectedNodes>
|
||||
<Categories>
|
||||
<Category>Constructors</Category>
|
||||
<Category>Methods</Category>
|
||||
<Category>Properties</Category>
|
||||
<Category>Inner Classes</Category>
|
||||
<Category>Fields</Category>
|
||||
</Categories>
|
||||
<SCOPE>All</SCOPE>
|
||||
<VISIBILITY>private</VISIBILITY>
|
||||
</Diagram>
|
||||
|
2
out/artifacts/Bot_Mk1_1_jar/Start.cmd
Normal file
2
out/artifacts/Bot_Mk1_1_jar/Start.cmd
Normal file
@ -0,0 +1,2 @@
|
||||
java -jar Bot_Mk1.1.jar "MjQwODA2MDk1NzcyMTg4Njc0.CvIrrg.p3lOx7oXabPWcT1oZiPKcu0uSs4"
|
||||
pause
|
3
out/production/Bot_Mk1.1/META-INF/MANIFEST.MF
Normal file
3
out/production/Bot_Mk1.1/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: net.borken.MainBot
|
||||
|
5
out/production/Bot_Mk1.1/META-INF/desktop.ini
Normal file
5
out/production/Bot_Mk1.1/META-INF/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Ce dossier est partagé en ligne.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
3
src/META-INF/MANIFEST.MF
Normal file
3
src/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: net.borken.MainBot
|
||||
|
5
src/META-INF/desktop.ini
Normal file
5
src/META-INF/desktop.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[.ShellClassInfo]
|
||||
InfoTip=Ce dossier est partagé en ligne.
|
||||
IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe
|
||||
IconIndex=16
|
||||
|
62
src/net/borken/BotListener.java
Normal file
62
src/net/borken/BotListener.java
Normal file
@ -0,0 +1,62 @@
|
||||
package net.borken;
|
||||
|
||||
import net.borken.Outils.AntiSpam;
|
||||
import net.borken.Outils.Moderateur;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
||||
import net.dv8tion.jda.core.managers.GuildManager;
|
||||
|
||||
|
||||
/**
|
||||
* Created by seb65 on 19/10/2016.
|
||||
*/
|
||||
|
||||
public class BotListener extends ListenerAdapter {
|
||||
AntiSpam antispam=new AntiSpam();
|
||||
Moderateur modo = new Moderateur();
|
||||
@Override
|
||||
public void onMessageReceived(MessageReceivedEvent event) {
|
||||
// ----------------------Test pour eviter eco de commande-------------------------
|
||||
try
|
||||
{
|
||||
if (event.getMessage().getContent().startsWith("//") && event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId()) {
|
||||
//On a detecter que c'etait une commande
|
||||
//System.out.println(event.getMessage().getContent());
|
||||
|
||||
|
||||
MainBot.handleCommand(MainBot.parser.parse(event.getMessage().getContent(), event));
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId() && !event.getTextChannel().getName().equals("le_dongeon"))
|
||||
{
|
||||
//N'est pas une commande
|
||||
|
||||
Guild serveur=event.getGuild();
|
||||
GuildManager guildManager = serveur.getManager();
|
||||
Member user = event.getMember();
|
||||
|
||||
// appel de la methode d'analyse de message de "Moderateur"
|
||||
if(!event.getAuthor().getName().equals("Aethex")) {
|
||||
if (modo.analyse(user, serveur, guildManager, event) == 1) {
|
||||
antispam.extermine(user, serveur, guildManager,true, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}catch (Exception e)
|
||||
{
|
||||
if (e.getMessage()==null) {
|
||||
System.out.println(MainBot.entete.get("ERREUR", "BotListener") +"NullPointerException");
|
||||
} else {
|
||||
System.out.println(MainBot.entete.get("ERREUR", "BotListener") + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
16
src/net/borken/Commande.java
Normal file
16
src/net/borken/Commande.java
Normal file
@ -0,0 +1,16 @@
|
||||
package net.borken;
|
||||
|
||||
import net.dv8tion.jda.*;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 19/10/2016.
|
||||
*/
|
||||
public interface Commande {
|
||||
boolean called(String[] args, MessageReceivedEvent event);
|
||||
void action(String[] args, MessageReceivedEvent event);
|
||||
String help(String[] args);
|
||||
void executed(boolean success, MessageReceivedEvent event);
|
||||
|
||||
|
||||
}
|
247
src/net/borken/MainBot.java
Normal file
247
src/net/borken/MainBot.java
Normal file
@ -0,0 +1,247 @@
|
||||
package net.borken;
|
||||
|
||||
import enigma.console.Console;
|
||||
import enigma.console.TextAttributes;
|
||||
import enigma.core.Enigma;
|
||||
import net.borken.Outils.CommandParser;
|
||||
import net.borken.Outils.DayListener;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.borken.Outils.Redirection;
|
||||
import net.borken.commandes.*;
|
||||
import net.borken.commandes.Over18.*;
|
||||
|
||||
|
||||
import net.dv8tion.jda.core.*;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
import net.dv8tion.jda.core.managers.GuildManager;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 19/10/2016.
|
||||
*/
|
||||
public class MainBot {
|
||||
|
||||
private static JDA jda;
|
||||
public static final CommandParser parser =new CommandParser();
|
||||
public static HashMap<String, Commande> commandes = new HashMap<>();
|
||||
public static boolean okInit=false;
|
||||
public static Entete entete=new Entete();
|
||||
public static HashMap<Member, String[]> historique =new HashMap<>();
|
||||
public static HashMap<Member, Integer> message_compteur =new HashMap<>();
|
||||
|
||||
public static Hashtable<Member,Integer> userMulti = new Hashtable();
|
||||
public static Hashtable<Member,Boolean> minuteurStatut = new Hashtable<>();
|
||||
|
||||
public static TextAttributes txtColor;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
Stop stopTh=new Stop();
|
||||
stopTh.start();
|
||||
txtColor = new TextAttributes(Color.green, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
/****************************
|
||||
* Initialisation *
|
||||
****************************/
|
||||
System.out.println("-------------------INITIALISATION-------------------");
|
||||
txtColor = new TextAttributes(Color.blue, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
//Bot démarrer sans token
|
||||
if (args.length < 1) {
|
||||
System.out.println();
|
||||
System.err.println(entete.get("ERREUR","INIT")+"Veuilliez indiquer le token du bot en argument...");
|
||||
okInit=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Token présent
|
||||
try
|
||||
{
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","INIT")+"Connection au serveur...");
|
||||
//connection au bot
|
||||
jda = new JDABuilder(AccountType.BOT).addListener(new BotListener()).setToken(args[0]).setBulkDeleteSplittingEnabled(false).buildBlocking();
|
||||
jda.setAutoReconnect(true);
|
||||
okInit=true;
|
||||
|
||||
}
|
||||
catch (LoginException | InterruptedException | RateLimitedException e)
|
||||
{
|
||||
System.out.println();
|
||||
System.err.println(entete.get("ERREUR","INIT")+e.getMessage());
|
||||
okInit=false;
|
||||
}
|
||||
}
|
||||
|
||||
//Connection reussi
|
||||
if(okInit)
|
||||
{
|
||||
/*************************************
|
||||
* Definition des commande *
|
||||
*************************************/
|
||||
commandes.put("ping", new PingCommande());
|
||||
commandes.put("help",new Help());
|
||||
commandes.put("move", new Move());
|
||||
commandes.put("spam", new Spam());
|
||||
commandes.put("ass",new Ass());
|
||||
commandes.put("boobs",new Boobs());
|
||||
commandes.put("pipe",new Pipe());
|
||||
commandes.put("sm",new SM());
|
||||
commandes.put("madame",new Madame());
|
||||
|
||||
//On recupere le l'id serveur
|
||||
Guild serveur = jda.getGuilds().get(0);
|
||||
|
||||
//On recupere le serveur manageur
|
||||
GuildManager guildManager = serveur.getManager();
|
||||
|
||||
//on recupere les utilisateur conecter
|
||||
List<Member> utilisateurCo = serveur.getMembers();
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","INIT")+"Utilisatieur connecté: ");
|
||||
for (Member anUtilisateurCo : utilisateurCo) //= for(int i=0; i<utilisateurCo.size(); i++)
|
||||
{
|
||||
if(anUtilisateurCo.getOnlineStatus().equals(OnlineStatus.ONLINE))
|
||||
System.out.println(entete.get("Info", "INIT") + " *" + anUtilisateurCo.getEffectiveName()); //anUtilisateurCo = utilisateurCo.get(i)
|
||||
}
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","INIT")+"Utilisatieur absent: ");
|
||||
for (Member anUtilisateurCo : utilisateurCo) //= for(int i=0; i<utilisateurCo.size(); i++)
|
||||
{
|
||||
if(anUtilisateurCo.getOnlineStatus().equals(OnlineStatus.DO_NOT_DISTURB))
|
||||
System.out.println(entete.get("Info", "INIT") + " *" + anUtilisateurCo.getEffectiveName()); //anUtilisateurCo = utilisateurCo.get(i)
|
||||
}
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","INIT")+"Utilisatieur hors ligne: ");
|
||||
for (Member anUtilisateurCo : utilisateurCo) //= for(int i=0; i<utilisateurCo.size(); i++)
|
||||
{
|
||||
if(anUtilisateurCo.getOnlineStatus().equals(OnlineStatus.OFFLINE))
|
||||
System.out.println(entete.get("Info", "INIT") + " *" + anUtilisateurCo.getEffectiveName()); //anUtilisateurCo = utilisateurCo.get(i)
|
||||
}
|
||||
txtColor = new TextAttributes(Color.green, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
ModoTimer modotimer = new ModoTimer();
|
||||
modotimer.start();
|
||||
DayListener dayListener =new DayListener();
|
||||
dayListener.start();
|
||||
System.out.println("-----------------FIN INITIALISATION-----------------");
|
||||
txtColor = new TextAttributes(Color.blue, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
|
||||
/*List<User> userAction = serveur.getUsersByName("Broken_Fire");
|
||||
new Move().exc(userAction.get(0),"Big Daddy",true,serveur,serveur.getManager());*/
|
||||
Redirection urlRedirect=new Redirection();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/***************************************
|
||||
* Traitement de la commande *
|
||||
***************************************/
|
||||
public static void handleCommand(CommandParser.CommandContainer cmd)
|
||||
{
|
||||
//On verifie que la commande existe
|
||||
if (commandes.containsKey(cmd.commande))
|
||||
{
|
||||
commandes.get(cmd.commande).action(cmd.args, cmd.event);
|
||||
commandes.get(cmd.commande).executed(true, cmd.event);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageReceivedEvent event = cmd.event;
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Commande inconnue!__** :warning:\n:arrow_right: Utilisez `//help` pour voirs les commandes disponible. ").queue();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*******************************
|
||||
* RAZ Compteur Spam *
|
||||
*******************************/
|
||||
public static class ModoTimer extends Thread{
|
||||
|
||||
|
||||
public ModoTimer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try {
|
||||
sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//System.out.println("\n5sec Ecoulées !");
|
||||
for (Member unUser: message_compteur.keySet() ) //=for(int i=0; i<saveRoleUser.size(); i++)
|
||||
{
|
||||
MainBot.message_compteur.put(unUser, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static final Console s_console;
|
||||
static
|
||||
{
|
||||
s_console = Enigma.getConsole("Bot Discord");
|
||||
}
|
||||
|
||||
|
||||
public static class Stop extends Thread
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String txtEntré = "";
|
||||
while(!txtEntré.equals("o")&&!txtEntré.equals("O"))
|
||||
{
|
||||
|
||||
while (!txtEntré.equals("stop"))
|
||||
{
|
||||
txtEntré = s_console.readLine();
|
||||
}
|
||||
txtColor = new TextAttributes(Color.orange, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
System.out.println("Etes-vous sur de vouloir arréter le Bot? (o/n)");
|
||||
txtColor = new TextAttributes(Color.blue, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
txtEntré = s_console.readLine();
|
||||
|
||||
if(txtEntré.equals("n")||txtEntré.equals("N"))
|
||||
{
|
||||
txtColor = new TextAttributes(Color.green, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
System.out.println("Arret du Bot annulé.");
|
||||
txtColor = new TextAttributes(Color.blue, Color.black);
|
||||
s_console.setTextAttributes(txtColor);
|
||||
}
|
||||
}
|
||||
Runtime.getRuntime().exit(0);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
138
src/net/borken/Outils/AntiSpam.java
Normal file
138
src/net/borken/Outils/AntiSpam.java
Normal file
@ -0,0 +1,138 @@
|
||||
package net.borken.Outils;
|
||||
|
||||
import net.borken.MainBot;
|
||||
import net.borken.commandes.Move;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.Role;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
import net.dv8tion.jda.core.managers.GuildManager;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.Thread.sleep;
|
||||
|
||||
|
||||
/**
|
||||
* Created by seb65 on 20/10/2016.
|
||||
*/
|
||||
public class AntiSpam {
|
||||
public Move move = new Move();
|
||||
|
||||
public Entete entete=new Entete();
|
||||
|
||||
public AntiSpam() {
|
||||
|
||||
|
||||
|
||||
|
||||
//Constructeur
|
||||
|
||||
}
|
||||
|
||||
public void extermine(Member user, Guild serveur, GuildManager serveurManger, Boolean incrMulti, MessageReceivedEvent event){
|
||||
try {
|
||||
sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// On créer un nouvelle case dans le tableau des statuts si il n'y est pas
|
||||
if(!MainBot.minuteurStatut.containsKey(user))
|
||||
{
|
||||
MainBot.minuteurStatut.put(user,false);
|
||||
}
|
||||
// On verrifie que l'uttilisateur n'est pas deja en spam
|
||||
if(!MainBot.minuteurStatut.get(user))
|
||||
{
|
||||
//l'utilisateur n'est pas deja en spam
|
||||
if(MainBot.userMulti.containsKey(user))
|
||||
{
|
||||
if(MainBot.userMulti.get(user)<45 && incrMulti)
|
||||
{
|
||||
MainBot.userMulti.replace(user,MainBot.userMulti.get(user)*2);
|
||||
}
|
||||
}
|
||||
else
|
||||
MainBot.userMulti.put(user,1);
|
||||
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","ANTISPAM")+"Punition de "+user.getEffectiveName()+" avec un multiplicateur de "+MainBot.userMulti.get(user));
|
||||
|
||||
event.getTextChannel().sendMessage(user.getAsMention()+"\n```markdown\n#-----------------SPAM DETECTEUR----------------#\n# #\n# La prochaine fois tu fermeras ta gueule! #\n# #\n# On te revoit dans "+MainBot.userMulti.get(user)+"min connard ! #\n# #\n#-----------------------------------------------#```\n https://cdn.meme.am/instances/64726692.jpg ").queue();
|
||||
|
||||
if(!MainBot.minuteurStatut.get(user))
|
||||
{
|
||||
MainBot.minuteurStatut.replace(user,true);
|
||||
List<Role> spm = serveur.getRolesByName("Spammer", false);
|
||||
move.exc(user, spm.get(0), true, serveur, serveurManger);
|
||||
Thread minuteur =new Minuteur(MainBot.userMulti.get(user), move.user, move.saveRoleUser, move.serveur, move.serveurManager,event);
|
||||
minuteur.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class Minuteur extends Thread{
|
||||
public TextChannel chanel;
|
||||
public List<Role> saveRoleUser;
|
||||
public Member user;
|
||||
public Guild serveur;
|
||||
public GuildManager serveurManager;
|
||||
public int multip;
|
||||
public MessageReceivedEvent event;
|
||||
|
||||
|
||||
public Minuteur(int multip, Member user, List<Role> saveRoleUser, Guild serveur, GuildManager serveurManager, MessageReceivedEvent event )
|
||||
{
|
||||
this.multip=multip;
|
||||
this.user=user;
|
||||
this.saveRoleUser=saveRoleUser;
|
||||
this.serveur=serveur;
|
||||
this.serveurManager=serveurManager;
|
||||
this.event=event;
|
||||
this.chanel=event.getTextChannel();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int cSeg=0;
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","MINUTEUR")+"["+user.getEffectiveName()+"] Démarage pour "+multip+"min");
|
||||
while (MainBot.minuteurStatut.get(user))
|
||||
{
|
||||
try {
|
||||
sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(cSeg>60*multip)
|
||||
{
|
||||
MainBot.minuteurStatut.replace(user,false);
|
||||
}
|
||||
cSeg++;
|
||||
}
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","MINUTEUR")+ "["+user.getEffectiveName()+"] Fin de spam pour "+user.getEffectiveName()+" apres "+multip+"min.");
|
||||
move.exc(user, saveRoleUser.get(0), true, serveur, serveurManager); //aSaveroleUser=saveRoleUser.get(i)
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","MINUTEUR")+"["+user.getEffectiveName()+"] Fin des "+multip+"min");
|
||||
chanel.sendMessage(user.getAsMention()+"\n```markdown\n#-----------------SPAM DETECTEUR----------------#\n# #\n# Un spammeur est de retour, fais gaffe! #\n# Je te surveille! #\n# #\n#-----------------------------------------------#```\n http://67.media.tumblr.com/tumblr_lvrf58vBkL1qibz0jo1_r1_500.png").queue();
|
||||
|
||||
|
||||
// #-----------------------------------------------#
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
55
src/net/borken/Outils/CommandParser.java
Normal file
55
src/net/borken/Outils/CommandParser.java
Normal file
@ -0,0 +1,55 @@
|
||||
package net.borken.Outils;
|
||||
|
||||
import net.dv8tion.jda.*;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 19/10/2016.
|
||||
*/
|
||||
|
||||
public class CommandParser {
|
||||
public static Entete entete=new Entete();
|
||||
public CommandContainer parse(String brt, MessageReceivedEvent e)
|
||||
{
|
||||
ArrayList<String> split =new ArrayList<String>();
|
||||
String brut =brt;
|
||||
String sansTete = brut.replaceFirst("//",""); // on retire l'entete
|
||||
String[] splitSansTete = sansTete.split(" "); // on prend l'espace comme separateur cmd/arg
|
||||
for(String s : splitSansTete){ //= pourchaque
|
||||
split.add(s); // on fait un truc que je comprend pas trop x)
|
||||
}
|
||||
String commande = split.get(0); // on recuperre la 1er partie qui correspond a la cmd
|
||||
String[] args = new String[split.size()-1];
|
||||
split.subList(1,split.size()).toArray(args);
|
||||
for(int i=0;i<args.length;i++)
|
||||
{
|
||||
args[i]=args[i].replace('$',' ');
|
||||
|
||||
|
||||
}
|
||||
System.out.println(entete.get("Info","CMD")+"Auteur: "+e.getMember().getEffectiveName()+", Commande: "+commande+", args: "+ Arrays.toString(args));
|
||||
return new CommandContainer(brut, sansTete, splitSansTete, commande, args, e); //On Save toute les info dans le container
|
||||
|
||||
}
|
||||
public class CommandContainer{
|
||||
public final String brut;
|
||||
public final String sansTete;
|
||||
public final String[] splitSansTete;
|
||||
public final String commande;
|
||||
public final String[] args;
|
||||
public final MessageReceivedEvent event;
|
||||
|
||||
public CommandContainer(String brut, String sansTete, String[] splitSansTete, String commande, String[] args, MessageReceivedEvent e)
|
||||
{
|
||||
this.brut=brut;
|
||||
this.sansTete=sansTete;
|
||||
this.splitSansTete=splitSansTete;
|
||||
this.commande=commande;
|
||||
this.args=args;
|
||||
this.event= e;
|
||||
}
|
||||
}
|
||||
}
|
41
src/net/borken/Outils/DayListener.java
Normal file
41
src/net/borken/Outils/DayListener.java
Normal file
@ -0,0 +1,41 @@
|
||||
package net.borken.Outils;
|
||||
import net.borken.commandes.Spam;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 09/11/2016.
|
||||
*/
|
||||
public class DayListener extends Thread {
|
||||
GregorianCalendar calendrier;
|
||||
int datePrecedente;
|
||||
|
||||
public DayListener() {
|
||||
calendrier = new GregorianCalendar();
|
||||
datePrecedente=0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(true)
|
||||
{
|
||||
if(calendrier.get(GregorianCalendar.DAY_OF_MONTH)!=datePrecedente)
|
||||
{
|
||||
Spam spam=new Spam();
|
||||
String str[]={"all"};
|
||||
datePrecedente=calendrier.get(GregorianCalendar.DAY_OF_MONTH);
|
||||
try {
|
||||
spam.reset(null,str);
|
||||
} catch (RateLimitedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
sleep(7200000);
|
||||
} catch (InterruptedException e) {
|
||||
System.err.println(new Entete().get("ERREUR","AutoReset")+e.getCause());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
src/net/borken/Outils/Entete.java
Normal file
26
src/net/borken/Outils/Entete.java
Normal file
@ -0,0 +1,26 @@
|
||||
package net.borken.Outils;
|
||||
|
||||
import enigma.console.TextAttributes;
|
||||
import net.borken.MainBot;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 24/10/2016.
|
||||
*/
|
||||
public class Entete {
|
||||
public String get(String type,String fonction){
|
||||
if (type.equals("ERREUR"))
|
||||
{
|
||||
MainBot.txtColor = new TextAttributes(Color.red, Color.black);
|
||||
MainBot.s_console.setTextAttributes(MainBot.txtColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainBot.txtColor = new TextAttributes(Color.blue, Color.black);
|
||||
MainBot.s_console.setTextAttributes(MainBot.txtColor);
|
||||
}
|
||||
return "["+new Heure().getString()+"] ["+type+"] ["+fonction+"]: ";
|
||||
|
||||
}
|
||||
}
|
30
src/net/borken/Outils/Heure.java
Normal file
30
src/net/borken/Outils/Heure.java
Normal file
@ -0,0 +1,30 @@
|
||||
package net.borken.Outils;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 21/10/2016.
|
||||
*/
|
||||
public class Heure {
|
||||
|
||||
|
||||
public int getHeure()
|
||||
{
|
||||
GregorianCalendar calendrier = new GregorianCalendar();
|
||||
return calendrier.get(GregorianCalendar.HOUR_OF_DAY);
|
||||
}
|
||||
public int getMin(){
|
||||
GregorianCalendar calendrier = new GregorianCalendar();
|
||||
return calendrier.get(GregorianCalendar.MINUTE);
|
||||
}
|
||||
public int getSeg(){
|
||||
GregorianCalendar calendrier = new GregorianCalendar();
|
||||
return calendrier.get(GregorianCalendar.SECOND);
|
||||
|
||||
}
|
||||
public String getString(){
|
||||
String str=String.format("%02d",this.getHeure())+":"+String.format("%02d",this.getMin())+":"+String.format("%02d",this.getSeg());
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
117
src/net/borken/Outils/Moderateur.java
Normal file
117
src/net/borken/Outils/Moderateur.java
Normal file
@ -0,0 +1,117 @@
|
||||
package net.borken.Outils;
|
||||
|
||||
import net.borken.MainBot;
|
||||
|
||||
import java.util.HashMap;
|
||||
import net.borken.Commande;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.managers.GuildManager;
|
||||
|
||||
import static net.borken.MainBot.historique;
|
||||
|
||||
/**
|
||||
* Created by Parayre on 24/10/2016.
|
||||
*/
|
||||
public class Moderateur {
|
||||
|
||||
|
||||
private String[] tabMessages;
|
||||
private Entete entete=new Entete();
|
||||
|
||||
public Moderateur() {}
|
||||
|
||||
// Cette méthode récupère le dernier message est le rajoute à "historique"
|
||||
// SI (spam) retourne 1 (si l'user spam)
|
||||
// SINON retourne 0
|
||||
public int analyse(Member user, Guild serveur, GuildManager serveurManager, MessageReceivedEvent event){
|
||||
|
||||
String[] toi = new String[5];//Creer tableau pour la copie
|
||||
int i = 0; // variable de parcours de "historique"
|
||||
int nbMessage = 3;
|
||||
int spam = 0;
|
||||
|
||||
/********************************************
|
||||
* si l'USER a deja envoyé un message *
|
||||
********************************************/
|
||||
if(MainBot.historique.containsKey(user))// Si le user a deja posté un message
|
||||
{
|
||||
/********************************************
|
||||
* COPIE des infos d"historique" vers TOI[] *
|
||||
********************************************/
|
||||
i = 0;
|
||||
while( (MainBot.historique.get(user)[i] != null) && (i < nbMessage) ){
|
||||
toi[i+1] = MainBot.historique.get(user)[i];
|
||||
i++;
|
||||
}
|
||||
/********************************************
|
||||
* Ajout dernier message recu + dans histo' *
|
||||
********************************************/
|
||||
toi[0] = event.getMessage().getContent();// On stocke en position [0] le nouveau message
|
||||
MainBot.historique.put(user, toi);// On ajoute dans l'historique TOI
|
||||
|
||||
/*****************************
|
||||
* ANALYSE des messages *
|
||||
*****************************/
|
||||
if(toi[3].equals(toi[2])&&toi[2].equals(toi[1]) && toi[1].equals(toi[0]) ){
|
||||
|
||||
spam = 1;
|
||||
System.out.println(entete.get("Info","MODERATEUR")+"Detection de spam pour "+user.getEffectiveName()+"avec 3 messages identique: ");
|
||||
for(int j=0;MainBot.historique.get(user).length-1>j;j++)
|
||||
{
|
||||
System.out.println(entete.get("Info","MODERATEUR")+"\t"+j+". "+MainBot.historique.get(user)[j]);
|
||||
}
|
||||
toi[0] = "";
|
||||
toi[1] = "";
|
||||
toi[2] = "";
|
||||
toi[3] = "";
|
||||
MainBot.historique.put(user, toi);
|
||||
}
|
||||
|
||||
} else {
|
||||
/********************************************
|
||||
* SI c'est le 1er message de l'USER *
|
||||
********************************************/
|
||||
// si le user n'a pas encore posté de message
|
||||
// on ajoute le dernier message dans "historique"
|
||||
toi[0] = event.getMessage().getContent();
|
||||
toi[1] = "";
|
||||
toi[2] = "";
|
||||
toi[3] = "";
|
||||
MainBot.historique.put(user, toi);
|
||||
}
|
||||
/**********************************
|
||||
* AFFICHAGE DE HISTORIQUE *
|
||||
**********************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/********************************************
|
||||
* Comptage du nombre de message *
|
||||
********************************************/
|
||||
if(MainBot.message_compteur.containsKey(user))// Si le user a deja posté un message
|
||||
{
|
||||
int cpt = MainBot.message_compteur.get(user);
|
||||
cpt++;
|
||||
//System.out.println("compteur : "+cpt);
|
||||
MainBot.message_compteur.put(user, cpt);
|
||||
if(cpt > 5){
|
||||
MainBot.message_compteur.put(user,0);
|
||||
spam = 1;
|
||||
System.out.println(entete.get("Info","MODERATEUR")+"Detection de spam pour "+user.getEffectiveName()+"avec 5 message en 5seg: ");
|
||||
String[] histo = MainBot.historique.get(user);
|
||||
for (String unMessage:histo ) //=for(int i=0; i<saveRoleUser.size(); i++)
|
||||
{
|
||||
System.out.println(entete.get("Info","MODERATEUR")+"\t*"+unMessage);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
MainBot.message_compteur.put(user, 1);
|
||||
}
|
||||
|
||||
return spam;
|
||||
}
|
||||
}
|
36
src/net/borken/Outils/Redirection.java
Normal file
36
src/net/borken/Outils/Redirection.java
Normal file
@ -0,0 +1,36 @@
|
||||
package net.borken.Outils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 07/11/2016.
|
||||
*/
|
||||
public class Redirection {
|
||||
Entete entete=new Entete();
|
||||
|
||||
public Redirection(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String get(String urlString) throws IOException {
|
||||
URLConnection con = new URL(urlString).openConnection();
|
||||
//System.out.println( "orignal url: " + con.getURL() );
|
||||
con.connect();
|
||||
//System.out.println( "connected url: " + con.getURL() );
|
||||
InputStream is = null;
|
||||
is = con.getInputStream();
|
||||
String urlReturn=con.getURL().toString();
|
||||
//System.out.println( "redirected url: " + con.getURL() );
|
||||
is.close();
|
||||
return urlReturn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
66
src/net/borken/commandes/Help.java
Normal file
66
src/net/borken/commandes/Help.java
Normal file
@ -0,0 +1,66 @@
|
||||
package net.borken.commandes;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.MainBot;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 23/10/2016.
|
||||
*/
|
||||
public class Help implements Commande {
|
||||
public static Entete entete=new Entete();
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
if(args.length>=1)
|
||||
{
|
||||
String argsString = args[0];
|
||||
//System.out.println(argsString);
|
||||
if (MainBot.commandes.containsKey(argsString))
|
||||
{
|
||||
System.out.println(entete.get("Info","HELP")+"Aide demmander pour la cmd "+argsString+" par "+event.getMember().getEffectiveName());
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n\n"+MainBot.commandes.get(argsString).help(args)).queue();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Commande Inconue!__** :warning:").queue();
|
||||
System.out.println(entete.get("Info","HELP")+"Commande Inconnue!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
String txt="";
|
||||
for (Map.Entry<String, Commande> e : MainBot.commandes.entrySet()) {
|
||||
txt=txt+"\n//"+e.getKey();
|
||||
|
||||
}
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:arrow_right:\t**__commandes envoyées par message privé__**").queue();
|
||||
event.getAuthor().getPrivateChannel().sendMessage("Commandes du bot:\n\n```"+txt+"```\n\nUtilise `//help <commande>` pour plus de détails.").queue();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
}
|
173
src/net/borken/commandes/Move.java
Normal file
173
src/net/borken/commandes/Move.java
Normal file
@ -0,0 +1,173 @@
|
||||
package net.borken.commandes;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.Role;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
import net.dv8tion.jda.core.managers.GuildController;
|
||||
import net.dv8tion.jda.core.managers.GuildManager;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 20/10/2016.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Move implements Commande {
|
||||
|
||||
|
||||
private String HELP="`//move <@utilisateur> <@rôleCible>`\n:arrow_right:\t*Deplacement d'un utilisateur vers un rôle cible, attention à bien faire des montions.*";
|
||||
public List<Role> saveRoleUser;
|
||||
public Member user;
|
||||
public Guild serveur;
|
||||
public GuildManager serveurManager;
|
||||
public GuildController guildController;
|
||||
public static Entete entete=new Entete();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param user
|
||||
* @param cible
|
||||
* @param reset
|
||||
* @param serveur
|
||||
* @param serveurManager
|
||||
* @return
|
||||
*/
|
||||
public boolean exc(Member user, Role cible , boolean reset, Guild serveur, GuildManager serveurManager)
|
||||
{
|
||||
guildController = new GuildController(serveur);
|
||||
boolean erreur = false;
|
||||
List<Role> allRoll = serveur.getRoles();
|
||||
System.out.println();
|
||||
|
||||
|
||||
//On recupere les roles de l'utilisateur
|
||||
|
||||
List<Role> roleUserList = user.getRoles();
|
||||
System.out.println();
|
||||
System.out.println(entete.get("Info","MOVER")+"Roles de " + user.getEffectiveName() + ":");
|
||||
|
||||
//On les save
|
||||
saveRoleUser = roleUserList;
|
||||
|
||||
//Ajout du role cible
|
||||
|
||||
//On transforme la le role a ajouter en une liste pour pouvoir l'utiliser dans modifyMemberRoles
|
||||
Collection<Role> temp = new ArrayList<>();
|
||||
temp.add(cible);
|
||||
|
||||
//on fait ensuite les modif
|
||||
guildController.modifyMemberRoles(user,temp,saveRoleUser).queue();
|
||||
|
||||
System.out.println(entete.get("Info","MOVER")+"Role " + cible + " attribuer a " + user.getEffectiveName());
|
||||
|
||||
this.user=user;
|
||||
this.serveur=serveur;
|
||||
this.serveurManager=serveurManager;
|
||||
return erreur;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param args
|
||||
* @param event
|
||||
*/
|
||||
public void action(String[] args, MessageReceivedEvent event)
|
||||
{
|
||||
if(args.length>=2)
|
||||
{
|
||||
serveur=event.getGuild();
|
||||
List<User> userL = event.getMessage().getMentionedUsers();
|
||||
List<Role> roleL = event.getMessage().getMentionedRoles();
|
||||
|
||||
if(userL.size()<1 ||roleL.size()<1)
|
||||
{
|
||||
System.out.println(entete.get("ERREUR","MOVE")+"Mentionnement Incorect.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Erreur de déplacement__** :warning:\n:arrow_right: Erreur, Utilisateur ou Role mal mentioner. `//help move` pour plus d'info ").queue();
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(userL.get(0));
|
||||
user = serveur.getMember(userL.get(0));
|
||||
Role roleCible = roleL.get(0);
|
||||
serveur=event.getGuild();
|
||||
System.out.println(entete.get("Info","CMD")+"Tentative de déplacement de "+user.getEffectiveName()+" vers "+roleCible.getName()+" par l'utilisateur "+event.getAuthor().getName());
|
||||
if(event.getMember().getRoles().contains(serveur.getRolesByName("Big_Daddy",false).get(0)))
|
||||
{
|
||||
|
||||
System.out.println(entete.get("Info","MOVE")+"Autorisation suffisante, deplacement autorisé");
|
||||
System.out.println(entete.get("Info","MOVE")+"Utilisateur trouvée");
|
||||
boolean erreur=this.exc(user,roleCible,true,serveur,serveur.getManager());
|
||||
if(erreur)
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Erreur de déplacement.__** :warning:\n:arrow_right: Verifier le rôle cible. ").queue();
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:ok: **Déplacement de "+user.getEffectiveName()+" vers "+roleCible.getName()+" reussi.** :ok:").queue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("Info","MOVE")+"Autorisation insuffisante, deplacement refusé");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Vous n'avez pas l'autorisation de faire ca!__**:warning: ").queue();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("ERREUR","MOVE")+"Arguments maquant.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Erreur de déplacement__** :warning:\n:arrow_right: Arguments manquant. `//help move` pour plus d'info ").queue();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return HELP;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param success
|
||||
* @param event
|
||||
*/
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
|
||||
}
|
52
src/net/borken/commandes/Over18/Ass.java
Normal file
52
src/net/borken/commandes/Over18/Ass.java
Normal file
@ -0,0 +1,52 @@
|
||||
package net.borken.commandes.Over18;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.borken.Outils.Redirection;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 07/11/2016.
|
||||
*/
|
||||
public class Ass implements Commande{
|
||||
public String HELP="T'es sérieux la?";
|
||||
Entete entete= new Entete();
|
||||
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
if(event.getTextChannel().getName().equals("over18")) {
|
||||
Redirection redirect= new Redirection();
|
||||
try {
|
||||
event.getTextChannel().sendMessage(redirect.get("http://les400culs.com/random")).queue();
|
||||
System.out.println(entete.get("ERREUR","Ass")+"Erreur de redirection.");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Channel règlementé! Go sur over18!__**:warning: ").queue();
|
||||
|
||||
System.out.println(entete.get("ERREUR","Ass")+"Erreur chanel.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
}
|
49
src/net/borken/commandes/Over18/Boobs.java
Normal file
49
src/net/borken/commandes/Over18/Boobs.java
Normal file
@ -0,0 +1,49 @@
|
||||
package net.borken.commandes.Over18;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.borken.Outils.Redirection;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 07/11/2016.
|
||||
*/
|
||||
public class Boobs implements Commande {
|
||||
public String HELP="T'es sérieux la?";
|
||||
Entete entete=new Entete();
|
||||
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
if(event.getTextChannel().getName().equals("over18")) {
|
||||
Redirection redirect = new Redirection();
|
||||
try {
|
||||
event.getTextChannel().sendMessage(redirect.get("http://lesaintdesseins.fr/random")).queue();
|
||||
} catch (IOException e) {
|
||||
System.out.println(entete.get("ERREUR", "Boobs") + "Erreur de redirection.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Channel règlementé! Go sur over18!__**:warning: ").queue();
|
||||
System.out.println(entete.get("ERREUR","Boobs")+"Erreur chanel.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
}
|
51
src/net/borken/commandes/Over18/Madame.java
Normal file
51
src/net/borken/commandes/Over18/Madame.java
Normal file
@ -0,0 +1,51 @@
|
||||
package net.borken.commandes.Over18;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Redirection;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static net.borken.MainBot.entete;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 11/11/2016.
|
||||
*/
|
||||
public class Madame implements Commande{
|
||||
public String HELP="T'es sérieux la?";
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
if(!event.getTextChannel().getName().equals("le_cours")) {
|
||||
Redirection redirect = new Redirection();
|
||||
try {
|
||||
event.getTextChannel().sendMessage(redirect.get("http://dites.bonjourmadame.fr/random")).queue();
|
||||
} catch (IOException e) {
|
||||
System.out.println(entete.get("ERREUR", "Madame") + "Erreur de redirection.");
|
||||
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur de redirection, Réessayez__**:warning: ").queue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Channel règlementé!__**:warning: ").queue();
|
||||
|
||||
System.out.println(entete.get("ERREUR","Madame")+"Erreur chanel.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
}
|
53
src/net/borken/commandes/Over18/Pipe.java
Normal file
53
src/net/borken/commandes/Over18/Pipe.java
Normal file
@ -0,0 +1,53 @@
|
||||
package net.borken.commandes.Over18;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.borken.Outils.Redirection;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 07/11/2016.
|
||||
*/
|
||||
public class Pipe implements Commande {
|
||||
public String HELP="T'es sérieux la?";
|
||||
Entete entete = new Entete();
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
Redirection redirect= new Redirection();
|
||||
if(event.getTextChannel().getName().equals("over18"))
|
||||
{
|
||||
|
||||
try {
|
||||
event.getTextChannel().sendMessage(redirect.get("http://feelation.com/random")).queue();
|
||||
} catch (IOException e) {
|
||||
System.out.println(entete.get("ERREUR", "Pipe") + "Erreur de redirection.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Channel règlementé! Go sur over18!__**:warning: ").queue();
|
||||
|
||||
System.out.println(entete.get("ERREUR","Pipe")+"Erreur chanel.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
}
|
52
src/net/borken/commandes/Over18/SM.java
Normal file
52
src/net/borken/commandes/Over18/SM.java
Normal file
@ -0,0 +1,52 @@
|
||||
package net.borken.commandes.Over18;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.borken.Outils.Redirection;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 10/11/2016.
|
||||
*/
|
||||
public class SM implements Commande {
|
||||
public String HELP="T'es sérieux la?";
|
||||
Entete entete = new Entete();
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
Redirection redirect= new Redirection();
|
||||
if(event.getTextChannel().getName().equals("over18"))
|
||||
{
|
||||
try {
|
||||
event.getTextChannel().sendMessage(redirect.get("http://bonjourfetish.tumblr.com/random")).queue();
|
||||
} catch (IOException e) {
|
||||
System.out.println(entete.get("ERREUR","Pipe")+"Erreur de redirection.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Channel règlementé! Go sur over18!__**:warning: ").queue();
|
||||
|
||||
System.out.println(entete.get("ERREUR","SM")+"Erreur chanel.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
return HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event) {
|
||||
|
||||
}
|
||||
}
|
39
src/net/borken/commandes/PingCommande.java
Normal file
39
src/net/borken/commandes/PingCommande.java
Normal file
@ -0,0 +1,39 @@
|
||||
package net.borken.commandes;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
/**
|
||||
* Created by seb65 on 19/10/2016.
|
||||
*/
|
||||
public class PingCommande implements Commande {
|
||||
|
||||
|
||||
private String HELP = "`//ping` \n :arrow_right:\t*Le bot vous répondra Pong!*";
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event) {
|
||||
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+" Pong!").queue();
|
||||
System.out.println("pong");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String help(String[] args) {
|
||||
|
||||
return HELP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
322
src/net/borken/commandes/Spam.java
Normal file
322
src/net/borken/commandes/Spam.java
Normal file
@ -0,0 +1,322 @@
|
||||
package net.borken.commandes;
|
||||
|
||||
import net.borken.Commande;
|
||||
import net.borken.MainBot;
|
||||
import net.borken.Outils.AntiSpam;
|
||||
import net.borken.Outils.Entete;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.Role;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.exceptions.RateLimitedException;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* Created by seb65 on 27/10/2016.
|
||||
*/
|
||||
public class Spam implements Commande {
|
||||
Entete entete =new Entete();
|
||||
@Override
|
||||
public boolean called(String[] args, MessageReceivedEvent event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(String[] args, MessageReceivedEvent event)
|
||||
{
|
||||
/****************************
|
||||
* Verif argument *
|
||||
****************************/
|
||||
if(args.length>=1)
|
||||
{
|
||||
|
||||
String commande = args[0];
|
||||
/****************************
|
||||
* on traite la commande *
|
||||
****************************/
|
||||
switch (commande) {
|
||||
|
||||
case "pardon":
|
||||
this.pardon(event,args);
|
||||
break;
|
||||
|
||||
case "extermine":
|
||||
try {
|
||||
this.extermine(event,args);
|
||||
} catch (RateLimitedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "reset":
|
||||
try {
|
||||
this.reset(event,args);
|
||||
} catch (RateLimitedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String help(String[] args)
|
||||
{
|
||||
return "`//spam extermine <@utilisateur> <multiplicateur>`\n:arrow_right:\t*Punir un spammeur.*\n\n`//spam pardon <@utilisateur>`\n:arrow_right:\t*Anuller la punition d'un utilisateur.*\n\n`//spam reset <@utilisateur>`\n:arrow_right:\t*RAZ du multiplicateur d'un utilisateur.*";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executed(boolean success, MessageReceivedEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void pardon(MessageReceivedEvent event, String[] args){
|
||||
|
||||
Guild serveur = event.getGuild();
|
||||
/****************************
|
||||
* verif argument *
|
||||
****************************/
|
||||
if (args.length >= 1)
|
||||
{
|
||||
/****************************
|
||||
* On recupere l'utilisateur et le role cible
|
||||
****************************/
|
||||
List<User> userL = event.getMessage().getMentionedUsers();
|
||||
|
||||
|
||||
/****************************
|
||||
* verif utilisteur trouver *
|
||||
****************************/
|
||||
if(userL.size()<1)
|
||||
{
|
||||
System.out.println(entete.get("ERREUR", "CMD") + "Utilisateur introuvable.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur__** :warning:\n:arrow_right: Utilisateur introuvable. ");
|
||||
}
|
||||
else {
|
||||
Member user = serveur.getMember(userL.get(0));
|
||||
System.out.println(entete.get("Info", "CMD") + "Tentative de pardon de " + user.getEffectiveName() + " par l'utilisateur " + event.getMember().getEffectiveName());
|
||||
/****************************
|
||||
* c'est un big dady *
|
||||
****************************/
|
||||
|
||||
if (event.getMember().getRoles().get(0)==serveur.getRolesByName("Big_Daddy",false).get(0)) {
|
||||
System.out.println(entete.get("Info", "CMD") + "Autorisation suffisante, pardon autorisé");
|
||||
|
||||
/****************************
|
||||
* virif si en spammer *
|
||||
****************************/
|
||||
if (MainBot.minuteurStatut.containsKey(user)) {
|
||||
if (MainBot.minuteurStatut.get(user)) {
|
||||
MainBot.minuteurStatut.put(user, false);
|
||||
} else {
|
||||
System.out.println(entete.get("ERREUR", "CMD") + "Utilisateur pas en spam.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur__** :warning:\n:arrow_right: Utilisateur non spammeur. ");
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
System.out.println(entete.get("ERREUR", "CMD") + "Utilisateur pas en spam.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur__** :warning:\n:arrow_right: Utilisateur non spammeur. ");
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println(entete.get("Info", "CMD") + "Autorisation insuffisante, pardon refusé");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:no_entry_sign: **__Vous n'avez pas l'autorisation de faire sa!__** :no_entry_sign: ");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("Info","ERREUR")+"Argument manquant.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Argument manquant__**:warning: \n:arrow_right: Utilisation: `//spam pardon <@utilisateur>`.");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void extermine(MessageReceivedEvent event, String[] args) throws RateLimitedException {
|
||||
/****************************
|
||||
* verif argument *
|
||||
****************************/
|
||||
if (args.length >= 3)
|
||||
{
|
||||
/****************************
|
||||
* On recupere l'utilisateur et le role cible
|
||||
****************************/
|
||||
List<User> userL = event.getMessage().getMentionedUsers();
|
||||
|
||||
|
||||
/****************************
|
||||
* verif utilisteur trouver *
|
||||
****************************/
|
||||
if(userL.size()<1)
|
||||
{
|
||||
System.out.println(entete.get("ERREUR","CMD")+"Mentionnement Incorect (Spam).");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Erreur__** :warning:\n:arrow_right: Erreur, Utilisateur mal mentioner. `//help spam extermine` pour plus d'info ").queue();
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
Guild serveur = event.getGuild();
|
||||
Member user = serveur.getMember(userL.get(0));
|
||||
System.out.println(entete.get("Info","CMD")+"Tentative d'extermination de "+user.getEffectiveName()+" par l'utilisateur "+event.getAuthor().getName());
|
||||
/****************************
|
||||
* c'est un big dady *
|
||||
****************************/
|
||||
|
||||
if(event.getMember().getRoles().get(0)==serveur.getRolesByName("Big_Daddy",false).get(0))
|
||||
{
|
||||
System.out.println(entete.get("Info","CMD")+"Autorisation suffisante, extermination autorisé");
|
||||
String multiStr =args[2];
|
||||
|
||||
|
||||
/****************************
|
||||
* virif pas deja en spammer *
|
||||
****************************/
|
||||
if(MainBot.minuteurStatut.containsKey(user))
|
||||
{
|
||||
if(!MainBot.minuteurStatut.get(user))
|
||||
{
|
||||
this.goSpam(user,multiStr,serveur,event);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("ERREUR","CMD")+"Utilisateur deja en spam.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Erreur__** :warning:\n:arrow_right: Utilisateur déjà spammeur. ").queue();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.goSpam(user,multiStr,serveur,event);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("Info","CMD")+"Autorisation insuffisante, extermination refusé");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:no_entry_sign: **__Vous n'avez pas l'autorisation de faire sa!__** :no_entry_sign: ").queue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("Info","ERREUR")+"Argument manquant.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Argument manquant__**:warning: \n:arrow_right: Utilisation: `//spam extermine <utilisateur> <multiplicateur>`.").queue();
|
||||
}
|
||||
}
|
||||
|
||||
public void reset(MessageReceivedEvent event, String[] args) throws RateLimitedException {
|
||||
if(event!=null)
|
||||
{
|
||||
if(args.length>=2)
|
||||
{
|
||||
|
||||
Guild serveur = event.getGuild();
|
||||
/****************************
|
||||
* On recupere l'utilisateur et le role cible
|
||||
****************************/
|
||||
List<User> userL = event.getMessage().getMentionedUsers();
|
||||
|
||||
|
||||
/****************************
|
||||
* verif utilisteur trouver *
|
||||
****************************/
|
||||
if(userL.size()<1)
|
||||
{
|
||||
System.out.println(entete.get("ERREUR", "CMD") + "Utilisateur introuvable.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:warning: **__Erreur__** :warning:\n:arrow_right: Utilisateur introuvable. ").queue();
|
||||
|
||||
}
|
||||
else {
|
||||
Member user = serveur.getMember(userL.get(0));
|
||||
System.out.println(entete.get("Info", "CMD") + "Tentative de reset de " + user.getEffectiveName() + " par l'utilisateur " + event.getMember().getEffectiveName());
|
||||
/****************************
|
||||
* c'est un big dady *
|
||||
****************************/
|
||||
|
||||
if ( event.getMember().getRoles().get(0) == serveur.getRolesByName("Big_Daddy", false).get(0)) {
|
||||
System.out.println(entete.get("Info", "CMD") + "Autorisation suffisante, pardon autorisé");
|
||||
/****************************
|
||||
* verif utilisteur trouver *
|
||||
****************************/
|
||||
if (MainBot.userMulti.containsKey(user)) {
|
||||
System.out.println(entete.get("Info", "CMD") + "Reset du multiplicateur de " + user.getEffectiveName() + " réussi");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n *Le multiplcicateur de " + user.getEffectiveName() + " a été remit a zéro.*").queue();
|
||||
MainBot.userMulti.remove(user);
|
||||
|
||||
}
|
||||
} else {
|
||||
System.out.println(entete.get("Info", "CMD") + "Autorisation insuffisante, reset refusé");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention() + "\n:no_entry_sign: **__Vous n'avez pas l'autorisation de faire ca!__** :no_entry_sign: ").queue();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(entete.get("Info","ERREUR")+"Argument manquant.");
|
||||
event.getTextChannel().sendMessage(event.getAuthor().getAsMention()+"\n:warning: **__Argument manquant__**:warning: \n:arrow_right: Utilisation: `//spam reset <utilisateur>`.").queue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args[0].equals("all"))
|
||||
{
|
||||
System.out.println(entete.get("Info","AutoReset")+"Reset automatique des multiplicateur.");
|
||||
for (Member unUser: MainBot.userMulti.keySet() ) //=for(int i=0; i<saveRoleUser.size(); i++)
|
||||
{
|
||||
MainBot.message_compteur.remove(unUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void goSpam(Member user, String multiStr, Guild serveur, MessageReceivedEvent event)
|
||||
{
|
||||
if(Objects.equals(multiStr, "/"))
|
||||
{
|
||||
new AntiSpam().extermine(user,serveur,serveur.getManager(),true,event);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int multi = Integer.parseInt(multiStr);
|
||||
if(MainBot.minuteurStatut.containsKey(user))
|
||||
{
|
||||
MainBot.userMulti.replace(user,multi);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainBot.userMulti.put(user,multi);
|
||||
}
|
||||
|
||||
new AntiSpam().extermine(user,serveur,serveur.getManager(),false,event);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user